1 dnl Process this file with autoconf to produce a configure script.
8 dnl AC_CONFIG_SRCDIR([src/])
10 AC_ARG_ENABLE(checkmem,
11 [ --enable-checkmem turn on ccmalloc debugging], CHECKMEM=true)
13 [ --enable-debug turn on debugging], DEBUG=true)
14 AC_ARG_ENABLE(profiling,
15 [ --enable-profiling turn on profiling], PROFILING=true)
16 AC_ARG_ENABLE(warnings,
17 [ --enable-warnings turn on compiler warnings], ENABLE_WARNINGS=true)
18 AC_ARG_ENABLE(optimizations,
19 [ --enable-optimizations turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true)
21 [ --disable-lame don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
24 VERSION=2007-02-06-1213
27 # ------------------------------------------------------------------
29 if test "x${srcdir}" != "x."; then
30 echo "--srcdir is not supported"
34 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
35 if test "x$ENABLE_WARNINGS" '!=' "x";then
36 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls -D_FORTIFY_SOURCE=2 "
39 if test "x$CHECKMEM" '!=' "x";then
42 if test "x$PROFILING" '!=' "x";then
45 if test "x$DEBUG" '!=' "x";then
46 if test "x$PROFILING" = "x";then
47 CFLAGS="$WARNINGS -O2 -g $CFLAGS"
48 CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
51 CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
52 CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
53 LDFLAGS="-g -pg $LIBS"
55 else if test "x$OPTIMIZE" '!=' "x"; then
56 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
57 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
59 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
60 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
64 CFLAGS="-fPIC $CFLAGS"
65 CXXFLAGS="-fPIC $CFLAGS"
68 #if test "x$OLDGCC" '!=' "x";then
69 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
70 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
71 # CFLAGS="$CFLAGS -ansi -pendantic"
72 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
75 export PACKAGE VERSION CFLAGS CXXFLAGS
77 dnl Checks for programs.
87 CXXFLAGS="$CXXFLAGS -fno-rtti"
89 # Use fink packages if available.
90 #if test -d /sw/include && test -d /sw/lib; then
91 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
92 # LDFLAGS="${LDFLAGS} -L/sw/lib"
99 dnl Checks for programs.
106 if test "x$GCC_IS_OK" '=' "x";then
107 echo "***************************************************"
108 echo "* Your gcc is too old to compile this!"
110 echo "* The last version compilable by this compiler is "
111 echo "* swftools 0.7.0, which you can download from "
112 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
114 echo "* Newer versions require at least gcc 3.0.0 "
115 echo "***************************************************"
119 if test "x$CHECKMEM" '!=' "x";then
124 #unset ac_cv_prog_CXX
134 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
136 dnl Checks for system services
143 if test "x$EXEEXT" = "x.exe";then
154 if test "x${MINGW}" != "xyes"; then
156 AC_DEFINE_UNQUOTED(O_BINARY, 0)
166 # The following tries to make use of includes and libraries in
167 # /usr/local, too. Notice: A -I/usr/local/include might break
168 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
169 # especially on systems which link /usr/local to /usr, so it has yet
170 # to be seen how useful this is.
171 if test -d /usr/local/lib; then
172 LDFLAGS="$LDFLAGS -L/usr/local/lib"
174 if test -d /usr/local/include; then
175 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
176 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
179 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
180 # if the user has a special prefix (like /opt), there might also be $prefix/lib
181 # and $prefix/include, which should be included in our search paths for libraries
183 LDFLAGS="$LDFLAGS -L${libdir}"
184 CPPFLAGS="$CPPFLAGS -I${includedir}"
185 # TODO- test whether gcc still works after this
189 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
192 # this must be done after (I believe) AC_PROG_MAKE_SET
193 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
194 STRIP="@echo debug enabled, not stripping "
199 dnl Checks for libraries.
200 AC_CHECK_LIB(m, sin,,
201 echo "Error: Math library not found.";
204 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
206 if test "x$ZLIBMISSING" = "xtrue";then
209 echo "You need zlib to compile swftools"
214 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
215 AC_CHECK_LIB(t1, T1_LoadFont,, T1LIBMISSING=true)
216 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
217 if test "$UNGIFMISSING";then
219 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
223 AC_SUBST(WORDS_BIGENDIAN)
224 RFX_CHECK_SYSTEM_BACKTICKS
225 AC_SUBST(SYSTEM_BACKTICKS)
229 dnl Checks for header files.
230 AC_CONFIG_HEADER(config.h)
233 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)
235 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
236 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
240 AC_SUBST(HAVE_UNISTD_H)
243 dnl Checks for typedefs, structures, and compiler characteristics.
249 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
250 AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
252 AC_CHECK_SIZEOF([signed])
253 AC_CHECK_SIZEOF([unsigned])
254 AC_CHECK_SIZEOF([signed long])
255 AC_CHECK_SIZEOF([unsigned long])
256 AC_CHECK_SIZEOF([signed long long])
257 AC_CHECK_SIZEOF([unsigned long long])
261 #RFX_CHECK_FONTCONFIG
265 if test "x${DISABLE_LAME}" = "xtrue"; then
266 echo "*" Disabling lame support...
268 # old lame code at lib/lame
269 if test -f lib/lame/Makefile.in; then
270 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)"
271 lame_makefile="lib/lame/Makefile"
272 CPPFLAGS="$CPPFLAGS -Ilame"
273 AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
275 if test -d /usr/include/lame; then
276 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
278 if test -d /usr/local/include/lame; then
279 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
282 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
283 AC_CHECK_HEADERS(lame.h)
284 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$ac_cv_header_lame_h" "!=" "x";then
285 AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
289 AC_SUBST(lame_objects)
291 # ------------------------------------------------------------------
294 if test "x${AVIFILE}" = "xtrue"; then
295 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
296 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
297 AC_DEFINE_UNQUOTED(HAVE_AVIFILE, 1)
300 if test "x${WIN32}" != "x"; then
301 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
302 #if test "x${AVIFIL32}" != "x"; then
303 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
305 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
310 AC_SUBST(VIDEO_CFLAGS)
311 # ------------------------------------------------------------------
313 if test "x${UNCOMPRESS}" = "xgzip"; then
314 AC_DEFINE_UNQUOTED(USE_GZIP, 1)
318 # ------------------------------------------------------------------
322 if test "x$PYTHON_OK" '!=' "xyes";then
323 echo all install uninstall clean: > lib/python/Makefile
324 # fail silently- the most users won't have any need for the
325 # python interface anyway
327 pythonrfxswf="lib/python/Makefile"
330 # ------------------------------------------------------------------
332 AC_MSG_CHECKING([for missing libraries])
334 if test "x$ZLIBMISSING" = "xtrue";then
335 MISSINGLIBS="${MISSINGLIBS} zlib"
339 if test "x$JPEGLIBMISSING" = "xtrue";then
340 MISSINGLIBS="${MISSINGLIBS} jpeglib"
345 if test "x$T1LIBMISSING" = "xtrue";then
346 MISSINGLIBS="${MISSINGLIBS} t1lib"
348 if test "x$UNGIFMISSING" = "xtrue";then
350 MISSINGLIBS="${MISSINGLIBS} ungif"
354 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
356 DISABLEJPEG2SWF=true;
357 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
360 if test "x$HAVE_FREETYPE" '!=' "x1"; then
362 MISSINGLIBS="${MISSINGLIBS} freetype"
365 if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
366 MISSINGLIBS="${MISSINGLIBS} t1lib.h"
368 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
370 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
373 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
375 MISSINGLIBS="${MISSINGLIBS} zlib.h"
378 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
379 # MISSINGLIBS="${MISSINGLIBS} avifile"
382 AC_MSG_RESULT(${MISSINGLIBS})
384 # ------------------------------------------------------------------
386 if test "x${MISSINGLIBS}" '!=' "x"; then
387 echo "***************************************************"
388 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
391 avi2swf="avi2swf/Makefile"
392 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
393 #don't whine, avi2swf is outdated anyway
394 #echo "* Disabling avi2swf tool..."
395 echo all install uninstall clean: > avi2swf/Makefile
399 pdf2swf_makefile="lib/pdf/Makefile"
400 PDF2SWF='pdf2swf$(E)'
403 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
404 echo "* Disabling pdf2swf tool..."
405 rm -f lib/pdf/Makefile
406 echo all install uninstall clean: > lib/pdf/Makefile
414 if test "x${ZLIBMISSING}" = "xtrue"; then
416 echo "* Warning! Without zlib, you will not be able to read"
417 echo "* or write compressed Flash MX files!"
420 JPEG2SWF='jpeg2swf$(E)'
421 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
422 echo "* Disabling jpeg2swf tool..."
428 GIF2SWF='gif2swf$(E)'
429 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
430 echo "* Disabling gif2swf tool..."
436 PNG2SWF='png2swf$(E)'
437 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
438 echo "* Disabling png2swf tool..."
444 if test "x${MISSINGLIBS}" '!=' "x"; then
445 if test "x${PARTIAL}" '=' "x"; then
446 echo "* (never mind)"
448 echo "***************************************************"
451 # ------------------------------------------------------------------
453 if test -f "release.in"; then release_in="./release"; fi
454 if test -f "wx/Makefile.in"; then wx_in="wx/Makefile"; fi
455 FILES="$release_in $wx_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile pdf2swf/fonts/Makefile ${pythonrfxswf} ${lame_makefile} lib/art/Makefile lib/swf/Makefile"
459 dnl AC_CONFIG_FILES([${FILES}])
463 # On development trees, create snapshots of config.status
465 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
466 if test "x${MINGW}" = "xyes"; then
467 echo cp config.status config.status.win32
468 cp config.status config.status.win32
470 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
471 echo cp config.status config.status.linux
472 cp config.status config.status.linux
474 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
475 echo cp config.status config.status.debug
476 cp config.status config.status.debug
478 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
479 echo cp config.status config.status.optimize
480 cp config.status config.status.optimize