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],
22 if test "x$enable_lame" = "xno";then
27 VERSION=2009-08-12-1514
30 # ------------------------------------------------------------------
32 if test "x${srcdir}" != "x."; then
33 echo "--srcdir is not supported"
37 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
38 if test "x$ENABLE_WARNINGS" '!=' "x";then
39 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls -D_FORTIFY_SOURCE=2 "
42 if test "x$CHECKMEM" '!=' "x";then
45 if test "x$PROFILING" '!=' "x";then
48 if test "x$DEBUG" '!=' "x";then
49 if test "x$PROFILING" = "x";then
50 CFLAGS="$WARNINGS -O2 -g $CFLAGS"
51 CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
54 CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
55 CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
56 LDFLAGS="-g -pg $LIBS"
58 else if test "x$OPTIMIZE" '!=' "x"; then
59 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
60 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
62 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
63 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
67 CFLAGS="-fPIC $CFLAGS"
68 CXXFLAGS="-fPIC $CFLAGS"
71 #if test "x$OLDGCC" '!=' "x";then
72 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
73 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
74 # CFLAGS="$CFLAGS -ansi -pendantic"
75 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
78 export PACKAGE VERSION CFLAGS CXXFLAGS
80 dnl Checks for programs.
90 CXXFLAGS="$CXXFLAGS -fno-rtti"
92 if test -d /opt/local/include && test -d /opt/local/lib; then
93 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
94 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
96 # Use fink packages if available.
97 #if test -d /sw/include && test -d /sw/lib; then
98 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
99 # LDFLAGS="${LDFLAGS} -L/sw/lib"
106 dnl Checks for programs.
113 if test "x$GCC_IS_OK" '=' "x";then
114 echo "***************************************************"
115 echo "* Your gcc is too old to compile this!"
117 echo "* The last version compileable by this compiler is "
118 echo "* swftools 0.7.0, which you can download from "
119 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
121 echo "* Newer versions require at least gcc 3.0.0 "
122 echo "***************************************************"
126 if test "x$CHECKMEM" '!=' "x";then
131 #unset ac_cv_prog_CXX
141 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
143 dnl PKG_PROG_PKG_CONFIG
145 dnl Checks for system services
152 if test "x$EXEEXT" = "x.exe";then
163 if test "x${MINGW}" != "xyes"; then
165 AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
175 # The following tries to make use of includes and libraries in
176 # /usr/local, too. Notice: A -I/usr/local/include might break
177 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
178 # especially on systems which link /usr/local to /usr, so it has yet
179 # to be seen how useful this is.
180 if test -d /usr/local/lib; then
181 LDFLAGS="$LDFLAGS -L/usr/local/lib"
183 if test -d /usr/local/include; then
184 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
185 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
188 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
189 # if the user has a special prefix (like /opt), there might also be $prefix/lib
190 # and $prefix/include, which should be included in our search paths for libraries
192 LDFLAGS="$LDFLAGS -L${libdir}"
193 CPPFLAGS="$CPPFLAGS -I${includedir}"
194 # TODO- test whether gcc still works after this
198 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
201 # this must be done after (I believe) AC_PROG_MAKE_SET
202 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
203 if test "$MACOSX";then
206 STRIP="@echo debug enabled, not stripping "
212 dnl Checks for libraries.
213 AC_CHECK_LIB(m, sin,,
214 echo "Error: Math library not found.";
217 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
219 if test "x$ZLIBMISSING" = "xtrue";then
222 echo "You need zlib to compile swftools"
227 AC_CHECK_LIB(pdf, PDF_open_file,, PDFLIBMISSING=true)
228 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
229 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
230 if test "$UNGIFMISSING";then
232 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
236 AC_SUBST(WORDS_BIGENDIAN)
237 RFX_CHECK_SYSTEM_BACKTICKS
238 AC_SUBST(SYSTEM_BACKTICKS)
242 dnl Checks for header files.
243 AC_CONFIG_HEADER(config.h)
247 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)
249 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
250 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
254 AC_SUBST(HAVE_UNISTD_H)
257 dnl Checks for typedefs, structures, and compiler characteristics.
263 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
264 AC_CHECK_FUNCS(popen wcschr wcsdup mkstemp stat mmap lrand48 rand srand48 srand bcopy bzero time getrusage mallinfo)
266 AC_CHECK_SIZEOF([signed char])
267 AC_CHECK_SIZEOF([signed short])
268 AC_CHECK_SIZEOF([signed])
269 AC_CHECK_SIZEOF([signed long long])
270 AC_CHECK_SIZEOF([void*])
277 # if test "$HAVE_OPENGL";then
278 # DEVICE_OPENGL='devices/opengl.$(O)'
279 # AC_SUBST(DEVICE_OPENGL)
281 AC_SUBST(DEVICE_OPENGL)
285 if test "x${DISABLE_LAME}" = "xtrue"; then
286 echo "*" Disabling lame support...
288 # old lame code at lib/lame
289 if test -f lib/lame/Makefile.in; then
290 lame_in_source='$(lame_objects)'
291 lame_makefile="lib/lame/Makefile"
292 CPPFLAGS="$CPPFLAGS -Ilame -Ilib/lame"
293 AC_DEFINE([HAVE_LAME], [1], [have/use internal l.a.m.e. mp3 library])
295 if test -d /usr/include/lame; then
296 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
298 if test -d /usr/local/include/lame; then
299 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
302 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
304 AC_CHECK_HEADERS(lame.h,HASLAMEHEADER=1)
305 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$HASLAMEHEADER" '!=' "x";then
306 AC_DEFINE([HAVE_LAME], [1])
310 AC_SUBST(lame_in_source)
312 splash_in_source='$(splash_objects)'
313 xpdf_in_source='$(xpdf_objects)'
315 dnl if test "x$USE_POPPLER" = "xtrue"; then
317 dnl splash_in_source=
318 dnl AC_DEFINE([HAVE_POPPLER],[1],[use poppler])
319 dnl PKG_CHECK_MODULES([POPPLER],[poppler poppler-splash],,[poppler_pkgconfig=no])
320 dnl if test "x$poppler_pkgconfig" = "xno"; then
321 dnl AC_LANG_PUSH([C++])
322 dnl AC_CHECK_HEADERS([OutputDev.h],[
323 dnl AC_CHECK_LIB([poppler],[main],,[])
324 dnl ],[AC_MSG_ERROR([No poppler library found. This library is required.])])
327 dnl CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
328 dnl AC_DEFINE([HAVE_POPPLER], [1])
329 dnl LIBS="$LIBS $POPPLER_LIBS"
333 AC_SUBST([xpdf_in_source])
334 AC_SUBST([splash_in_source])
336 # ------------------------------------------------------------------
338 RFX_CHECK_LOWERCASE_UPPERCASE
340 if test "x${AVIFILE}" = "xtrue"; then
341 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
342 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
343 AC_DEFINE([HAVE_AVIFILE], [1], [Define if avifile is present])
346 if test "x${WIN32}" != "x"; then
347 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
348 #if test "x${AVIFIL32}" != "x"; then
349 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
351 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
356 AC_SUBST(VIDEO_CFLAGS)
357 # ------------------------------------------------------------------
359 if test "x${UNCOMPRESS}" = "xgzip"; then
360 AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
364 # ------------------------------------------------------------------
368 if test "x$PYTHON_OK" '!=' "xyes";then
369 echo all install uninstall clean: > lib/python/Makefile
370 # fail silently- the most users won't have any need for the
371 # python interface anyway
373 pythonrfxswf="lib/python/Makefile"
376 # ------------------------------------------------------------------
378 AC_MSG_CHECKING([for missing libraries])
380 if test "x$ZLIBMISSING" = "xtrue";then
381 MISSINGLIBS="${MISSINGLIBS} zlib"
385 if test "x$JPEGLIBMISSING" = "xtrue";then
386 MISSINGLIBS="${MISSINGLIBS} jpeglib"
391 if test "x$PDFLIBMISSING" = "xtrue";then
394 #if test "x$T1LIBMISSING" = "xtrue";then
395 # MISSINGLIBS="${MISSINGLIBS} t1lib"
397 if test "x$UNGIFMISSING" = "xtrue";then
399 MISSINGLIBS="${MISSINGLIBS} ungif"
403 if test "x${ac_cv_header_pdflib_h}" '!=' "xyes";then
406 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
408 DISABLEJPEG2SWF=true;
409 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
412 if test "x$HAVE_FREETYPE" '!=' "x1"; then
414 MISSINGLIBS="${MISSINGLIBS} freetype"
417 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
418 # MISSINGLIBS="${MISSINGLIBS} t1lib.h"
420 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
422 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
425 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
427 MISSINGLIBS="${MISSINGLIBS} zlib.h"
430 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
431 # MISSINGLIBS="${MISSINGLIBS} avifile"
434 AC_MSG_RESULT(${MISSINGLIBS})
436 # ------------------------------------------------------------------
438 if test "x${MISSINGLIBS}" '!=' "x"; then
439 echo "***************************************************"
440 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
443 avi2swf="avi2swf/Makefile"
444 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
445 #don't whine, avi2swf is outdated anyway
446 #echo "* Disabling avi2swf tool..."
447 echo all install uninstall clean: > avi2swf/Makefile
451 pdf2swf_makefile="lib/pdf/Makefile"
452 PDF2SWF='pdf2swf$(E)'
455 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
456 echo "* Disabling pdf2swf tool..."
457 rm -f lib/pdf/Makefile
458 echo all install uninstall clean libpdf: > lib/pdf/Makefile
466 PDF2PDF='pdf2pdf$(E)'
467 DEVICE_PDF='devices/pdf.$(O)'
468 if test "x${DISABLEPDF2PDF}" = "xtrue"; then
469 #echo "* Disabling pdf2pdf tool..."
476 if test "x${ZLIBMISSING}" = "xtrue"; then
478 echo "* Warning! Without zlib, you will not be able to read"
479 echo "* or write compressed Flash MX files!"
482 JPEG2SWF='jpeg2swf$(E)'
483 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
484 echo "* Disabling jpeg2swf tool..."
490 GIF2SWF='gif2swf$(E)'
491 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
492 echo "* Disabling gif2swf tool..."
498 PNG2SWF='png2swf$(E)'
499 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
500 echo "* Disabling png2swf tool..."
506 if test "x${MISSINGLIBS}" '!=' "x"; then
507 if test "x${PARTIAL}" '=' "x"; then
508 echo "* (never mind)"
510 echo "***************************************************"
513 # ------------------------------------------------------------------
527 #ifdef HAVE_JPEGLIB_H
533 #ifdef HAVE_FT2BUILD_H
534 #define HAVE_FREETYPE_H 1
538 #ifdef HAVE_GL_GLUT_H
546 #define GString GooString
547 #define GHash GooHash
550 #endif // __config_h__
553 if test -f "release.in"; then release_in="./release"; fi
554 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
555 FILES="$release_in $mk_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythonrfxswf} ${lame_makefile} lib/art/Makefile lib/readers/Makefile"
559 dnl AC_CONFIG_FILES([${FILES}])
563 # On development trees, create snapshots of config.status
565 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
566 if test "x${MINGW}" = "xyes"; then
567 echo cp config.status config.status.win32
568 cp config.status config.status.win32
570 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
571 echo cp config.status config.status.linux
572 cp config.status config.status.linux
574 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
575 echo cp config.status config.status.debug
576 cp config.status config.status.debug
578 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
579 echo cp config.status config.status.optimize
580 cp config.status config.status.optimize