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([external-libart],
23 [ --with-external-libart use external libart library (currently broken)], [EXTERNAL_LIBART=true])
24 AC_ARG_WITH([poppler],
25 [ --with-poppler use poppler instead of internal xpdf (currently broken)], [USE_POPPLER=true])
31 # ------------------------------------------------------------------
33 if test "x${srcdir}" != "x."; then
34 echo "--srcdir is not supported"
38 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
39 if test "x$ENABLE_WARNINGS" '!=' "x";then
40 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls -D_FORTIFY_SOURCE=2 "
43 if test "x$CHECKMEM" '!=' "x";then
46 if test "x$PROFILING" '!=' "x";then
49 if test "x$DEBUG" '!=' "x";then
50 if test "x$PROFILING" = "x";then
51 CFLAGS="$WARNINGS -O2 -g $CFLAGS"
52 CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
55 CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
56 CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
57 LDFLAGS="-g -pg $LIBS"
59 else if test "x$OPTIMIZE" '!=' "x"; then
60 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
61 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
63 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
64 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
68 CFLAGS="-fPIC $CFLAGS"
69 CXXFLAGS="-fPIC $CFLAGS"
72 #if test "x$OLDGCC" '!=' "x";then
73 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
74 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
75 # CFLAGS="$CFLAGS -ansi -pendantic"
76 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
79 export PACKAGE VERSION CFLAGS CXXFLAGS
81 dnl Checks for programs.
91 CXXFLAGS="$CXXFLAGS -fno-rtti"
93 # Use fink packages if available.
94 #if test -d /sw/include && test -d /sw/lib; then
95 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
96 # LDFLAGS="${LDFLAGS} -L/sw/lib"
103 dnl Checks for programs.
110 if test "x$GCC_IS_OK" '=' "x";then
111 echo "***************************************************"
112 echo "* Your gcc is too old to compile this!"
114 echo "* The last version compilable by this compiler is "
115 echo "* swftools 0.7.0, which you can download from "
116 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
118 echo "* Newer versions require at least gcc 3.0.0 "
119 echo "***************************************************"
123 if test "x$CHECKMEM" '!=' "x";then
128 #unset ac_cv_prog_CXX
138 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
142 dnl Checks for system services
149 if test "x$EXEEXT" = "x.exe";then
160 if test "x${MINGW}" != "xyes"; then
162 AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
172 # The following tries to make use of includes and libraries in
173 # /usr/local, too. Notice: A -I/usr/local/include might break
174 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
175 # especially on systems which link /usr/local to /usr, so it has yet
176 # to be seen how useful this is.
177 if test -d /usr/local/lib; then
178 LDFLAGS="$LDFLAGS -L/usr/local/lib"
180 if test -d /usr/local/include; then
181 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
182 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
185 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
186 # if the user has a special prefix (like /opt), there might also be $prefix/lib
187 # and $prefix/include, which should be included in our search paths for libraries
189 LDFLAGS="$LDFLAGS -L${libdir}"
190 CPPFLAGS="$CPPFLAGS -I${includedir}"
191 # TODO- test whether gcc still works after this
195 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
198 # this must be done after (I believe) AC_PROG_MAKE_SET
199 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
200 STRIP="@echo debug enabled, not stripping "
205 dnl Checks for libraries.
206 AC_CHECK_LIB(m, sin,,
207 echo "Error: Math library not found.";
210 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
212 if test "x$ZLIBMISSING" = "xtrue";then
215 echo "You need zlib to compile swftools"
220 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
221 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
222 if test "$UNGIFMISSING";then
224 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
228 AC_SUBST(WORDS_BIGENDIAN)
229 RFX_CHECK_SYSTEM_BACKTICKS
230 AC_SUBST(SYSTEM_BACKTICKS)
234 dnl Checks for header files.
235 AC_CONFIG_HEADER(config.h)
239 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)
241 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
242 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
246 AC_SUBST(HAVE_UNISTD_H)
249 dnl Checks for typedefs, structures, and compiler characteristics.
255 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
256 AC_CHECK_FUNCS(popen wcschr wcsdup mkstemp stat mmap lrand48 rand srand48 srand bcopy bzero time getrusage mallinfo)
258 AC_CHECK_SIZEOF([signed char])
259 AC_CHECK_SIZEOF([signed short])
260 AC_CHECK_SIZEOF([signed])
261 AC_CHECK_SIZEOF([signed long long])
262 AC_CHECK_SIZEOF([void*])
269 if test "$HAVE_OPENGL";then
270 DEVICE_OPENGL='devices/opengl.$(O)'
271 AC_SUBST(DEVICE_OPENGL)
276 if test "x${DISABLE_LAME}" = "xtrue"; then
277 echo "*" Disabling lame support...
279 # old lame code at lib/lame
280 if test -f lib/lame/Makefile.in; then
281 lame_in_source='$(lame_objects)'
282 lame_makefile="lib/lame/Makefile"
283 CPPFLAGS="$CPPFLAGS -Ilame -Ilib/lame"
284 AC_DEFINE([HAVE_LAME], [1], [have/use internal l.a.m.e. mp3 library])
286 if test -d /usr/include/lame; then
287 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
289 if test -d /usr/local/include/lame; then
290 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
293 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
295 AC_CHECK_HEADERS(lame.h,HASLAMEHEADER=1)
296 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$HASLAMEHEADER" '!=' "x";then
297 AC_DEFINE([HAVE_LAME], [1])
301 AC_SUBST(lame_in_source)
303 art_in_source='$(art_objects)'
304 AC_DEFINE([INTERNAL_LIBART], [1], [use internal libart library])
306 if test "x$EXTERNAL_LIBART" = "xtrue"; then
308 PKG_CHECK_MODULES([LIBART],[libart-2.0],,[libart_pkgconfig_libart=no])
309 if test "x$libart_pkgconfig_libart" = "xno"; then
310 AC_CHECK_HEADERS([libart_lgpl/libart.h],[
311 AC_CHECK_LIB([art_lgpl_2],[art_new],,[])
312 ],[AC_MSG_ERROR([No libart library found. This library is required.])])
314 CPPFLAGS="$CPPFLAGS $LIBART_CFLAGS"
315 AC_DEFINE([INTERNAL_LIBART], [0])
316 LIBS="$LIBS $LIBART_LIBS"
319 AC_SUBST([art_in_source])
321 xpdf_in_source='$(xpdf_objects)'
322 splash_in_source='$(splash_objects)'
324 if test "x$USE_POPPLER" = "xtrue"; then
327 AC_DEFINE([HAVE_POPPLER],[1],[use poppler])
328 PKG_CHECK_MODULES([POPPLER],[poppler poppler-splash],,[poppler_pkgconfig=no])
329 if test "x$poppler_pkgconfig" = "xno"; then
331 AC_CHECK_HEADERS([OutputDev.h],[
332 AC_CHECK_LIB([poppler],[main],,[])
333 ],[AC_MSG_ERROR([No poppler library found. This library is required.])])
336 CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
337 AC_DEFINE([HAVE_POPPLER], [1])
338 LIBS="$LIBS $POPPLER_LIBS"
341 AC_SUBST([xpdf_in_source])
342 AC_SUBST([splash_in_source])
344 # ------------------------------------------------------------------
347 if test "x${AVIFILE}" = "xtrue"; then
348 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
349 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
350 AC_DEFINE([HAVE_AVIFILE], [1], [Define if avifile is present])
353 if test "x${WIN32}" != "x"; then
354 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
355 #if test "x${AVIFIL32}" != "x"; then
356 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
358 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
363 AC_SUBST(VIDEO_CFLAGS)
364 # ------------------------------------------------------------------
366 if test "x${UNCOMPRESS}" = "xgzip"; then
367 AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
371 # ------------------------------------------------------------------
375 if test "x$PYTHON_OK" '!=' "xyes";then
376 echo all install uninstall clean: > lib/python/Makefile
377 # fail silently- the most users won't have any need for the
378 # python interface anyway
380 pythonrfxswf="lib/python/Makefile"
383 # ------------------------------------------------------------------
385 AC_MSG_CHECKING([for missing libraries])
387 if test "x$ZLIBMISSING" = "xtrue";then
388 MISSINGLIBS="${MISSINGLIBS} zlib"
392 if test "x$JPEGLIBMISSING" = "xtrue";then
393 MISSINGLIBS="${MISSINGLIBS} jpeglib"
398 #if test "x$T1LIBMISSING" = "xtrue";then
399 # MISSINGLIBS="${MISSINGLIBS} t1lib"
401 if test "x$UNGIFMISSING" = "xtrue";then
403 MISSINGLIBS="${MISSINGLIBS} ungif"
407 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
409 DISABLEJPEG2SWF=true;
410 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
413 if test "x$HAVE_FREETYPE" '!=' "x1"; then
415 MISSINGLIBS="${MISSINGLIBS} freetype"
418 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
419 # MISSINGLIBS="${MISSINGLIBS} t1lib.h"
421 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
423 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
426 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
428 MISSINGLIBS="${MISSINGLIBS} zlib.h"
431 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
432 # MISSINGLIBS="${MISSINGLIBS} avifile"
435 AC_MSG_RESULT(${MISSINGLIBS})
437 # ------------------------------------------------------------------
439 if test "x${MISSINGLIBS}" '!=' "x"; then
440 echo "***************************************************"
441 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
444 avi2swf="avi2swf/Makefile"
445 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
446 #don't whine, avi2swf is outdated anyway
447 #echo "* Disabling avi2swf tool..."
448 echo all install uninstall clean: > avi2swf/Makefile
452 pdf2swf_makefile="lib/pdf/Makefile"
453 PDF2SWF='pdf2swf$(E)'
456 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
457 echo "* Disabling pdf2swf tool..."
458 rm -f lib/pdf/Makefile
459 echo all install uninstall clean libpdf: > lib/pdf/Makefile
467 if test "x${ZLIBMISSING}" = "xtrue"; then
469 echo "* Warning! Without zlib, you will not be able to read"
470 echo "* or write compressed Flash MX files!"
473 JPEG2SWF='jpeg2swf$(E)'
474 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
475 echo "* Disabling jpeg2swf tool..."
481 GIF2SWF='gif2swf$(E)'
482 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
483 echo "* Disabling gif2swf tool..."
489 PNG2SWF='png2swf$(E)'
490 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
491 echo "* Disabling png2swf tool..."
497 if test "x${MISSINGLIBS}" '!=' "x"; then
498 if test "x${PARTIAL}" '=' "x"; then
499 echo "* (never mind)"
501 echo "***************************************************"
504 # ------------------------------------------------------------------
518 #ifdef HAVE_JPEGLIB_H
524 #ifdef HAVE_FT2BUILD_H
525 #define HAVE_FREETYPE_H 1
529 #ifdef HAVE_GL_GLUT_H
537 #define GString GooString
538 #define GHash GooHash
541 #endif // __config_h__
544 if test -f "release.in"; then release_in="./release"; fi
545 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
546 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"
550 dnl AC_CONFIG_FILES([${FILES}])
554 # On development trees, create snapshots of config.status
556 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
557 if test "x${MINGW}" = "xyes"; then
558 echo cp config.status config.status.win32
559 cp config.status config.status.win32
561 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
562 echo cp config.status config.status.linux
563 cp config.status config.status.linux
565 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
566 echo cp config.status config.status.debug
567 cp config.status config.status.debug
569 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
570 echo cp config.status config.status.optimize
571 cp config.status config.status.optimize