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
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$PYTHON_OK" '!=' "xyes";then
389 echo all install uninstall clean: > lib/python/Makefile
390 # fail silently- the most users won't have any need for the
391 # python interface anyway
393 pythongfx="lib/python/Makefile"
394 rm -f lib/python/gfx.c
397 ln -s gfx2.c lib/python/gfx.c
400 ln -s gfx3.c lib/python/gfx.c
405 # ------------------------------------------------------------------
409 if test "x$RUBY_OK" '!=' "xyes";then
410 if test -d "lib/ruby/";then
411 echo all install uninstall clean: > lib/ruby/Makefile
413 # fail silently- the most users won't have any need for the
414 # ruby interface anyway
416 if test -f "lib/ruby/Makefile.in";then
417 rubygfx="lib/ruby/Makefile"
421 # ------------------------------------------------------------------
423 AC_MSG_CHECKING([for missing libraries])
425 if test "x$ZLIBMISSING" = "xtrue";then
426 MISSINGLIBS="${MISSINGLIBS} zlib"
430 if test "x$JPEGLIBMISSING" = "xtrue";then
431 MISSINGLIBS="${MISSINGLIBS} jpeglib"
436 if test "x$PDFLIBMISSING" = "xtrue";then
439 #if test "x$T1LIBMISSING" = "xtrue";then
440 # MISSINGLIBS="${MISSINGLIBS} t1lib"
442 if test "x$UNGIFMISSING" = "xtrue";then
444 MISSINGLIBS="${MISSINGLIBS} ungif"
448 if test "x${ac_cv_header_pdflib_h}" '!=' "xyes";then
451 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
453 DISABLEJPEG2SWF=true;
454 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
457 if test "x$HAVE_FREETYPE" '!=' "x1"; then
459 MISSINGLIBS="${MISSINGLIBS} freetype"
462 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
463 # MISSINGLIBS="${MISSINGLIBS} t1lib.h"
465 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
467 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
470 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
472 MISSINGLIBS="${MISSINGLIBS} zlib.h"
475 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
476 # MISSINGLIBS="${MISSINGLIBS} avifile"
479 AC_MSG_RESULT(${MISSINGLIBS})
481 # ------------------------------------------------------------------
483 if test "x${MISSINGLIBS}" '!=' "x"; then
484 echo "***************************************************"
485 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
488 avi2swf="avi2swf/Makefile"
489 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
490 #don't whine, avi2swf is outdated anyway
491 #echo "* Disabling avi2swf tool..."
492 echo all install uninstall clean: > avi2swf/Makefile
496 pdf2swf_makefile="lib/pdf/Makefile"
497 PDF2SWF='pdf2swf$(E)'
500 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
501 echo "* Disabling pdf2swf tool..."
502 rm -f lib/pdf/Makefile
503 echo all install uninstall clean libpdf libgfxpdf: > lib/pdf/Makefile
511 PDF2PDF='pdf2pdf$(E)'
512 DEVICE_PDF='devices/pdf.$(O)'
513 if test "x${DISABLEPDF2PDF}" = "xtrue"; then
514 #echo "* Disabling pdf2pdf tool..."
521 if test "x${ZLIBMISSING}" = "xtrue"; then
523 echo "* Warning! Without zlib, you will not be able to read"
524 echo "* or write compressed Flash MX files!"
527 JPEG2SWF='jpeg2swf$(E)'
528 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
529 echo "* Disabling jpeg2swf tool..."
535 GIF2SWF='gif2swf$(E)'
536 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
537 echo "* Disabling gif2swf tool..."
543 PNG2SWF='png2swf$(E)'
544 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
545 echo "* Disabling png2swf tool..."
551 if test "x${MISSINGLIBS}" '!=' "x"; then
552 if test "x${PARTIAL}" '=' "x"; then
553 echo "* (never mind)"
555 echo "***************************************************"
558 # ------------------------------------------------------------------
572 #ifdef HAVE_JPEGLIB_H
578 #ifdef HAVE_FT2BUILD_H
579 #define HAVE_FREETYPE_H 1
583 #ifdef HAVE_GL_GLUT_H
591 #define GString GooString
592 #define GHash GooHash
593 #define GHashIter GooHashIter
596 #ifdef HAVE_ZZIP_LIB_H
602 // supply a substitute calloc function if necessary
604 #define calloc rfx_calloc_replacement
607 #endif // __config_h__
610 if test -f "release.in"; then release_in="./release"; fi
611 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
612 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"
616 dnl AC_CONFIG_FILES([${FILES}])
620 # On development trees, create snapshots of config.status
622 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
623 if test "x${MINGW}" = "xyes"; then
624 echo cp config.status config.status.win32
625 cp config.status config.status.win32
627 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
628 echo cp config.status config.status.linux
629 cp config.status config.status.linux
631 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
632 echo cp config.status config.status.debug
633 cp config.status config.status.debug
635 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
636 echo cp config.status config.status.optimize
637 cp config.status config.status.optimize