added support for moments to gfxpoly
[swftools.git] / configure.in
blobc130937d2ef7f6611ac20d054d0b4c217dbc628a
1 dnl Process this file with autoconf to produce a configure script.
3 dnl old autoconf
4 AC_INIT(src/)
6 dnl new autoconf
7 dnl AC_INIT
8 dnl AC_CONFIG_SRCDIR([src/])
10 # ------------------- option parsing -------------------------------
12 DEBUG=
13 CHECKMEM=
14 PROFILING=
15 ENABLE_WARNINGS=
16 OPTIMIZE=
17 USE_POPPLER=
18 DISABLE_LAME=
20 AC_ARG_ENABLE(checkmem,
21 [  --enable-checkmem       turn on ccmalloc debugging], CHECKMEM=true)
22 AC_ARG_ENABLE(debug,
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)
32 AC_ARG_ENABLE(lame,
33 [  --disable-lame          "don't compile any L.A.M.E. mp3 encoding code in"],
35 if test "x$enable_lame" = "xno";then
36     DISABLE_LAME=yes
37 fi,DISABLE_LAME=)
39 PACKAGE=swftools
40 VERSION=2010-08-05-2217
42 # ------------------------------------------------------------------
44 if test "x${srcdir}" != "x."; then
45     echo "--srcdir is not supported"
46     exit 1
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
55     DEBUG=yes
57 if test "x$PROFILING" '!=' "x";then
58     DEBUG=yes
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"
64         LDFLAGS="-g $LDFLAGS"
65     else
66         CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
67         CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
68         LDFLAGS="-g -pg $LDFLAGS"
69     fi
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"
73 else
74     CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
75     CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
79 CFLAGS="-fPIC $CFLAGS"
80 CXXFLAGS="-fPIC $CFLAGS"
82 #OLDGCC=1
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"
88 #fi
90 export PACKAGE VERSION CFLAGS CXXFLAGS
92 dnl Checks for programs.
94 AC_CANONICAL_HOST
96 SLEXT="so"
97 SHARED="-shared"
98 MACOSX=
99 case $host_os in
100     *darwin* ) 
101         MACOSX=yes
102         CFLAGS="$CFLAGS"
103         CXXFLAGS="$CXXFLAGS -fno-rtti"
104         SHARED="-bundle"
105         SLEXT="bundle"
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"
109         fi
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"
114         #fi
115         ;;
116 esac
118 AC_SUBST(SHARED)
120 dnl Checks for programs.
121  AC_PROG_CC
122  AC_PROG_CXX
125 RFX_CHECK_OLDGCC
127 if test "x$GCC_IS_OK" '=' "x";then
128     echo "***************************************************"
129     echo "* Your gcc is too old to compile this!"
130     echo "* "
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 "
134     echo "* ."
135     echo "* Newer versions require at least gcc 3.0.0 "
136     echo "***************************************************"
137     exit 1
139     
140 if test "x$CHECKMEM" '!=' "x";then
141     CC="ccmalloc $CC"
142     CXX="ccmalloc $CXX"
143     #echo running again
144     #unset ac_cv_prog_CC
145     #unset ac_cv_prog_CXX
146     #AC_PROG_CC
147     #AC_PROG_CXX
149  AC_PROG_CPP
151  AC_PROG_RANLIB
152  AC_PROG_MAKE_SET
153  AC_PROG_INSTALL
154  AC_PROG_LN_S
155  AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
157 dnl PKG_PROG_PKG_CONFIG
159 dnl Checks for system services
160 OBJEXT="o"
161 AREXT=".a"
162 CXXLIBS="-lstdc++"
164 AC_EXEEXT
166 if test "x$EXEEXT" = "x.exe";then
167     OBJEXT="obj"
168     AREXT=".lib"
169     CXXLIBS=""
171 AC_SUBST(OBJEXT)
172 AC_SUBST(AREXT)
174 RFX_CHECK_MING
176 if test "x${MINGW}" != "xyes"; then
177     # no mingW
178     AC_DEFINE([O_BINARY], [0], [Not defined on mingw])
179 else
180     # mingW
181     SLEXT="dll"
182     CXXLIBS=""
184 export SLEXT
185 AC_SUBST(SLEXT)
186 AC_SUBST(CXXLIBS)
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"
199     echo > /dev/null
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
204     # and includes.
205     LDFLAGS="$LDFLAGS -L${libdir}"
206     CPPFLAGS="$CPPFLAGS -I${includedir}"
207     # TODO- test whether gcc still works after this
210 #Mac OS:
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
217         STRIP=dsymutil
218     else
219         STRIP="@echo debug enabled, not stripping "
220     fi
221     export STRIP
222     AC_SUBST(STRIP)
225 dnl Checks for libraries.
226  AC_CHECK_LIB(m, sin,, 
227  echo "Error: Math library not found.";
228  exit;
230  AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
232 if test "x$ZLIBMISSING" = "xtrue";then
233     echo 
234     echo "ERROR:"
235     echo "You need zlib to compile swftools"
236     echo
237     exit
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
244     UNGIFMISSING=
245     AC_CHECK_LIB(gif, DGifOpen,, UNGIFMISSING=true)
247 AC_CHECK_LIB(zzip, zzip_file_open,, ZZIPMISSING=true)
249 RFX_CHECK_BYTEORDER
250 AC_SUBST(WORDS_BIGENDIAN)
251 RFX_CHECK_SYSTEM_BACKTICKS
252 AC_SUBST(SYSTEM_BACKTICKS)
254 AC_ARG_PROGRAM
256 dnl Checks for header files.
257  AC_CONFIG_HEADER(config.h)
258  AC_HEADER_DIRENT
259  AC_HEADER_STDC
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])
265 AC_SUBST(PACKAGE)
266 AC_SUBST(VERSION)
268 AC_SUBST(HAVE_UNISTD_H)
269 AC_SUBST(EXEEXT)
271 dnl Checks for typedefs, structures, and compiler characteristics.
272  AC_C_CONST
273  AC_C_INLINE
274  AC_TYPE_OFF_T
275  AC_TYPE_SIZE_T
276  AC_STRUCT_TM
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*])
286 RFX_CHECK_FREETYPE
288 RFX_CHECK_FONTCONFIG
290 RFX_CHECK_FFTW
292 # RFX_CHECK_OPENGL
293 # if test "$HAVE_OPENGL";then
294 #     DEVICE_OPENGL='devices/opengl.$(O)'
295 #     AC_SUBST(DEVICE_OPENGL)
296 # fi
297 AC_SUBST(DEVICE_OPENGL)
299 lame_in_source= 
300 lame_makefile=
301 if test "x${DISABLE_LAME}" = "xtrue"; then
302     echo "*" Disabling lame support...
303 else
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])
310     else
311         if test -d /usr/include/lame; then
312             CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
313         else
314             if test -d /usr/local/include/lame; then
315                 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
316             fi
317         fi
318         AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
319         HASLAMEHEADER=
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])
323         fi
324     fi
326 AC_SUBST(lame_in_source)
328 xpdf_in_source=
329 splash_in_source=
330 xpdf_include=
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
336         AC_LANG_PUSH([C++])
337         AC_CHECK_HEADERS([OutputDev.h],[
338            AC_CHECK_LIB([poppler],[main],,[])
339         ],[AC_MSG_ERROR([No poppler library found. This library is required.])])
340         AC_LANG_POP
341     else
342         CPPFLAGS="$CPPFLAGS $POPPLER_CFLAGS"
343         LIBS="$LIBS $POPPLER_LIBS"
344         AC_DEFINE([HAVE_POPPLER], [1])
345     fi
346 else
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
359 RFX_CHECK_AVI2SWF
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"
370     #fi
371     VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
372     AVIFIL32=true
375 AC_SUBST(VIDEO_LIBS)
376 AC_SUBST(VIDEO_CFLAGS)
377 # ------------------------------------------------------------------
379 if test "x${UNCOMPRESS}" = "xgzip"; then
380     AC_DEFINE([USE_GZIP], [1], [Define if gzip is present])
382 AC_SUBST(USE_GZIP)
384 # ------------------------------------------------------------------
386 RFX_CHECK_RUBY
388 if test "x$RUBY_OK" '!=' "xyes";then
389     if test -d "lib/ruby/";then
390         echo all install uninstall clean: > lib/ruby/Makefile
391     fi
392     # fail silently- the most users won't have any need for the
393     # ruby interface anyway
394 else
395     if test -f "lib/ruby/Makefile.in";then
396         rubygfx="lib/ruby/Makefile"
397     fi
400 # ------------------------------------------------------------------
402 AC_MSG_CHECKING([for missing libraries])
404 if test "x$ZLIBMISSING" = "xtrue";then
405     MISSINGLIBS="${MISSINGLIBS} zlib"
406     DISABLEPNG2SWF=true
407     PARTIAL=true
409 if test "x$JPEGLIBMISSING" = "xtrue";then
410     MISSINGLIBS="${MISSINGLIBS} jpeglib"
411     DISABLEPDF2SWF=true
412     DISABLEJPEG2SWF=true
413     PARTIAL=true
415 if test "x$PDFLIBMISSING" = "xtrue";then
416     DISABLEPDF2PDF=true;
418 #if test "x$T1LIBMISSING" = "xtrue";then
419 #    MISSINGLIBS="${MISSINGLIBS} t1lib"
421 if test "x$UNGIFMISSING" = "xtrue";then
422     DISABLEGIF2SWF=true
423     MISSINGLIBS="${MISSINGLIBS} ungif"
424     PARTIAL=true
427 if test "x${ac_cv_header_pdflib_h}" '!=' "xyes";then
428     DISABLEPDF2PDF=true;
430 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
431     DISABLEPDF2SWF=true;
432     DISABLEJPEG2SWF=true;
433     MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
434     PARTIAL=true
436 if test "x$HAVE_FREETYPE" '!=' "x1"; then
437     DISABLEPDF2SWF=true;
438     MISSINGLIBS="${MISSINGLIBS} freetype"
439     PARTIAL=true
441 #if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
442 #    MISSINGLIBS="${MISSINGLIBS} t1lib.h"
444 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
445     DISABLEGIF2SWF=true
446     MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
447     PARTIAL=true
449 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
450     DISABLEPNG2SWF=true;
451     MISSINGLIBS="${MISSINGLIBS} zlib.h"
452     PARTIAL=true
454 #if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
455 #    MISSINGLIBS="${MISSINGLIBS} avifile"
458 AC_MSG_RESULT(${MISSINGLIBS})
460 # ------------------------------------------------------------------
462 RFX_CHECK_PYTHON
464 if test "x$PYTHON_OK" '!=' "xyes" -o "$DISABLEPDF2SWF";then
465     echo all install uninstall clean: > lib/python/Makefile
466     # fail silently- the most users won't have any need for the
467     # python interface anyway
468 else
469     pythongfx="lib/python/Makefile"
472 # ------------------------------------------------------------------
474 if test "x${MISSINGLIBS}" '!=' "x"; then
475   echo "***************************************************"
476   echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
479 avi2swf="avi2swf/Makefile"
480 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
481  #don't whine, avi2swf is outdated anyway
482  #echo "* Disabling avi2swf tool..."
483  echo all install uninstall clean: > avi2swf/Makefile
484  avi2swf=
487 pdf2swf_makefile="lib/pdf/Makefile"
488 PDF2SWF='pdf2swf$(E)'
489 LIBPDF='libpdf$(A)'
491 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
492   echo "* Disabling pdf2swf tool..."
493   rm -f lib/pdf/Makefile
494   echo all install uninstall clean libpdf libgfxpdf: > lib/pdf/Makefile
495   pdf2swf_makefile=""
496   PDF2SWF=
497   LIBPDF=
499 AC_SUBST(PDF2SWF)
500 AC_SUBST(LIBPDF)
502 PDF2PDF='pdf2pdf$(E)'
503 DEVICE_PDF='devices/pdf.$(O)'
504 if test "x${DISABLEPDF2PDF}" = "xtrue"; then
505   #echo "* Disabling pdf2pdf tool..."
506   PDF2PDF=
507   DEVICE_PDF=
509 AC_SUBST(DEVICE_PDF)
510 AC_SUBST(PDF2PDF)
512 if test "x${ZLIBMISSING}" = "xtrue"; then
513   echo
514   echo "* Warning! Without zlib, you will not be able to read"
515   echo "* or write compressed Flash MX files!"
518 JPEG2SWF='jpeg2swf$(E)'
519 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
520   echo "* Disabling jpeg2swf tool..."
521   JPEG2SWF=
523 export JPEG2SWF
524 AC_SUBST(JPEG2SWF)
526 GIF2SWF='gif2swf$(E)'
527 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
528   echo "* Disabling gif2swf tool..."
529   GIF2SWF=
531 export GIF2SWF
532 AC_SUBST(GIF2SWF)
534 PNG2SWF='png2swf$(E)'
535 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
536   echo "* Disabling png2swf tool..."
537   PNG2SWF=
539 export PNG2SWF
540 AC_SUBST(PNG2SWF)
542 if test "x${MISSINGLIBS}" '!=' "x"; then
543   if test "x${PARTIAL}" '=' "x"; then
544     echo "* (never mind)"
545   fi
546   echo "***************************************************"
549 # ------------------------------------------------------------------
551 AH_TOP([
552 #ifndef __config_h__
553 #define __config_h__
556 AH_BOTTOM([
557 #ifdef HAVE_ZLIB_H
558 #ifdef HAVE_LIBZ
559 #define HAVE_ZLIB
560 #endif
561 #endif
563 #ifdef HAVE_JPEGLIB_H
564 #ifdef HAVE_LIBJPEG
565 #define HAVE_JPEGLIB
566 #endif
567 #endif
569 #ifdef HAVE_FT2BUILD_H
570 #define HAVE_FREETYPE_H 1
571 #endif
573 #ifdef HAVE_GL_GL_H
574 #ifdef HAVE_GL_GLUT_H
575 #ifdef HAVE_OPENGL
576 #define USE_OPENGL
577 #endif
578 #endif
579 #endif
581 #ifdef HAVE_POPPLER
582 #define GString GooString
583 #define GHash GooHash
584 #define GHashIter GooHashIter
585 #endif
587 #ifdef HAVE_ZZIP_LIB_H
588 #ifdef HAVE_LIBZZIP
589 #define HAVE_ZZIP 1
590 #endif
591 #endif
593 // supply a substitute calloc function if necessary
594 #ifndef HAVE_CALLOC
595 #define calloc rfx_calloc_replacement
596 #endif
598 #endif // __config_h__
601 if test -f "release.in"; then release_in="./release"; fi
602 if test -f "Makefile.new.in"; then mk_in="./Makefile.new"; fi
603 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"
604 AC_OUTPUT(${FILES})
606 dnl new autoconf
607 dnl AC_CONFIG_FILES([${FILES}])
608 dnl AC_OUTPUT
611 # On development trees, create snapshots of config.status
613 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
614     if test "x${MINGW}" = "xyes"; then
615         echo cp config.status config.status.win32
616         cp config.status config.status.win32
617     else
618         if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE"  '=' "x";then
619             echo cp config.status config.status.linux
620             cp config.status config.status.linux
621         fi
622         if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE"  '=' "x";then
623             echo cp config.status config.status.debug
624             cp config.status config.status.debug
625         fi
626         if test "x$DEBUG"    = "x" -a "x$OPTIMIZE" '!=' "x"; then
627             echo cp config.status config.status.optimize
628             cp config.status config.status.optimize
629         fi
630     fi