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], DISABLE_LAME=true)
22 AC_ARG_WITH([poppler],
23 [ --with-poppler use poppler instead of internal xpdf (currently broken)], [USE_POPPLER=true])
29 # ------------------------------------------------------------------
31 if test "x${srcdir}" != "x."; then
32 echo "--srcdir is not supported"
36 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
37 if test "x$ENABLE_WARNINGS" '!=' "x";then
38 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls -D_FORTIFY_SOURCE=2 "
41 if test "x$CHECKMEM" '!=' "x";then
44 if test "x$PROFILING" '!=' "x";then
47 if test "x$DEBUG" '!=' "x";then
48 if test "x$PROFILING" = "x";then
49 CFLAGS="$WARNINGS -O2 -g $CFLAGS"
50 CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
53 CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
54 CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
55 LDFLAGS="-g -pg $LIBS"
57 else if test "x$OPTIMIZE" '!=' "x"; then
58 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
59 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
61 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
62 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
66 CFLAGS="-fPIC $CFLAGS"
67 CXXFLAGS="-fPIC $CFLAGS"
70 #if test "x$OLDGCC" '!=' "x";then
71 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
72 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
73 # CFLAGS="$CFLAGS -ansi -pendantic"
74 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
77 export PACKAGE VERSION CFLAGS CXXFLAGS
79 dnl Checks for programs.
89 CXXFLAGS="$CXXFLAGS -fno-rtti"
91 if test -d /opt/local/include && test -d /opt/local/lib; then
92 CPPFLAGS="${CPPFLAGS} -I/opt/local/include"
93 LDFLAGS="${LDFLAGS} -L/opt/local/lib"
95 # Use fink packages if available.
96 #if test -d /sw/include && test -d /sw/lib; then
97 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
98 # LDFLAGS="${LDFLAGS} -L/sw/lib"
105 dnl Checks for programs.
112 if test "x$GCC_IS_OK" '=' "x";then
113 echo "***************************************************"
114 echo "* Your gcc is too old to compile this!"
116 echo "* The last version compileable by this compiler is "
117 echo "* swftools 0.7.0, which you can download from "
118 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
120 echo "* Newer versions require at least gcc 3.0.0 "
121 echo "***************************************************"
125 if test "x$CHECKMEM" '!=' "x";then
130 #unset ac_cv_prog_CXX
140 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
142 dnl PKG_PROG_PKG_CONFIG
144 dnl Checks for system services
151 if test "x$EXEEXT" = "x.exe";then
162 if test "x${MINGW}" != "xyes"; then
164 AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
174 # The following tries to make use of includes and libraries in
175 # /usr/local, too. Notice: A -I/usr/local/include might break
176 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
177 # especially on systems which link /usr/local to /usr, so it has yet
178 # to be seen how useful this is.
179 if test -d /usr/local/lib; then
180 LDFLAGS="$LDFLAGS -L/usr/local/lib"
182 if test -d /usr/local/include; then
183 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
184 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
187 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
188 # if the user has a special prefix (like /opt), there might also be $prefix/lib
189 # and $prefix/include, which should be included in our search paths for libraries
191 LDFLAGS="$LDFLAGS -L${libdir}"
192 CPPFLAGS="$CPPFLAGS -I${includedir}"
193 # TODO- test whether gcc still works after this
197 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
200 # this must be done after (I believe) AC_PROG_MAKE_SET
201 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
202 STRIP="@echo debug enabled, not stripping "
207 dnl Checks for libraries.
208 AC_CHECK_LIB(m, sin,,
209 echo "Error: Math library not found.";
212 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
214 if test "x$ZLIBMISSING" = "xtrue";then
217 echo "You need zlib to compile swftools"
222 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
223 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
224 if test "$UNGIFMISSING";then
226 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
230 AC_SUBST(WORDS_BIGENDIAN)
231 RFX_CHECK_SYSTEM_BACKTICKS
232 AC_SUBST(SYSTEM_BACKTICKS)
236 dnl Checks for header files.
237 AC_CONFIG_HEADER(config.h)
241 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)
243 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
244 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
248 AC_SUBST(HAVE_UNISTD_H)
251 dnl Checks for typedefs, structures, and compiler characteristics.
257 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
258 AC_CHECK_FUNCS(popen wcschr wcsdup mkstemp stat mmap lrand48 rand srand48 srand bcopy bzero time getrusage mallinfo)
260 AC_CHECK_SIZEOF([signed char])
261 AC_CHECK_SIZEOF([signed short])
262 AC_CHECK_SIZEOF([signed])
263 AC_CHECK_SIZEOF([signed long long])
264 AC_CHECK_SIZEOF([void*])
271 if test "$HAVE_OPENGL";then
272 DEVICE_OPENGL='devices/opengl.$(O)'
273 AC_SUBST(DEVICE_OPENGL)
278 if test "x${DISABLE_LAME}" = "xtrue"; then
279 echo "*" Disabling lame support...
281 # old lame code at lib/lame
282 if test -f lib/lame/Makefile.in; then
283 lame_in_source='$(lame_objects)'
284 lame_makefile="lib/lame/Makefile"
285 CPPFLAGS="$CPPFLAGS -Ilame -Ilib/lame"
286 AC_DEFINE([HAVE_LAME], [1], [have/use internal l.a.m.e. mp3 library])
288 if test -d /usr/include/lame; then
289 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
291 if test -d /usr/local/include/lame; then
292 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
295 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
297 AC_CHECK_HEADERS(lame.h,HASLAMEHEADER=1)
298 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$HASLAMEHEADER" '!=' "x";then
299 AC_DEFINE([HAVE_LAME], [1])
303 AC_SUBST(lame_in_source)
305 AC_DEFINE([INTERNAL_LIBART], [1], [use internal libart library])
306 art_in_source='$(art_objects)'
307 splash_in_source='$(splash_objects)'
308 xpdf_in_source='$(xpdf_objects)'
310 dnl if test "x$USE_POPPLER" = "xtrue"; then
312 dnl splash_in_source=
313 dnl AC_DEFINE([HAVE_POPPLER],[1],[use poppler])
314 dnl PKG_CHECK_MODULES([POPPLER],[poppler poppler-splash],,[poppler_pkgconfig=no])
315 dnl if test "x$poppler_pkgconfig" = "xno"; then
316 dnl AC_LANG_PUSH([C++])
317 dnl AC_CHECK_HEADERS([OutputDev.h],[
318 dnl AC_CHECK_LIB([poppler],[main],,[])
319 dnl ],[AC_MSG_ERROR([No poppler library found. This library is required.])])
322 dnl CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
323 dnl AC_DEFINE([HAVE_POPPLER], [1])
324 dnl LIBS="$LIBS $POPPLER_LIBS"
328 AC_SUBST([art_in_source])
329 AC_SUBST([xpdf_in_source])
330 AC_SUBST([splash_in_source])
332 # ------------------------------------------------------------------
335 if test "x${AVIFILE}" = "xtrue"; then
336 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
337 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
338 AC_DEFINE([HAVE_AVIFILE], [1], [Define if avifile is present])
341 if test "x${WIN32}" != "x"; then
342 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
343 #if test "x${AVIFIL32}" != "x"; then
344 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
346 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
351 AC_SUBST(VIDEO_CFLAGS)
352 # ------------------------------------------------------------------
354 if test "x${UNCOMPRESS}" = "xgzip"; then
355 AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
359 # ------------------------------------------------------------------
363 if test "x$PYTHON_OK" '!=' "xyes";then
364 echo all install uninstall clean: > lib/python/Makefile
365 # fail silently- the most users won't have any need for the
366 # python interface anyway
368 pythonrfxswf="lib/python/Makefile"
371 # ------------------------------------------------------------------
373 AC_MSG_CHECKING([for missing libraries])
375 if test "x$ZLIBMISSING" = "xtrue";then
376 MISSINGLIBS="${MISSINGLIBS} zlib"
380 if test "x$JPEGLIBMISSING" = "xtrue";then
381 MISSINGLIBS="${MISSINGLIBS} jpeglib"
386 #if test "x$T1LIBMISSING" = "xtrue";then
387 # MISSINGLIBS="${MISSINGLIBS} t1lib"
389 if test "x$UNGIFMISSING" = "xtrue";then
391 MISSINGLIBS="${MISSINGLIBS} ungif"
395 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
397 DISABLEJPEG2SWF=true;
398 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
401 if test "x$HAVE_FREETYPE" '!=' "x1"; then
403 MISSINGLIBS="${MISSINGLIBS} freetype"
406 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
407 # MISSINGLIBS="${MISSINGLIBS} t1lib.h"
409 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
411 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
414 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
416 MISSINGLIBS="${MISSINGLIBS} zlib.h"
419 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
420 # MISSINGLIBS="${MISSINGLIBS} avifile"
423 AC_MSG_RESULT(${MISSINGLIBS})
425 # ------------------------------------------------------------------
427 if test "x${MISSINGLIBS}" '!=' "x"; then
428 echo "***************************************************"
429 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
432 avi2swf="avi2swf/Makefile"
433 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
434 #don't whine, avi2swf is outdated anyway
435 #echo "* Disabling avi2swf tool..."
436 echo all install uninstall clean: > avi2swf/Makefile
440 pdf2swf_makefile="lib/pdf/Makefile"
441 PDF2SWF='pdf2swf$(E)'
444 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
445 echo "* Disabling pdf2swf tool..."
446 rm -f lib/pdf/Makefile
447 echo all install uninstall clean libpdf: > lib/pdf/Makefile
455 if test "x${ZLIBMISSING}" = "xtrue"; then
457 echo "* Warning! Without zlib, you will not be able to read"
458 echo "* or write compressed Flash MX files!"
461 JPEG2SWF='jpeg2swf$(E)'
462 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
463 echo "* Disabling jpeg2swf tool..."
469 GIF2SWF='gif2swf$(E)'
470 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
471 echo "* Disabling gif2swf tool..."
477 PNG2SWF='png2swf$(E)'
478 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
479 echo "* Disabling png2swf tool..."
485 if test "x${MISSINGLIBS}" '!=' "x"; then
486 if test "x${PARTIAL}" '=' "x"; then
487 echo "* (never mind)"
489 echo "***************************************************"
492 # ------------------------------------------------------------------
506 #ifdef HAVE_JPEGLIB_H
512 #ifdef HAVE_FT2BUILD_H
513 #define HAVE_FREETYPE_H 1
517 #ifdef HAVE_GL_GLUT_H
525 #define GString GooString
526 #define GHash GooHash
529 #endif // __config_h__
532 if test -f "release.in"; then release_in="./release"; fi
533 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
534 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"
538 dnl AC_CONFIG_FILES([${FILES}])
542 # On development trees, create snapshots of config.status
544 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
545 if test "x${MINGW}" = "xyes"; then
546 echo cp config.status config.status.win32
547 cp config.status config.status.win32
549 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
550 echo cp config.status config.status.linux
551 cp config.status config.status.linux
553 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
554 echo cp config.status config.status.debug
555 cp config.status config.status.debug
557 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
558 echo cp config.status config.status.optimize
559 cp config.status config.status.optimize