1 dnl Process this file with autoconf to produce a configure script.
8 dnl AC_CONFIG_SRCDIR([src/])
10 # ------------------- option parsing -------------------------------
20 AC_ARG_ENABLE(checkmem,
21 [ --enable-checkmem turn on ccmalloc debugging], CHECKMEM=true)
23 [ --enable-debug turn on debugging], DEBUG=true)
24 AC_ARG_ENABLE(profiling,
25 [ --enable-profiling turn on profiling], PROFILING=true)
26 AC_ARG_ENABLE(warnings,
27 [ --enable-warnings turn on compiler warnings], ENABLE_WARNINGS=true)
28 AC_ARG_ENABLE(optimizations,
29 [ --enable-optimizations turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true)
30 AC_ARG_ENABLE(poppler,
31 [ --enable-poppler link againist libpoppler], USE_POPPLER=true)
33 [ --disable-lame "don't compile any L.A.M.E. mp3 encoding code in"],
35 if test "x$enable_lame" = "xno";then
40 VERSION=2010-08-05-2217
42 # ------------------------------------------------------------------
44 if test "x${srcdir}" != "x."; then
45 echo "--srcdir is not supported"
49 WARNINGS="-Wimplicit -Wreturn-type -Wno-write-strings -Wformat"
50 if test "x$ENABLE_WARNINGS" '!=' "x";then
51 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls -Wno-write-strings -D_FORTIFY_SOURCE=2 "
54 if test "x$CHECKMEM" '!=' "x";then
57 if test "x$PROFILING" '!=' "x";then
60 if test "x$DEBUG" '!=' "x";then
61 if test "x$PROFILING" = "x";then
62 CFLAGS="$WARNINGS -O2 -g $CFLAGS"
63 CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
66 CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
67 CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
68 LDFLAGS="-g -pg $LDFLAGS"
70 else if test "x$OPTIMIZE" '!=' "x"; then
71 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
72 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
74 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
75 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
79 CFLAGS="-fPIC $CFLAGS"
80 CXXFLAGS="-fPIC $CFLAGS"
83 #if test "x$OLDGCC" '!=' "x";then
84 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
85 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
86 # CFLAGS="$CFLAGS -ansi -pendantic"
87 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
90 export PACKAGE VERSION CFLAGS CXXFLAGS
92 dnl Checks for programs.
103 CXXFLAGS="$CXXFLAGS -fno-rtti"
106 if test -d /opt/local/include && test -d /opt/local/lib; then
107 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
108 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
110 # Use fink packages if available.
111 #if test -d /sw/include && test -d /sw/lib; then
112 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
113 # LDFLAGS="${LDFLAGS} -L/sw/lib"
120 dnl Checks for programs.
127 if test "x$GCC_IS_OK" '=' "x";then
128 echo "***************************************************"
129 echo "* Your gcc is too old to compile this!"
131 echo "* The last version compileable by this compiler is "
132 echo "* swftools 0.7.0, which you can download from "
133 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
135 echo "* Newer versions require at least gcc 3.0.0 "
136 echo "***************************************************"
140 if test "x$CHECKMEM" '!=' "x";then
145 #unset ac_cv_prog_CXX
155 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
157 dnl PKG_PROG_PKG_CONFIG
159 dnl Checks for system services
166 if test "x$EXEEXT" = "x.exe";then
176 if test "x${MINGW}" != "xyes"; then
178 AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
188 # The following tries to make use of includes and libraries in
189 # /usr/local, too. Notice: A -I/usr/local/include might break
190 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
191 # especially on systems which link /usr/local to /usr, so it has yet
192 # to be seen how useful this is.
193 if test -d /usr/local/lib; then
194 LDFLAGS="$LDFLAGS -L/usr/local/lib"
196 if test -d /usr/local/include; then
197 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
198 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
201 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
202 # if the user has a special prefix (like /opt), there might also be $prefix/lib
203 # and $prefix/include, which should be included in our search paths for libraries
205 LDFLAGS="$LDFLAGS -L${libdir}"
206 CPPFLAGS="$CPPFLAGS -I${includedir}"
207 # TODO- test whether gcc still works after this
211 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
214 # this must be done after (I believe) AC_PROG_MAKE_SET
215 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
216 if test "$MACOSX";then
219 STRIP="@echo debug enabled, not stripping "
225 dnl Checks for libraries.
226 AC_CHECK_LIB(m, sin,,
227 echo "Error: Math library not found.";
230 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
232 if test "x$ZLIBMISSING" = "xtrue";then
235 echo "You need zlib to compile swftools"
240 AC_CHECK_LIB(pdf, PDF_open_file,, PDFLIBMISSING=true)
241 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
242 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
243 if test "$UNGIFMISSING";then
245 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
247 AC_CHECK_LIB(zzip, zzip_file_open,, ZZIPMISSING=true)
250 AC_SUBST(WORDS_BIGENDIAN)
251 RFX_CHECK_SYSTEM_BACKTICKS
252 AC_SUBST(SYSTEM_BACKTICKS)
256 dnl Checks for header files.
257 AC_CONFIG_HEADER(config.h)
261 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)
263 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
264 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
268 AC_SUBST(HAVE_UNISTD_H)
271 dnl Checks for typedefs, structures, and compiler characteristics.
277 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
278 AC_CHECK_FUNCS(popen wcschr wcsdup mkstemp stat mmap lrand48 rand srand48 srand bcopy bzero time getrusage mallinfo open64 calloc)
280 AC_CHECK_SIZEOF([signed char])
281 AC_CHECK_SIZEOF([signed short])
282 AC_CHECK_SIZEOF([signed])
283 AC_CHECK_SIZEOF([signed long long])
284 AC_CHECK_SIZEOF([void*])
293 # if test "$HAVE_OPENGL";then
294 # DEVICE_OPENGL='devices/opengl.$(O)'
295 # AC_SUBST(DEVICE_OPENGL)
297 AC_SUBST(DEVICE_OPENGL)
301 if test "x${DISABLE_LAME}" = "xtrue"; then
302 echo "*" Disabling lame support...
304 # old lame code at lib/lame
305 if test -f lib/lame/Makefile.in; then
306 lame_in_source='$(lame_objects)'
307 lame_makefile="lib/lame/Makefile"
308 CPPFLAGS="$CPPFLAGS -Ilame -Ilib/lame"
309 AC_DEFINE([HAVE_LAME], [1], [have/use internal l.a.m.e. mp3 library])
311 if test -d /usr/include/lame; then
312 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
314 if test -d /usr/local/include/lame; then
315 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
318 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
320 AC_CHECK_HEADERS(lame.h,HASLAMEHEADER=1)
321 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$HASLAMEHEADER" '!=' "x";then
322 AC_DEFINE([HAVE_LAME], [1])
326 AC_SUBST(lame_in_source)
332 if test "x$USE_POPPLER" = "xtrue"; then
333 AC_DEFINE([HAVE_POPPLER],[1],[use poppler])
334 #PKG_CHECK_MODULES([POPPLER],[poppler poppler-splash],,[poppler_pkgconfig=no])
335 if test "x$poppler_pkgconfig" = "xno"; then
337 AC_CHECK_HEADERS([OutputDev.h],[
338 AC_CHECK_LIB([poppler],[main],,[])
339 ],[AC_MSG_ERROR([No poppler library found. This library is required.])])
342 CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
343 LIBS="$LIBS $POPPLER_LIBS"
344 AC_DEFINE([HAVE_POPPLER], [1])
347 splash_in_source='$(splash_objects)'
348 xpdf_in_source='$(xpdf_objects)'
349 xpdf_include=' -I xpdf '
352 AC_SUBST([xpdf_in_source])
353 AC_SUBST([splash_in_source])
354 AC_SUBST([xpdf_include])
356 # ------------------------------------------------------------------
358 RFX_CHECK_LOWERCASE_UPPERCASE
360 if test "x${AVIFILE}" = "xtrue"; then
361 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
362 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
363 AC_DEFINE([HAVE_AVIFILE], [1], [Define if avifile is present])
366 if test "x${WIN32}" != "x"; then
367 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
368 #if test "x${AVIFIL32}" != "x"; then
369 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
371 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
376 AC_SUBST(VIDEO_CFLAGS)
377 # ------------------------------------------------------------------
379 if test "x${UNCOMPRESS}" = "xgzip"; then
380 AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
384 # ------------------------------------------------------------------
388 if test "x$RUBY_OK" '!=' "xyes";then
389 if test -d "lib/ruby/";then
390 echo all install uninstall clean: > lib/ruby/Makefile
392 # fail silently- the most users won't have any need for the
393 # ruby interface anyway
395 if test -f "lib/ruby/Makefile.in";then
396 rubygfx="lib/ruby/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 # ------------------------------------------------------------------
464 if test "x$PYTHON_OK" '!=' "xyes" -o "$DISABLEPDF2SWF";then
465 echo all install uninstall clean: > lib/python/Makefile
466 # fail silently- the most users won't have any need for the
467 # python interface anyway
469 pythongfx="lib/python/Makefile"
472 # ------------------------------------------------------------------
474 if test "x${MISSINGLIBS}" '!=' "x"; then
475 echo "***************************************************"
476 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
479 avi2swf="avi2swf/Makefile"
480 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
481 #don't whine, avi2swf is outdated anyway
482 #echo "* Disabling avi2swf tool..."
483 echo all install uninstall clean: > avi2swf/Makefile
487 pdf2swf_makefile="lib/pdf/Makefile"
488 PDF2SWF='pdf2swf$(E)'
491 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
492 echo "* Disabling pdf2swf tool..."
493 rm -f lib/pdf/Makefile
494 echo all install uninstall clean libpdf libgfxpdf: > lib/pdf/Makefile
502 PDF2PDF='pdf2pdf$(E)'
503 DEVICE_PDF='devices/pdf.$(O)'
504 if test "x${DISABLEPDF2PDF}" = "xtrue"; then
505 #echo "* Disabling pdf2pdf tool..."
512 if test "x${ZLIBMISSING}" = "xtrue"; then
514 echo "* Warning! Without zlib, you will not be able to read"
515 echo "* or write compressed Flash MX files!"
518 JPEG2SWF='jpeg2swf$(E)'
519 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
520 echo "* Disabling jpeg2swf tool..."
526 GIF2SWF='gif2swf$(E)'
527 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
528 echo "* Disabling gif2swf tool..."
534 PNG2SWF='png2swf$(E)'
535 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
536 echo "* Disabling png2swf tool..."
542 if test "x${MISSINGLIBS}" '!=' "x"; then
543 if test "x${PARTIAL}" '=' "x"; then
544 echo "* (never mind)"
546 echo "***************************************************"
549 # ------------------------------------------------------------------
563 #ifdef HAVE_JPEGLIB_H
569 #ifdef HAVE_FT2BUILD_H
570 #define HAVE_FREETYPE_H 1
574 #ifdef HAVE_GL_GLUT_H
582 #define GString GooString
583 #define GHash GooHash
584 #define GHashIter GooHashIter
587 #ifdef HAVE_ZZIP_LIB_H
593 // supply a substitute calloc function if necessary
595 #define calloc rfx_calloc_replacement
598 #endif // __config_h__
601 if test -f "release.in"; then release_in="./release"; fi
602 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
603 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"
607 dnl AC_CONFIG_FILES([${FILES}])
611 # On development trees, create snapshots of config.status
613 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
614 if test "x${MINGW}" = "xyes"; then
615 echo cp config.status config.status.win32
616 cp config.status config.status.win32
618 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
619 echo cp config.status config.status.linux
620 cp config.status config.status.linux
622 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
623 echo cp config.status config.status.debug
624 cp config.status config.status.debug
626 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
627 echo cp config.status config.status.optimize
628 cp config.status config.status.optimize