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-05-20-1815
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.
100 CXXFLAGS="$CXXFLAGS -fno-rtti"
103 if test -d /opt/local/include && test -d /opt/local/lib; then
104 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
105 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
107 # Use fink packages if available.
108 #if test -d /sw/include && test -d /sw/lib; then
109 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
110 # LDFLAGS="${LDFLAGS} -L/sw/lib"
117 dnl Checks for programs.
124 if test "x$GCC_IS_OK" '=' "x";then
125 echo "***************************************************"
126 echo "* Your gcc is too old to compile this!"
128 echo "* The last version compileable by this compiler is "
129 echo "* swftools 0.7.0, which you can download from "
130 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
132 echo "* Newer versions require at least gcc 3.0.0 "
133 echo "***************************************************"
137 if test "x$CHECKMEM" '!=' "x";then
142 #unset ac_cv_prog_CXX
152 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
154 dnl PKG_PROG_PKG_CONFIG
156 dnl Checks for system services
163 if test "x$EXEEXT" = "x.exe";then
173 if test "x${MINGW}" != "xyes"; then
175 AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
185 # The following tries to make use of includes and libraries in
186 # /usr/local, too. Notice: A -I/usr/local/include might break
187 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
188 # especially on systems which link /usr/local to /usr, so it has yet
189 # to be seen how useful this is.
190 if test -d /usr/local/lib; then
191 LDFLAGS="$LDFLAGS -L/usr/local/lib"
193 if test -d /usr/local/include; then
194 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
195 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
198 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
199 # if the user has a special prefix (like /opt), there might also be $prefix/lib
200 # and $prefix/include, which should be included in our search paths for libraries
202 LDFLAGS="$LDFLAGS -L${libdir}"
203 CPPFLAGS="$CPPFLAGS -I${includedir}"
204 # TODO- test whether gcc still works after this
208 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
211 # this must be done after (I believe) AC_PROG_MAKE_SET
212 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
213 if test "$MACOSX";then
216 STRIP="@echo debug enabled, not stripping "
222 dnl Checks for libraries.
223 AC_CHECK_LIB(m, sin,,
224 echo "Error: Math library not found.";
227 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
229 if test "x$ZLIBMISSING" = "xtrue";then
232 echo "You need zlib to compile swftools"
237 AC_CHECK_LIB(pdf, PDF_open_file,, PDFLIBMISSING=true)
238 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
239 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
240 if test "$UNGIFMISSING";then
242 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
244 AC_CHECK_LIB(zzip, zzip_file_open,, ZZIPMISSING=true)
247 AC_SUBST(WORDS_BIGENDIAN)
248 RFX_CHECK_SYSTEM_BACKTICKS
249 AC_SUBST(SYSTEM_BACKTICKS)
253 dnl Checks for header files.
254 AC_CONFIG_HEADER(config.h)
258 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)
260 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
261 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
265 AC_SUBST(HAVE_UNISTD_H)
268 dnl Checks for typedefs, structures, and compiler characteristics.
274 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
275 AC_CHECK_FUNCS(popen wcschr wcsdup mkstemp stat mmap lrand48 rand srand48 srand bcopy bzero time getrusage mallinfo open64 calloc)
277 AC_CHECK_SIZEOF([signed char])
278 AC_CHECK_SIZEOF([signed short])
279 AC_CHECK_SIZEOF([signed])
280 AC_CHECK_SIZEOF([signed long long])
281 AC_CHECK_SIZEOF([void*])
290 # if test "$HAVE_OPENGL";then
291 # DEVICE_OPENGL='devices/opengl.$(O)'
292 # AC_SUBST(DEVICE_OPENGL)
294 AC_SUBST(DEVICE_OPENGL)
298 if test "x${DISABLE_LAME}" = "xtrue"; then
299 echo "*" Disabling lame support...
301 # old lame code at lib/lame
302 if test -f lib/lame/Makefile.in; then
303 lame_in_source='$(lame_objects)'
304 lame_makefile="lib/lame/Makefile"
305 CPPFLAGS="$CPPFLAGS -Ilame -Ilib/lame"
306 AC_DEFINE([HAVE_LAME], [1], [have/use internal l.a.m.e. mp3 library])
308 if test -d /usr/include/lame; then
309 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
311 if test -d /usr/local/include/lame; then
312 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
315 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
317 AC_CHECK_HEADERS(lame.h,HASLAMEHEADER=1)
318 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$HASLAMEHEADER" '!=' "x";then
319 AC_DEFINE([HAVE_LAME], [1])
323 AC_SUBST(lame_in_source)
325 splash_in_source='$(splash_objects)'
326 xpdf_in_source='$(xpdf_objects)'
328 dnl if test "x$USE_POPPLER" = "xtrue"; then
330 dnl splash_in_source=
331 dnl AC_DEFINE([HAVE_POPPLER],[1],[use poppler])
332 dnl PKG_CHECK_MODULES([POPPLER],[poppler poppler-splash],,[poppler_pkgconfig=no])
333 dnl if test "x$poppler_pkgconfig" = "xno"; then
334 dnl AC_LANG_PUSH([C++])
335 dnl AC_CHECK_HEADERS([OutputDev.h],[
336 dnl AC_CHECK_LIB([poppler],[main],,[])
337 dnl ],[AC_MSG_ERROR([No poppler library found. This library is required.])])
340 dnl CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
341 dnl AC_DEFINE([HAVE_POPPLER], [1])
342 dnl LIBS="$LIBS $POPPLER_LIBS"
346 AC_SUBST([xpdf_in_source])
347 AC_SUBST([splash_in_source])
349 # ------------------------------------------------------------------
351 RFX_CHECK_LOWERCASE_UPPERCASE
353 if test "x${AVIFILE}" = "xtrue"; then
354 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
355 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
356 AC_DEFINE([HAVE_AVIFILE], [1], [Define if avifile is present])
359 if test "x${WIN32}" != "x"; then
360 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
361 #if test "x${AVIFIL32}" != "x"; then
362 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
364 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
369 AC_SUBST(VIDEO_CFLAGS)
370 # ------------------------------------------------------------------
372 if test "x${UNCOMPRESS}" = "xgzip"; then
373 AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
377 # ------------------------------------------------------------------
381 if test "x$PYTHON_OK" '!=' "xyes";then
382 echo all install uninstall clean: > lib/python/Makefile
383 # fail silently- the most users won't have any need for the
384 # python interface anyway
386 pythongfx="lib/python/Makefile"
389 # ------------------------------------------------------------------
393 if test "x$RUBY_OK" '!=' "xyes";then
394 echo all install uninstall clean: > lib/ruby/Makefile
395 # fail silently- the most users won't have any need for the
396 # ruby interface anyway
398 if test -f "lib/ruby/Makefile.in";then
399 rubygfx="lib/ruby/Makefile"
403 # ------------------------------------------------------------------
405 AC_MSG_CHECKING([for missing libraries])
407 if test "x$ZLIBMISSING" = "xtrue";then
408 MISSINGLIBS="${MISSINGLIBS} zlib"
412 if test "x$JPEGLIBMISSING" = "xtrue";then
413 MISSINGLIBS="${MISSINGLIBS} jpeglib"
418 if test "x$PDFLIBMISSING" = "xtrue";then
421 #if test "x$T1LIBMISSING" = "xtrue";then
422 # MISSINGLIBS="${MISSINGLIBS} t1lib"
424 if test "x$UNGIFMISSING" = "xtrue";then
426 MISSINGLIBS="${MISSINGLIBS} ungif"
430 if test "x${ac_cv_header_pdflib_h}" '!=' "xyes";then
433 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
435 DISABLEJPEG2SWF=true;
436 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
439 if test "x$HAVE_FREETYPE" '!=' "x1"; then
441 MISSINGLIBS="${MISSINGLIBS} freetype"
444 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
445 # MISSINGLIBS="${MISSINGLIBS} t1lib.h"
447 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
449 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
452 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
454 MISSINGLIBS="${MISSINGLIBS} zlib.h"
457 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
458 # MISSINGLIBS="${MISSINGLIBS} avifile"
461 AC_MSG_RESULT(${MISSINGLIBS})
463 # ------------------------------------------------------------------
465 if test "x${MISSINGLIBS}" '!=' "x"; then
466 echo "***************************************************"
467 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
470 avi2swf="avi2swf/Makefile"
471 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
472 #don't whine, avi2swf is outdated anyway
473 #echo "* Disabling avi2swf tool..."
474 echo all install uninstall clean: > avi2swf/Makefile
478 pdf2swf_makefile="lib/pdf/Makefile"
479 PDF2SWF='pdf2swf$(E)'
482 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
483 echo "* Disabling pdf2swf tool..."
484 rm -f lib/pdf/Makefile
485 echo all install uninstall clean libpdf libgfxpdf: > lib/pdf/Makefile
493 PDF2PDF='pdf2pdf$(E)'
494 DEVICE_PDF='devices/pdf.$(O)'
495 if test "x${DISABLEPDF2PDF}" = "xtrue"; then
496 #echo "* Disabling pdf2pdf tool..."
503 if test "x${ZLIBMISSING}" = "xtrue"; then
505 echo "* Warning! Without zlib, you will not be able to read"
506 echo "* or write compressed Flash MX files!"
509 JPEG2SWF='jpeg2swf$(E)'
510 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
511 echo "* Disabling jpeg2swf tool..."
517 GIF2SWF='gif2swf$(E)'
518 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
519 echo "* Disabling gif2swf tool..."
525 PNG2SWF='png2swf$(E)'
526 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
527 echo "* Disabling png2swf tool..."
533 if test "x${MISSINGLIBS}" '!=' "x"; then
534 if test "x${PARTIAL}" '=' "x"; then
535 echo "* (never mind)"
537 echo "***************************************************"
540 # ------------------------------------------------------------------
554 #ifdef HAVE_JPEGLIB_H
560 #ifdef HAVE_FT2BUILD_H
561 #define HAVE_FREETYPE_H 1
565 #ifdef HAVE_GL_GLUT_H
573 #define GString GooString
574 #define GHash GooHash
577 #ifdef HAVE_ZZIP_LIB_H
583 // supply a substitute calloc function if necessary
585 #define calloc rfx_calloc_replacement
588 #endif // __config_h__
591 if test -f "release.in"; then release_in="./release"; fi
592 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
593 FILES="$release_in $mk_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythongfx} ${rubygfx} ${lame_makefile} lib/readers/Makefile"
597 dnl AC_CONFIG_FILES([${FILES}])
601 # On development trees, create snapshots of config.status
603 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
604 if test "x${MINGW}" = "xyes"; then
605 echo cp config.status config.status.win32
606 cp config.status config.status.win32
608 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
609 echo cp config.status config.status.linux
610 cp config.status config.status.linux
612 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
613 echo cp config.status config.status.debug
614 cp config.status config.status.debug
616 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
617 echo cp config.status config.status.optimize
618 cp config.status config.status.optimize