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 (at your own risk)], [EXTERNAL_LIBART=true])
26 VERSION=2008-06-23-2005
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 # Use fink packages if available.
92 #if test -d /sw/include && test -d /sw/lib; then
93 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
94 # LDFLAGS="${LDFLAGS} -L/sw/lib"
101 dnl Checks for programs.
108 if test "x$GCC_IS_OK" '=' "x";then
109 echo "***************************************************"
110 echo "* Your gcc is too old to compile this!"
112 echo "* The last version compilable by this compiler is "
113 echo "* swftools 0.7.0, which you can download from "
114 echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
116 echo "* Newer versions require at least gcc 3.0.0 "
117 echo "***************************************************"
121 if test "x$CHECKMEM" '!=' "x";then
126 #unset ac_cv_prog_CXX
136 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
138 dnl Checks for system services
145 if test "x$EXEEXT" = "x.exe";then
156 if test "x${MINGW}" != "xyes"; then
158 AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
168 # The following tries to make use of includes and libraries in
169 # /usr/local, too. Notice: A -I/usr/local/include might break
170 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
171 # especially on systems which link /usr/local to /usr, so it has yet
172 # to be seen how useful this is.
173 if test -d /usr/local/lib; then
174 LDFLAGS="$LDFLAGS -L/usr/local/lib"
176 if test -d /usr/local/include; then
177 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
178 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
181 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
182 # if the user has a special prefix (like /opt), there might also be $prefix/lib
183 # and $prefix/include, which should be included in our search paths for libraries
185 LDFLAGS="$LDFLAGS -L${libdir}"
186 CPPFLAGS="$CPPFLAGS -I${includedir}"
187 # TODO- test whether gcc still works after this
191 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
194 # this must be done after (I believe) AC_PROG_MAKE_SET
195 if test "x$DEBUG" '!=' "x" -o "x$STRIP" = "x";then
196 STRIP="@echo debug enabled, not stripping "
201 dnl Checks for libraries.
202 AC_CHECK_LIB(m, sin,,
203 echo "Error: Math library not found.";
206 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
208 if test "x$ZLIBMISSING" = "xtrue";then
211 echo "You need zlib to compile swftools"
216 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
217 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
218 if test "$UNGIFMISSING";then
220 AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
224 AC_SUBST(WORDS_BIGENDIAN)
225 RFX_CHECK_SYSTEM_BACKTICKS
226 AC_SUBST(SYSTEM_BACKTICKS)
230 dnl Checks for header files.
231 AC_CONFIG_HEADER(config.h)
235 AC_CHECK_HEADERS(zlib.h gif_lib.h io.h wchar.h jpeglib.h assert.h signal.h pthread.h sys/stat.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)
237 AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
238 AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])
242 AC_SUBST(HAVE_UNISTD_H)
245 dnl Checks for typedefs, structures, and compiler characteristics.
251 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
252 AC_CHECK_FUNCS(popen wcschr wcsdup mkstemp stat lrand48 rand srand48 srand bcopy bzero time getrusage mallinfo)
254 AC_CHECK_SIZEOF([signed])
255 AC_CHECK_SIZEOF([unsigned])
256 AC_CHECK_SIZEOF([signed long])
257 AC_CHECK_SIZEOF([unsigned long])
258 AC_CHECK_SIZEOF([signed long long])
259 AC_CHECK_SIZEOF([unsigned long long])
266 if test "$HAVE_OPENGL";then
267 DEVICE_OPENGL='devices/opengl.$(O)'
268 AC_SUBST(DEVICE_OPENGL)
273 if test "x${DISABLE_LAME}" = "xtrue"; then
274 echo "*" Disabling lame support...
276 # old lame code at lib/lame
277 if test -f lib/lame/Makefile.in; then
278 lame_in_source='$(lame_objects)'
279 lame_makefile="lib/lame/Makefile"
280 CPPFLAGS="$CPPFLAGS -Ilame"
281 AC_DEFINE([HAVE_LAME], [1], [have/use internal l.a.m.e. mp3 library])
283 if test -d /usr/include/lame; then
284 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
286 if test -d /usr/local/include/lame; then
287 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
290 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
291 AC_CHECK_HEADERS(lame.h)
292 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$ac_cv_header_lame_h" "!=" "x";then
293 AC_DEFINE([HAVE_LAME], [1])
297 AC_SUBST(lame_in_source)
299 art_in_source='$(art_objects)'
300 AC_DEFINE([INTERNAL_LIBART], [1], [use internal libart library])
302 if test "x$EXTERNAL_LIBART" = "xtrue"; then
304 PKG_CHECK_MODULES([LIBART],[libart-2.0],,[libart_pkgconfig_libart=no])
305 if test "x$libart_pkgconfig_libart" = "xno"; then
306 AC_CHECK_HEADERS([libart_lgpl/libart.h],[
307 AC_CHECK_LIB([art_lgpl_2],[art_new],,[])
308 ],[AC_MSG_ERROR([No libart library found. This library is required.])])
310 CPPFLAGS="$CPPFLAGS $LIBART_CFLAGS"
311 AC_DEFINE([INTERNAL_LIBART], [0])
312 LIBS="$LIBS $LIBART_LIBS"
315 AC_SUBST([art_in_source])
317 # ------------------------------------------------------------------
320 if test "x${AVIFILE}" = "xtrue"; then
321 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
322 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
323 AC_DEFINE([HAVE_AVIFILE], [1], [Define if avifile is present])
326 if test "x${WIN32}" != "x"; then
327 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
328 #if test "x${AVIFIL32}" != "x"; then
329 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
331 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
336 AC_SUBST(VIDEO_CFLAGS)
337 # ------------------------------------------------------------------
339 if test "x${UNCOMPRESS}" = "xgzip"; then
340 AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
344 # ------------------------------------------------------------------
348 if test "x$PYTHON_OK" '!=' "xyes";then
349 echo all install uninstall clean: > lib/python/Makefile
350 # fail silently- the most users won't have any need for the
351 # python interface anyway
353 pythonrfxswf="lib/python/Makefile"
356 # ------------------------------------------------------------------
358 AC_MSG_CHECKING([for missing libraries])
360 if test "x$ZLIBMISSING" = "xtrue";then
361 MISSINGLIBS="${MISSINGLIBS} zlib"
365 if test "x$JPEGLIBMISSING" = "xtrue";then
366 MISSINGLIBS="${MISSINGLIBS} jpeglib"
371 #if test "x$T1LIBMISSING" = "xtrue";then
372 # MISSINGLIBS="${MISSINGLIBS} t1lib"
374 if test "x$UNGIFMISSING" = "xtrue";then
376 MISSINGLIBS="${MISSINGLIBS} ungif"
380 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
382 DISABLEJPEG2SWF=true;
383 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
386 if test "x$HAVE_FREETYPE" '!=' "x1"; then
388 MISSINGLIBS="${MISSINGLIBS} freetype"
391 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
392 # MISSINGLIBS="${MISSINGLIBS} t1lib.h"
394 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
396 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
399 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
401 MISSINGLIBS="${MISSINGLIBS} zlib.h"
404 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
405 # MISSINGLIBS="${MISSINGLIBS} avifile"
408 AC_MSG_RESULT(${MISSINGLIBS})
410 # ------------------------------------------------------------------
412 if test "x${MISSINGLIBS}" '!=' "x"; then
413 echo "***************************************************"
414 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
417 avi2swf="avi2swf/Makefile"
418 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
419 #don't whine, avi2swf is outdated anyway
420 #echo "* Disabling avi2swf tool..."
421 echo all install uninstall clean: > avi2swf/Makefile
425 pdf2swf_makefile="lib/pdf/Makefile"
426 PDF2SWF='pdf2swf$(E)'
429 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
430 echo "* Disabling pdf2swf tool..."
431 rm -f lib/pdf/Makefile
432 echo all install uninstall clean: > lib/pdf/Makefile
440 if test "x${ZLIBMISSING}" = "xtrue"; then
442 echo "* Warning! Without zlib, you will not be able to read"
443 echo "* or write compressed Flash MX files!"
446 JPEG2SWF='jpeg2swf$(E)'
447 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
448 echo "* Disabling jpeg2swf tool..."
454 GIF2SWF='gif2swf$(E)'
455 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
456 echo "* Disabling gif2swf tool..."
462 PNG2SWF='png2swf$(E)'
463 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
464 echo "* Disabling png2swf tool..."
470 if test "x${MISSINGLIBS}" '!=' "x"; then
471 if test "x${PARTIAL}" '=' "x"; then
472 echo "* (never mind)"
474 echo "***************************************************"
477 # ------------------------------------------------------------------
491 #ifdef HAVE_JPEGLIB_H
497 #ifdef HAVE_FT2BUILD_H
498 #define HAVE_FREETYPE_H 1
502 #ifdef HAVE_GL_GLUT_H
509 #endif // __config_h__
514 if test -f "release.in"; then release_in="./release"; fi
515 FILES="$release_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile pdf2swf/fonts/Makefile ${pythonrfxswf} ${lame_makefile} lib/art/Makefile lib/readers/Makefile"
519 dnl AC_CONFIG_FILES([${FILES}])
523 # On development trees, create snapshots of config.status
525 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
526 if test "x${MINGW}" = "xyes"; then
527 echo cp config.status config.status.win32
528 cp config.status config.status.win32
530 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
531 echo cp config.status config.status.linux
532 cp config.status config.status.linux
534 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
535 echo cp config.status config.status.debug
536 cp config.status config.status.debug
538 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
539 echo cp config.status config.status.optimize
540 cp config.status config.status.optimize