1 dnl Process this file with autoconf to produce a configure script.
8 dnl AC_CONFIG_SRCDIR([src/])
10 # ------------------- option parsing -------------------------------
19 AC_ARG_ENABLE(checkmem,
20 [ --enable-checkmem turn on ccmalloc debugging], CHECKMEM=true)
22 [ --enable-debug turn on debugging], DEBUG=true)
23 AC_ARG_ENABLE(profiling,
24 [ --enable-profiling turn on profiling], PROFILING=true)
25 AC_ARG_ENABLE(warnings,
26 [ --enable-warnings turn on compiler warnings], ENABLE_WARNINGS=true)
27 AC_ARG_ENABLE(optimizations,
28 [ --enable-optimizations turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true)
30 [ --disable-lame don't compile any L.A.M.E. mp3 encoding code in],
32 if test "x$enable_lame" = "xno";then
37 VERSION=2010-02-06-1900
39 # ------------------------------------------------------------------
41 if test "x${srcdir}" != "x."; then
42 echo "--srcdir is not supported"
46 WARNINGS="-Wimplicit -Wreturn-type -Wno-write-strings -Wformat"
47 if test "x$ENABLE_WARNINGS" '!=' "x";then
48 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls -Wno-write-strings -D_FORTIFY_SOURCE=2 "
51 if test "x$CHECKMEM" '!=' "x";then
54 if test "x$PROFILING" '!=' "x";then
57 if test "x$DEBUG" '!=' "x";then
58 if test "x$PROFILING" = "x";then
59 CFLAGS="$WARNINGS -O2 -g $CFLAGS"
60 CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
63 CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
64 CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
65 LDFLAGS="-g -pg $LDFLAGS"
67 else if test "x$OPTIMIZE" '!=' "x"; then
68 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
69 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
71 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
72 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
76 CFLAGS="-fPIC $CFLAGS"
77 CXXFLAGS="-fPIC $CFLAGS"
80 #if test "x$OLDGCC" '!=' "x";then
81 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
82 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
83 # CFLAGS="$CFLAGS -ansi -pendantic"
84 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
87 export PACKAGE VERSION CFLAGS CXXFLAGS
89 dnl Checks for programs.
99 CXXFLAGS="$CXXFLAGS -fno-rtti"
101 if test -d /opt/local/include && test -d /opt/local/lib; then
102 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
103 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
105 # Use fink packages if available.
106 #if test -d /sw/include && test -d /sw/lib; then
107 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
108 # LDFLAGS="${LDFLAGS} -L/sw/lib"
115 dnl Checks for programs.
122 if test "x$GCC_IS_OK" '=' "x";then
123 echo "***************************************************"
124 echo "* Your gcc is too old to compile this!"
126 echo "* The last version compileable by this compiler is "
127 echo "* swftools 0.7.0, which you can download from "
128 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
130 echo "* Newer versions require at least gcc 3.0.0 "
131 echo "***************************************************"
135 if test "x$CHECKMEM" '!=' "x";then
140 #unset ac_cv_prog_CXX
150 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
152 dnl PKG_PROG_PKG_CONFIG
154 dnl Checks for system services
161 if test "x$EXEEXT" = "x.exe";then
172 if test "x${MINGW}" != "xyes"; then
174 AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
184 # The following tries to make use of includes and libraries in
185 # /usr/local, too. Notice: A -I/usr/local/include might break
186 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
187 # especially on systems which link /usr/local to /usr, so it has yet
188 # to be seen how useful this is.
189 if test -d /usr/local/lib; then
190 LDFLAGS="$LDFLAGS -L/usr/local/lib"
192 if test -d /usr/local/include; then
193 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
194 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
197 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
198 # if the user has a special prefix (like /opt), there might also be $prefix/lib
199 # and $prefix/include, which should be included in our search paths for libraries
201 LDFLAGS="$LDFLAGS -L${libdir}"
202 CPPFLAGS="$CPPFLAGS -I${includedir}"
203 # TODO- test whether gcc still works after this
207 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
210 # this must be done after (I believe) AC_PROG_MAKE_SET
211 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
212 if test "$MACOSX";then
215 STRIP="@echo debug enabled, not stripping "
221 dnl Checks for libraries.
222 AC_CHECK_LIB(m, sin,,
223 echo "Error: Math library not found.";
226 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
228 if test "x$ZLIBMISSING" = "xtrue";then
231 echo "You need zlib to compile swftools"
236 AC_CHECK_LIB(pdf, PDF_open_file,, PDFLIBMISSING=true)
237 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
238 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
239 if test "$UNGIFMISSING";then
241 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
243 AC_CHECK_LIB(zzip, zzip_file_open,, ZZIPMISSING=true)
246 AC_SUBST(WORDS_BIGENDIAN)
247 RFX_CHECK_SYSTEM_BACKTICKS
248 AC_SUBST(SYSTEM_BACKTICKS)
252 dnl Checks for header files.
253 AC_CONFIG_HEADER(config.h)
257 AC_CHECK_HEADERS(zlib.h gif_lib.h io.h wchar.h jpeglib.h assert.h signal.h pthread.h sys/stat.h sys/mman.h sys/types.h dirent.h sys/bsdtypes.h sys/ndir.h sys/dir.h ndir.h time.h sys/time.h sys/resource.h pdflib.h zzip/lib.h)
259 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
260 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
264 AC_SUBST(HAVE_UNISTD_H)
267 dnl Checks for typedefs, structures, and compiler characteristics.
273 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
274 AC_CHECK_FUNCS(popen wcschr wcsdup mkstemp stat mmap lrand48 rand srand48 srand bcopy bzero time getrusage mallinfo)
276 AC_CHECK_SIZEOF([signed char])
277 AC_CHECK_SIZEOF([signed short])
278 AC_CHECK_SIZEOF([signed])
279 AC_CHECK_SIZEOF([signed long long])
280 AC_CHECK_SIZEOF([void*])
289 # if test "$HAVE_OPENGL";then
290 # DEVICE_OPENGL='devices/opengl.$(O)'
291 # AC_SUBST(DEVICE_OPENGL)
293 AC_SUBST(DEVICE_OPENGL)
297 if test "x${DISABLE_LAME}" = "xtrue"; then
298 echo "*" Disabling lame support...
300 # old lame code at lib/lame
301 if test -f lib/lame/Makefile.in; then
302 lame_in_source='$(lame_objects)'
303 lame_makefile="lib/lame/Makefile"
304 CPPFLAGS="$CPPFLAGS -Ilame -Ilib/lame"
305 AC_DEFINE([HAVE_LAME], [1], [have/use internal l.a.m.e. mp3 library])
307 if test -d /usr/include/lame; then
308 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
310 if test -d /usr/local/include/lame; then
311 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
314 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
316 AC_CHECK_HEADERS(lame.h,HASLAMEHEADER=1)
317 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$HASLAMEHEADER" '!=' "x";then
318 AC_DEFINE([HAVE_LAME], [1])
322 AC_SUBST(lame_in_source)
324 splash_in_source='$(splash_objects)'
325 xpdf_in_source='$(xpdf_objects)'
327 dnl if test "x$USE_POPPLER" = "xtrue"; then
329 dnl splash_in_source=
330 dnl AC_DEFINE([HAVE_POPPLER],[1],[use poppler])
331 dnl PKG_CHECK_MODULES([POPPLER],[poppler poppler-splash],,[poppler_pkgconfig=no])
332 dnl if test "x$poppler_pkgconfig" = "xno"; then
333 dnl AC_LANG_PUSH([C++])
334 dnl AC_CHECK_HEADERS([OutputDev.h],[
335 dnl AC_CHECK_LIB([poppler],[main],,[])
336 dnl ],[AC_MSG_ERROR([No poppler library found. This library is required.])])
339 dnl CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
340 dnl AC_DEFINE([HAVE_POPPLER], [1])
341 dnl LIBS="$LIBS $POPPLER_LIBS"
345 AC_SUBST([xpdf_in_source])
346 AC_SUBST([splash_in_source])
348 # ------------------------------------------------------------------
350 RFX_CHECK_LOWERCASE_UPPERCASE
352 if test "x${AVIFILE}" = "xtrue"; then
353 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
354 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
355 AC_DEFINE([HAVE_AVIFILE], [1], [Define if avifile is present])
358 if test "x${WIN32}" != "x"; then
359 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
360 #if test "x${AVIFIL32}" != "x"; then
361 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
363 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
368 AC_SUBST(VIDEO_CFLAGS)
369 # ------------------------------------------------------------------
371 if test "x${UNCOMPRESS}" = "xgzip"; then
372 AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
376 # ------------------------------------------------------------------
380 if test "x$PYTHON_OK" '!=' "xyes";then
381 echo all install uninstall clean: > lib/python/Makefile
382 # fail silently- the most users won't have any need for the
383 # python interface anyway
385 pythongfx="lib/python/Makefile"
388 # ------------------------------------------------------------------
392 if test "x$RUBY_OK" '!=' "xyes";then
393 echo all install uninstall clean: > lib/ruby/Makefile
394 # fail silently- the most users won't have any need for the
395 # ruby interface anyway
397 rubygfx="lib/python/Makefile"
400 # ------------------------------------------------------------------
402 AC_MSG_CHECKING([for missing libraries])
404 if test "x$ZLIBMISSING" = "xtrue";then
405 MISSINGLIBS="${MISSINGLIBS} zlib"
409 if test "x$JPEGLIBMISSING" = "xtrue";then
410 MISSINGLIBS="${MISSINGLIBS} jpeglib"
415 if test "x$PDFLIBMISSING" = "xtrue";then
418 #if test "x$T1LIBMISSING" = "xtrue";then
419 # MISSINGLIBS="${MISSINGLIBS} t1lib"
421 if test "x$UNGIFMISSING" = "xtrue";then
423 MISSINGLIBS="${MISSINGLIBS} ungif"
427 if test "x${ac_cv_header_pdflib_h}" '!=' "xyes";then
430 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
432 DISABLEJPEG2SWF=true;
433 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
436 if test "x$HAVE_FREETYPE" '!=' "x1"; then
438 MISSINGLIBS="${MISSINGLIBS} freetype"
441 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
442 # MISSINGLIBS="${MISSINGLIBS} t1lib.h"
444 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
446 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
449 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
451 MISSINGLIBS="${MISSINGLIBS} zlib.h"
454 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
455 # MISSINGLIBS="${MISSINGLIBS} avifile"
458 AC_MSG_RESULT(${MISSINGLIBS})
460 # ------------------------------------------------------------------
462 if test "x${MISSINGLIBS}" '!=' "x"; then
463 echo "***************************************************"
464 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
467 avi2swf="avi2swf/Makefile"
468 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
469 #don't whine, avi2swf is outdated anyway
470 #echo "* Disabling avi2swf tool..."
471 echo all install uninstall clean: > avi2swf/Makefile
475 pdf2swf_makefile="lib/pdf/Makefile"
476 PDF2SWF='pdf2swf$(E)'
479 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
480 echo "* Disabling pdf2swf tool..."
481 rm -f lib/pdf/Makefile
482 echo all install uninstall clean libpdf libgfxpdf: > lib/pdf/Makefile
490 PDF2PDF='pdf2pdf$(E)'
491 DEVICE_PDF='devices/pdf.$(O)'
492 if test "x${DISABLEPDF2PDF}" = "xtrue"; then
493 #echo "* Disabling pdf2pdf tool..."
500 if test "x${ZLIBMISSING}" = "xtrue"; then
502 echo "* Warning! Without zlib, you will not be able to read"
503 echo "* or write compressed Flash MX files!"
506 JPEG2SWF='jpeg2swf$(E)'
507 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
508 echo "* Disabling jpeg2swf tool..."
514 GIF2SWF='gif2swf$(E)'
515 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
516 echo "* Disabling gif2swf tool..."
522 PNG2SWF='png2swf$(E)'
523 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
524 echo "* Disabling png2swf tool..."
530 if test "x${MISSINGLIBS}" '!=' "x"; then
531 if test "x${PARTIAL}" '=' "x"; then
532 echo "* (never mind)"
534 echo "***************************************************"
537 # ------------------------------------------------------------------
551 #ifdef HAVE_JPEGLIB_H
557 #ifdef HAVE_FT2BUILD_H
558 #define HAVE_FREETYPE_H 1
562 #ifdef HAVE_GL_GLUT_H
570 #define GString GooString
571 #define GHash GooHash
574 #ifdef HAVE_ZZIP_LIB_H
581 #endif // __config_h__
584 if test -f "release.in"; then release_in="./release"; fi
585 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
586 FILES="$release_in $mk_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythongfx} ${lame_makefile} lib/readers/Makefile"
590 dnl AC_CONFIG_FILES([${FILES}])
594 # On development trees, create snapshots of config.status
596 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
597 if test "x${MINGW}" = "xyes"; then
598 echo cp config.status config.status.win32
599 cp config.status config.status.win32
601 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
602 echo cp config.status config.status.linux
603 cp config.status config.status.linux
605 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
606 echo cp config.status config.status.debug
607 cp config.status config.status.debug
609 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
610 echo cp config.status config.status.optimize
611 cp config.status config.status.optimize