1 dnl Process this file with autoconf to produce a configure script.
3 dnl AC_INIT(src/) # old autoconf
5 AC_CONFIG_SRCDIR([src/])
7 AC_ARG_ENABLE(checkmem,
8 [ --enable-checkmem turn on ccmalloc debugging], CHECKMEM=true)
10 [ --enable-debug turn on debugging], DEBUG=true)
11 AC_ARG_ENABLE(profiling,
12 [ --enable-profiling turn on profiling], PROFILING=true)
13 AC_ARG_ENABLE(warnings,
14 [ --enable-warnings turn on compiler warnings], ENABLE_WARNINGS=true)
15 AC_ARG_ENABLE(optimizations,
16 [ --enable-optimizations turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true)
18 [ --disable-lame don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
24 # ------------------------------------------------------------------
26 if test "x${srcdir}" != "x."; then
27 echo "--srcdir is not supported"
31 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
32 if test "x$ENABLE_WARNINGS" '!=' "x";then
33 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls"
36 if test "x$CHECKMEM" '!=' "x";then
39 if test "x$PROFILING" '!=' "x";then
42 if test "x$DEBUG" '!=' "x";then
43 if test "x$PROFILING" = "x";then
44 CFLAGS="$WARNINGS -O2 -g $CFLAGS"
45 CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
47 CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
48 CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
49 LDFLAGS="-g -pg $LIBS"
51 else if test "x$OPTIMIZE" '!=' "x"; then
52 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
53 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
55 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
56 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
60 #if test "x$OLDGCC" '!=' "x";then
61 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
62 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
63 # CFLAGS="$CFLAGS -ansi -pendantic"
64 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
67 export PACKAGE VERSION CFLAGS CXXFLAGS
69 dnl Checks for programs.
79 CXXFLAGS="$CXXFLAGS -fno-rtti"
81 # Use fink packages if available.
82 #if test -d /sw/include && test -d /sw/lib; then
83 # CPPFLAGS="${CPPFLAGS} -I/sw/include"
84 # LDFLAGS="${LDFLAGS} -L/sw/lib"
91 dnl Checks for programs.
95 if test "x$CHECKMEM" '!=' "x";then
100 #unset ac_cv_prog_CXX
111 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
113 dnl Checks for system services
119 if test "x$EXEEXT" = "x.exe";then
129 if test "x${MINGW}" != "xyes"; then
131 AC_DEFINE_UNQUOTED(O_BINARY, 0)
139 # The following tries to make use of includes and libraries in
140 # /usr/local, too. Notice: A -I/usr/local/include might break
141 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
142 # especially on systems which link /usr/local to /usr, so it has yet
143 # to be seen how useful this is.
144 if test -d /usr/local/lib; then
145 LDFLAGS="$LDFLAGS -L/usr/local/lib"
147 if test -d /usr/local/include; then
148 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
149 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
152 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
153 # if the user has a special prefix (like /opt), there might also be $prefix/lib
154 # and $prefix/include, which should be included in our search paths for libraries
156 LDFLAGS="$LDFLAGS -L${libdir}"
157 CPPFLAGS="$CPPFLAGS -I${includedir}"
158 # TODO- test whether gcc still works after this
162 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
165 # this must be done after (I believe) AC_PROG_MAKE_SET
166 if test "x$DEBUG" '!=' "x";then
167 STRIP="@echo debug enabled, not stripping "
172 dnl Checks for libraries.
173 AC_CHECK_LIB(m, sin,,
174 echo "Error: Math library not found.";
177 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
178 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
179 AC_CHECK_LIB(t1, T1_LoadFont,, T1LIBMISSING=true)
180 AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
183 AC_SUBST(WORDS_BIGENDIAN)
184 RFX_CHECK_SYSTEM_BACKTICKS
185 AC_SUBST(SYSTEM_BACKTICKS)
189 dnl Checks for header files.
190 AC_CONFIG_HEADER(config.h)
193 AC_CHECK_HEADERS(zlib.h gif_lib.h jpeglib.h t1lib.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)
195 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
196 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
200 AC_SUBST(HAVE_UNISTD_H)
203 dnl Checks for typedefs, structures, and compiler characteristics.
209 AC_CHECK_TYPE(boolean,int) #needed for jpeglib
210 dnl AC_CHECK_TYPE(bool,char)
211 dnl AC_CHECK_TYPE(uchar,unsigned char)
212 dnl AC_CHECK_TYPE(schar,signed char)
213 dnl AC_CHECK_TYPE(word,unsigned short int)
214 dnl AC_CHECK_TYPE(sword,unsigned short int)
215 dnl AC_CHECK_TYPE(uint,unsigned long int)
217 dnl Checks for library functions.
218 AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
220 # ------------------------------------------------------------------
226 # ------------------------------------------------------------------
230 if test "x${DISABLE_LAME}" = "xtrue"; then
231 echo "*" Disabling lame support...
233 # old lame code at lib/lame
234 if test -f lib/lame/Makefile.in; then
235 lame_objects="lame/psymodel.\$(O) lame/fft.\$(O) lame/newmdct.\$(O) lame/quantize.\$(O) lame/takehiro.\$(O) lame/reservoir.\$(O) lame/quantize_pvt.\$(O) lame/vbrquantize.\$(O) lame/encoder.\$(O) lame/id3tag.\$(O) lame/version.\$(O) lame/tables.\$(O) lame/util.\$(O) lame/bitstream.\$(O) lame/set_get.\$(O) lame/VbrTag.\$(O) lame/lame.\$(O)"
236 lame_makefile="lib/lame/Makefile"
237 CPPFLAGS="$CPPFLAGS -Ilame"
238 AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
240 if test -d /usr/include/lame; then
241 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
243 if test -d /usr/local/include/lame; then
244 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
247 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
248 AC_CHECK_HEADERS(lame.h)
249 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$ac_cv_header_lame_h" "!=" "x";then
250 AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
254 AC_SUBST(lame_objects)
256 # ------------------------------------------------------------------
259 if test "x${AVIFILE}" = "xtrue"; then
260 VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
261 VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
262 AC_DEFINE_UNQUOTED(HAVE_AVIFILE, 1)
265 if test "x${WIN32}" != "x"; then
266 #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
267 #if test "x${AVIFIL32}" != "x"; then
268 # VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
270 VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
275 AC_SUBST(VIDEO_CFLAGS)
276 # ------------------------------------------------------------------
278 if test "x${UNCOMPRESS}" = "xgzip"; then
279 AC_DEFINE_UNQUOTED(USE_GZIP, 1)
283 # ------------------------------------------------------------------
287 if test "x$PYTHON_OK" '!=' "xyes";then
288 echo all install uninstall clean: > lib/python/Makefile
289 # fail silently- the most users won't have any need for the
290 # python interface anyway
292 pythonrfxswf="lib/python/Makefile"
295 # ------------------------------------------------------------------
297 AC_MSG_CHECKING([for missing libraries])
299 if test "x$ZLIBMISSING" = "xtrue";then
300 MISSINGLIBS="${MISSINGLIBS} zlib"
304 if test "x$JPEGLIBMISSING" = "xtrue";then
305 MISSINGLIBS="${MISSINGLIBS} jpeglib"
310 if test "x$T1LIBMISSING" = "xtrue";then
311 MISSINGLIBS="${MISSINGLIBS} t1lib"
313 if test "x$UNGIFMISSING" = "xtrue";then
315 MISSINGLIBS="${MISSINGLIBS} ungif"
319 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
321 DISABLEJPEG2SWF=true;
322 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
325 if test "x$HAVE_FREETYPE" '!=' "x1"; then
327 MISSINGLIBS="${MISSINGLIBS} freetype"
330 if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
331 MISSINGLIBS="${MISSINGLIBS} t1lib.h"
333 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
335 MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
338 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
340 MISSINGLIBS="${MISSINGLIBS} zlib.h"
343 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
344 MISSINGLIBS="${MISSINGLIBS} avifile"
348 AC_MSG_RESULT(${MISSINGLIBS})
350 # ------------------------------------------------------------------
352 if test "x${MISSINGLIBS}" '!=' "x"; then
353 echo "***************************************************"
354 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
357 avi2swf="avi2swf/Makefile"
358 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
359 echo "* Disabling avi2swf tool..."
360 echo all install uninstall clean: > avi2swf/Makefile
364 pdf2swf_makefile="pdf2swf/Makefile pdf2swf/xpdf/Makefile"
365 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
366 echo "* Disabling pdf2swf tool..."
367 rm -f pdf2swf/Makefile
368 echo all install uninstall clean: > pdf2swf/Makefile
372 if test "x${ZLIBMISSING}" = "xtrue"; then
374 echo "* Warning! Without zlib, you will not be able to read"
375 echo "* or write compressed Flash MX files!"
378 JPEG2SWF='jpeg2swf$(E)'
379 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
380 echo "* Disabling jpeg2swf tool..."
386 GIF2SWF='gif2swf$(E)'
387 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
388 echo "* Disabling gif2swf tool..."
394 PNG2SWF='png2swf$(E)'
395 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
396 echo "* Disabling png2swf tool..."
402 if test "x${MISSINGLIBS}" '!=' "x"; then
403 if test "x${PARTIAL}" '=' "x"; then
404 echo "* (never mind)"
406 echo "***************************************************"
409 # ------------------------------------------------------------------
411 if test -f "release.in"; then release_in="./release"; fi
412 FILES="$release_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythonrfxswf} ${lame_makefile} lib/art/Makefile"
414 dnl AC_OUTPUT(${FILES}) old autoconf
415 AC_CONFIG_FILES([${FILES}])
419 # On development trees, create snapshots of config.status
421 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
422 if test "x${MINGW}" = "xyes"; then
423 echo cp config.status config.status.win32
424 cp config.status config.status.win32
426 if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE" '=' "x";then
427 echo cp config.status config.status.linux
428 cp config.status config.status.linux
430 if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE" '=' "x";then
431 echo cp config.status config.status.debug
432 cp config.status config.status.debug
434 if test "x$DEBUG" = "x" -a "x$OPTIMIZE" '!=' "x"; then
435 echo cp config.status config.status.optimize
436 cp config.status config.status.optimize