A missing t1lib.h or libt1 makes no difference. Added a respective message
[swftools.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl AC_INIT(src/) # old autoconf
4 AC_INIT
5 AC_CONFIG_SRCDIR([src/])
6
7 AC_ARG_ENABLE(checkmem,
8 [  --enable-checkmem       turn on ccmalloc debugging], CHECKMEM=true)
9 AC_ARG_ENABLE(debug,
10 [  --enable-debug          turn on debugging], DEBUG=true)
11 AC_ARG_ENABLE(warnings,
12 [  --enable-warnings       turn on compiler warnings], ENABLE_WARNINGS=true)
13 AC_ARG_ENABLE(optimizations,
14 [  --enable-optimizations  turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true)
15 AC_ARG_ENABLE(lame,
16 [  --disable-lame          don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
17
18 PACKAGE=swftools
19 VERSION=2004-10-24-1908
20
21
22 # ------------------------------------------------------------------
23
24 if test "x${srcdir}" != "x."; then
25     echo "--srcdir is not supported"
26     exit 1
27 fi
28
29 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
30 if test "x$ENABLE_WARNINGS" '!=' "x";then
31     WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls"
32 fi
33
34 if test "x$CHECKMEM" '!=' "x";then
35     DEBUG=yes
36 fi
37 if test "x$DEBUG" '!=' "x";then
38     CFLAGS="$WARNINGS -g $CFLAGS"
39     CXXFLAGS="$WARNINGS -g $CXXFLAGS"
40 else if test "x$OPTIMIZE" '!=' "x"; then
41     CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
42     CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
43 else
44     CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
45     CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
46 fi
47 fi
48 #OLDGCC=1
49 #if test "x$OLDGCC" '!=' "x";then
50 #     #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
51 #     #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
52 #     CFLAGS="$CFLAGS -ansi -pendantic"
53 #     CXXFLAGS="$CXXFLAGS -ansi -pendantic"
54 #fi
55
56 export PACKAGE VERSION CFLAGS CXXFLAGS
57
58 dnl Checks for programs.
59  AC_CANONICAL_HOST
60 MACOSX=
61 case $host_os in
62     *darwin* ) 
63         MACOSX=yes
64         CFLAGS="$CFLAGS -fno-rtti"
65         CXXFLAGS="$CXXFLAGS -fno-rtti"
66         ;;
67 esac
68 dnl Checks for programs.
69  AC_PROG_CC
70  AC_PROG_CXX
71     
72 if test "x$CHECKMEM" '!=' "x";then
73     CC="ccmalloc $CC"
74     CXX="ccmalloc $CXX"
75     #echo running again
76     #unset ac_cv_prog_CC
77     #unset ac_cv_prog_CXX
78     #AC_PROG_CC
79     #AC_PROG_CXX
80 fi
81  AC_PROG_CPP
82
83  AC_PROG_RANLIB
84  AC_PROG_MAKE_SET
85  AC_PROG_INSTALL
86  AC_PROG_LN_S
87  AC_PROG_LIBTOOL
88  AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
89
90 dnl Checks for system services
91  AC_EXEEXT
92
93 RFX_CHECK_MING
94
95 SLEXT="so"
96 if test "x${MINGW}" != "xyes"; then
97     # no mingW
98     AC_DEFINE_UNQUOTED(O_BINARY, 0)
99 else
100     # mingW
101     SLEXT="dll"
102 fi
103 export SLEXT
104 AC_SUBST(SLEXT)
105
106 # The following tries to make use of includes and libraries in
107 # /usr/local, too. Notice: A -I/usr/local/include might break
108 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include, 
109 # especially on systems which link /usr/local to /usr, so it has yet
110 # to be seen how useful this is.
111 if test -d /usr/local/lib; then
112     LDFLAGS="$LDFLAGS -L/usr/local/lib"
113 fi
114 if test -d /usr/local/include; then
115 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
116 #   CPPFLAGS="$CPPFLAGS -I/usr/local/include"
117     echo > /dev/null
118 fi
119 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
120     # if the user has a special prefix (like /opt), there might also be $prefix/lib
121     # and $prefix/include, which should be included in our search paths for libraries
122     # and includes.
123     LDFLAGS="$LDFLAGS -L${libdir}"
124     CPPFLAGS="$CPPFLAGS -I${includedir}"
125     # TODO- test whether gcc still works after this
126 fi
127
128 # this must be done after (I believe) AC_PROG_MAKE_SET
129 if test "x$DEBUG" '!=' "x";then
130     STRIP="@echo debug enabled, not stripping "
131     export STRIP
132     AC_SUBST(STRIP)
133 fi
134
135 dnl Checks for libraries.
136  AC_CHECK_LIB(m, sin,, 
137  echo "Error: Math library not found.";
138  exit;
139  )
140  AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
141  AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
142  AC_CHECK_LIB(t1, T1_LoadFont,, T1LIBMISSING=true)
143
144 RFX_CHECK_BYTEORDER
145 AC_SUBST(WORDS_BIGENDIAN)
146 RFX_CHECK_SYSTEM_BACKTICKS
147 AC_SUBST(SYSTEM_BACKTICKS)
148
149 AC_ARG_PROGRAM
150
151 dnl Checks for header files.
152  AC_CONFIG_HEADER(config.h)
153  AC_HEADER_DIRENT
154  AC_HEADER_STDC
155  AC_CHECK_HEADERS(zlib.h jpeglib.h t1lib.h assert.h signal.h pthread.h sys/stat.h sys/types.h dirent.h sys/bsdtypes.h sys/ndir.h sys/dir.h ndir.h time.h)
156
157 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
158 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
159 AC_SUBST(PACKAGE)
160 AC_SUBST(VERSION)
161
162 AC_SUBST(HAVE_UNISTD_H)
163 AC_SUBST(EXEEXT)
164
165 dnl Checks for typedefs, structures, and compiler characteristics.
166  AC_C_CONST
167  AC_C_INLINE
168  AC_TYPE_OFF_T
169  AC_TYPE_SIZE_T
170  AC_STRUCT_TM
171  AC_CHECK_TYPE(boolean,int) #needed for jpeglib
172  dnl AC_CHECK_TYPE(bool,char)
173  dnl AC_CHECK_TYPE(uchar,unsigned char)
174  dnl AC_CHECK_TYPE(schar,signed char)
175  dnl AC_CHECK_TYPE(word,unsigned short int)
176  dnl AC_CHECK_TYPE(sword,unsigned short int)
177  dnl AC_CHECK_TYPE(uint,unsigned long int)
178
179 dnl Checks for library functions.
180  AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
181
182 # ------------------------------------------------------------------
183
184 RFX_CHECK_FREETYPE
185
186 RFX_CHECK_FONTCONFIG
187
188 # ------------------------------------------------------------------
189  
190 lame_objects= 
191 lame_makefile=
192 if test "x${DISABLE_LAME}" = "xtrue"; then
193     echo "*" Disabling lame support...
194 else
195     # old lame code at lib/lame
196     if test -f lib/lame/Makefile.in; then
197         lame_objects="lame/psymodel.o lame/fft.o lame/newmdct.o lame/quantize.o lame/takehiro.o lame/reservoir.o lame/quantize_pvt.o lame/vbrquantize.o lame/encoder.o lame/id3tag.o lame/version.o lame/tables.o lame/util.o lame/bitstream.o lame/set_get.o lame/VbrTag.o lame/lame.o"
198         lame_makefile="lib/lame/Makefile"
199         CPPFLAGS="$CPPFLAGS -Ilame"
200         AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
201     else
202         if test -d /usr/include/lame; then
203             CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
204         else
205             if test -d /usr/local/include/lame; then
206                 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
207             fi
208         fi
209         AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
210         AC_CHECK_HEADERS(lame.h)
211         if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$ac_cv_header_lame_h" "!=" "x";then
212             AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
213         fi
214     fi
215 fi
216 AC_SUBST(lame_objects)
217
218 # ------------------------------------------------------------------
219  
220 RFX_CHECK_AVI2SWF
221 if test "x${AVIFILE}" = "xtrue"; then
222     VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
223     VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
224     AC_DEFINE_UNQUOTED(HAVE_AVIFILE, 1)
225 fi
226
227 if test "x${WIN32}" != "x"; then
228     #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
229     #if test "x${AVIFIL32}" != "x"; then
230     #  VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
231     #fi
232     VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
233     AVIFIL32=true
234 fi
235
236 AC_SUBST(VIDEO_LIBS)
237 AC_SUBST(VIDEO_CFLAGS)
238 # ------------------------------------------------------------------
239
240 if test "x${UNCOMPRESS}" = "xgzip"; then
241     AC_DEFINE_UNQUOTED(USE_GZIP, 1)
242 fi
243 AC_SUBST(USE_GZIP)
244
245 # ------------------------------------------------------------------
246
247 RFX_CHECK_PYTHON
248
249 if test "x$PYTHON_OK" '!=' "xyes";then
250     echo all install uninstall clean: > lib/python/Makefile
251     # fail silently- the most users won't have any need for the
252     # python interface anyway
253 else
254     pythonrfxswf="lib/python/Makefile"
255 fi
256
257 # ------------------------------------------------------------------
258
259 AC_MSG_CHECKING([for missing libraries])
260
261 if test "x$ZLIBMISSING" = "xtrue";then
262     MISSINGLIBS="${MISSINGLIBS} zlib"
263     DISABLEPNG2SWF=true
264     PARTIAL=true
265 fi
266 if test "x$JPEGLIBMISSING" = "xtrue";then
267     MISSINGLIBS="${MISSINGLIBS} jpeglib"
268     DISABLEPDF2SWF=true
269     DISABLEJPEG2SWF=true
270     PARTIAL=true
271 fi
272 if test "x$T1LIBMISSING" = "xtrue";then
273     MISSINGLIBS="${MISSINGLIBS} t1lib"
274 fi
275
276 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
277     DISABLEPDF2SWF=true;
278     DISABLEJPEG2SWF=true;
279     MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
280     PARTIAL=true
281 fi
282 if test "x$HAVE_FREETYPE" '!=' "x1"; then
283     DISABLEPDF2SWF=true;
284     MISSINGLIBS="${MISSINGLIBS} freetype"
285     PARTIAL=true
286 fi
287 if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
288     MISSINGLIBS="${MISSINGLIBS} t1lib.h"
289 fi
290 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
291     DISABLEPNG2SWF=true;
292     MISSINGLIBS="${MISSINGLIBS} zlib.h"
293     PARTIAL=true
294 fi
295 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
296     MISSINGLIBS="${MISSINGLIBS} avifile"
297     PARTIAL=true
298 fi
299
300 AC_MSG_RESULT(${MISSINGLIBS})
301
302 # ------------------------------------------------------------------
303
304 if test "x${MISSINGLIBS}" '!=' "x"; then
305   echo "***************************************************"
306   echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
307 fi
308
309 avi2swf="avi2swf/Makefile"
310 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
311  echo "* Disabling avi2swf tool..."
312  echo all install uninstall clean: > avi2swf/Makefile
313  avi2swf=
314 fi
315
316 pdf2swf_makefile="pdf2swf/Makefile pdf2swf/xpdf/Makefile"
317 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
318   echo "* Disabling pdf2swf tool..."
319   rm -f pdf2swf/Makefile
320   echo all install uninstall clean: > pdf2swf/Makefile
321   pdf2swf_makefile=""
322 fi
323
324 if test "x${ZLIBMISSING}" = "xtrue"; then
325   echo
326   echo "* Warning! Without zlib, you will not be able to read"
327   echo "* or write compressed Flash MX files!"
328 fi
329
330 JPEG2SWF='jpeg2swf$(E)'
331 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
332   echo "* Disabling jpeg2swf tool..."
333   JPEG2SWF=
334 fi
335 export JPEG2SWF
336 AC_SUBST(JPEG2SWF)
337
338 PNG2SWF='png2swf$(E)'
339 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
340   echo "* Disabling png2swf tool..."
341   PNG2SWF=
342 fi
343 export PNG2SWF
344 AC_SUBST(PNG2SWF)
345
346 if test "x${MISSINGLIBS}" '!=' "x"; then
347   if test "x${PARTIAL}" '=' "x"; then
348     echo "* (never mind)"
349   fi
350   echo "***************************************************"
351 fi
352
353 # ------------------------------------------------------------------
354
355 if test -f "release.in"; then release_in="./release"; fi
356 FILES="$release_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythonrfxswf} ${lame_makefile}"
357
358 dnl AC_OUTPUT(${FILES}) old autoconf
359 AC_CONFIG_FILES([${FILES}])
360 AC_OUTPUT
361