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(warnings,
12 [ --enable-warnings turn on compiler warnings], ENABLE_WARNINGS=true)
13 AC_ARG_ENABLE(optimizations,
14 [ --enable-optimizations turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true)
16 [ --disable-lame don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
21 # ------------------------------------------------------------------
23 if test "x${srcdir}" != "x."; then
24 echo "--srcdir is not supported"
28 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
29 if test "x$ENABLE_WARNINGS" '!=' "x";then
30 WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls"
33 if test "x$CHECKMEM" '!=' "x";then
36 if test "x$DEBUG" '!=' "x";then
37 CFLAGS="$WARNINGS -g $CFLAGS"
38 CXXFLAGS="$WARNINGS -g $CXXFLAGS"
39 else if test "x$OPTIMIZE" '!=' "x"; then
40 CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
41 CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
43 CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
44 CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
48 #if test "x$OLDGCC" '!=' "x";then
49 # #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
50 # #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
51 # CFLAGS="$CFLAGS -ansi -pendantic"
52 # CXXFLAGS="$CXXFLAGS -ansi -pendantic"
55 export PACKAGE VERSION CFLAGS CXXFLAGS
57 dnl Checks for programs.
63 CFLAGS="$CFLAGS -fno-rtti"
64 CXXFLAGS="$CXXFLAGS -fno-rtti"
67 dnl Checks for programs.
71 if test "x$CHECKMEM" '!=' "x";then
87 AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
89 dnl Checks for system services
95 if test "x${MINGW}" != "xyes"; then
97 AC_DEFINE_UNQUOTED(O_BINARY, 0)
105 # The following tries to make use of includes and libraries in
106 # /usr/local, too. Notice: A -I/usr/local/include might break
107 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include,
108 # especially on systems which link /usr/local to /usr, so it has yet
109 # to be seen how useful this is.
110 if test -d /usr/local/lib; then
111 LDFLAGS="$LDFLAGS -L/usr/local/lib"
113 if test -d /usr/local/include; then
114 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
115 # CPPFLAGS="$CPPFLAGS -I/usr/local/include"
118 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
119 # if the user has a special prefix (like /opt), there might also be $prefix/lib
120 # and $prefix/include, which should be included in our search paths for libraries
122 LDFLAGS="$LDFLAGS -L${libdir}"
123 CPPFLAGS="$CPPFLAGS -I${includedir}"
124 # TODO- test whether gcc still works after this
127 # this must be done after (I believe) AC_PROG_MAKE_SET
128 if test "x$DEBUG" '!=' "x";then
129 STRIP="@echo debug enabled, not stripping "
134 dnl Checks for libraries.
135 AC_CHECK_LIB(m, sin,,
136 echo "Error: Math library not found.";
139 AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
140 AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
141 AC_CHECK_LIB(t1, T1_LoadFont,, T1LIBMISSING=true)
144 AC_SUBST(WORDS_BIGENDIAN)
145 RFX_CHECK_SYSTEM_BACKTICKS
146 AC_SUBST(SYSTEM_BACKTICKS)
150 dnl Checks for header files.
151 AC_CONFIG_HEADER(config.h)
154 AC_CHECK_HEADERS(zlib.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)
156 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
157 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
161 AC_SUBST(HAVE_UNISTD_H)
164 dnl Checks for typedefs, structures, and compiler characteristics.
170 AC_CHECK_TYPE(boolean,int)
171 AC_CHECK_TYPE(bool,char)
172 dnl AC_CHECK_TYPE(uchar,unsigned char)
173 dnl AC_CHECK_TYPE(schar,signed char)
174 dnl AC_CHECK_TYPE(word,unsigned short int)
175 dnl AC_CHECK_TYPE(sword,unsigned short int)
176 dnl AC_CHECK_TYPE(uint,unsigned long int)
178 dnl Checks for library functions.
179 AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
181 # ------------------------------------------------------------------
185 # ------------------------------------------------------------------
189 if test "x${DISABLE_LAME}" = "xtrue"; then
190 echo "*" Disabling lame support...
192 # old lame code at lib/lame
193 if test -f lib/lame/Makefile.in; then
194 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"
195 lame_makefile="lib/lame/Makefile"
196 CPPFLAGS="$CPPFLAGS -Ilame"
197 AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
199 if test -d /usr/include/lame; then
200 CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
202 if test -d /usr/local/include/lame; then
203 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
206 AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
207 AC_CHECK_HEADERS(lame.h)
208 if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$ac_cv_header_lame_h" "!=" "x";then
209 AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
213 AC_SUBST(lame_objects)
215 # ------------------------------------------------------------------
219 # ------------------------------------------------------------------
221 if test "x${UNCOMPRESS}" = "xgzip"; then
222 AC_DEFINE_UNQUOTED(USE_GZIP, 1)
226 # ------------------------------------------------------------------
230 if test "x$PYTHON_OK" '!=' "xyes";then
231 echo all install uninstall clean: > lib/python/Makefile
232 # fail silently- the most users won't have any need for the
233 # python interface anyway
236 # ------------------------------------------------------------------
238 AC_MSG_CHECKING([for missing libraries])
240 if test "x$ZLIBMISSING" = "xtrue";then
241 MISSINGLIBS="${MISSINGLIBS} zlib"
244 if test "x$JPEGLIBMISSING" = "xtrue";then
245 MISSINGLIBS="${MISSINGLIBS} jpeglib"
247 DISABLEJPEG2SWF=true;
249 if test "x$T1LIBMISSING" = "xtrue";then
250 MISSINGLIBS="${MISSINGLIBS} t1lib"
253 if test "x${ac_cv_header_jpeglib_h}" != "xyes"; then
255 DISABLEJPEG2SWF=true;
256 MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
258 if test "x$HAVE_FREETYPE" != "x1"; then
260 MISSINGLIBS="${MISSINGLIBS} freetype"
262 if test "x${ac_cv_header_t1lib_h}" != "xyes"; then
264 MISSINGLIBS="${MISSINGLIBS} t1lib.h"
266 if test "x${ac_cv_header_zlib_h}" != "xyes"; then
268 MISSINGLIBS="${MISSINGLIBS} zlib.h"
270 if test "x${AVIFILE}" != "xtrue"; then
271 MISSINGLIBS="${MISSINGLIBS} avifile"
274 AC_MSG_RESULT(${MISSINGLIBS})
276 # ------------------------------------------------------------------
278 if test "x${MISSINGLIBS}" '!=' "x"; then
279 echo "***************************************************"
280 echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
283 avi2swf="avi2swf/Makefile"
284 if test "x${AVIFILE}" != "xtrue"; then
285 echo "* Disabling avi2swf tool..."
286 echo all install uninstall clean: > avi2swf/Makefile
290 pdf2swf_makefile="pdf2swf/Makefile pdf2swf/xpdf/Makefile"
291 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
292 echo "* Disabling pdf2swf tool..."
293 rm -f pdf2swf/Makefile
294 echo all install uninstall clean: > pdf2swf/Makefile
298 if test "x${ZLIBMISSING}" = "xtrue"; then
300 echo "* Warning! Without zlib, you will not be able to read"
301 echo "* or write compressed Flash MX files!"
304 JPEG2SWF='jpeg2swf$(E)'
305 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
306 echo "* Disabling jpeg2swf tool..."
312 PNG2SWF='png2swf$(E)'
313 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
314 echo "* Disabling png2swf tool..."
320 if test "x${MISSINGLIBS}" '!=' "x"; then
321 echo "***************************************************"
324 # ------------------------------------------------------------------
326 FILES="./release Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythonrfxswf} ${lame_makefile}"
328 dnl AC_OUTPUT(${FILES}) old autoconf
329 AC_CONFIG_FILES([${FILES}])