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