removed fontmatrix debug messages.
[swftools.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl AC_INIT(src/) # old autoconf
4 AC_INIT
5 AC_CONFIG_SRCDIR([src/])
6
7 AC_ARG_ENABLE(checkmem,
8 [  --enable-checkmem       turn on ccmalloc debugging], CHECKMEM=true)
9 AC_ARG_ENABLE(debug,
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)
15 AC_ARG_ENABLE(lame,
16 [  --disable-lame          don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
17
18 PACKAGE=swftools
19 VERSION=2004-09-18-1422
20
21
22 # ------------------------------------------------------------------
23
24 if test "x${srcdir}" != "x."; then
25     echo "--srcdir is not supported"
26     exit 1
27 fi
28
29 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
30 if test "x$ENABLE_WARNINGS" '!=' "x";then
31     WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls"
32 fi
33
34 if test "x$CHECKMEM" '!=' "x";then
35     DEBUG=yes
36 fi
37 if test "x$DEBUG" '!=' "x";then
38     CFLAGS="$WARNINGS -g $CFLAGS"
39     CXXFLAGS="$WARNINGS -g $CXXFLAGS"
40 else if test "x$OPTIMIZE" '!=' "x"; then
41     CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
42     CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
43 else
44     CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
45     CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
46 fi
47 fi
48 #OLDGCC=1
49 #if test "x$OLDGCC" '!=' "x";then
50 #     #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
51 #     #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
52 #     CFLAGS="$CFLAGS -ansi -pendantic"
53 #     CXXFLAGS="$CXXFLAGS -ansi -pendantic"
54 #fi
55
56 export PACKAGE VERSION CFLAGS CXXFLAGS
57
58 dnl Checks for programs.
59  AC_CANONICAL_HOST
60 MACOSX=
61 case $host_os in
62     *darwin* ) 
63         MACOSX=yes
64         CFLAGS="$CFLAGS -fno-rtti"
65         CXXFLAGS="$CXXFLAGS -fno-rtti"
66         ;;
67 esac
68 dnl Checks for programs.
69  AC_PROG_CC
70  AC_PROG_CXX
71     
72 if test "x$CHECKMEM" '!=' "x";then
73     CC="ccmalloc $CC"
74     CXX="ccmalloc $CXX"
75     #echo running again
76     #unset ac_cv_prog_CC
77     #unset ac_cv_prog_CXX
78     #AC_PROG_CC
79     #AC_PROG_CXX
80 fi
81  AC_PROG_CPP
82
83  AC_PROG_RANLIB
84  AC_PROG_MAKE_SET
85  AC_PROG_INSTALL
86  AC_PROG_LN_S
87  AC_PROG_LIBTOOL
88  AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
89
90 dnl Checks for system services
91  AC_EXEEXT
92
93 RFX_CHECK_MING
94
95 SLEXT="so"
96 if test "x${MINGW}" != "xyes"; then
97     # no mingW
98     AC_DEFINE_UNQUOTED(O_BINARY, 0)
99 else
100     # mingW
101     SLEXT="dll"
102 fi
103 export SLEXT
104 AC_SUBST(SLEXT)
105
106 # The following tries to make use of includes and libraries in
107 # /usr/local, too. Notice: A -I/usr/local/include might break
108 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include, 
109 # especially on systems which link /usr/local to /usr, so it has yet
110 # to be seen how useful this is.
111 if test -d /usr/local/lib; then
112     LDFLAGS="$LDFLAGS -L/usr/local/lib"
113 fi
114 if test -d /usr/local/include; then
115 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
116 #   CPPFLAGS="$CPPFLAGS -I/usr/local/include"
117     echo > /dev/null
118 fi
119 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
120     # if the user has a special prefix (like /opt), there might also be $prefix/lib
121     # and $prefix/include, which should be included in our search paths for libraries
122     # and includes.
123     LDFLAGS="$LDFLAGS -L${libdir}"
124     CPPFLAGS="$CPPFLAGS -I${includedir}"
125     # TODO- test whether gcc still works after this
126 fi
127
128 # this must be done after (I believe) AC_PROG_MAKE_SET
129 if test "x$DEBUG" '!=' "x";then
130     STRIP="@echo debug enabled, not stripping "
131     export STRIP
132     AC_SUBST(STRIP)
133 fi
134
135 dnl Checks for libraries.
136  AC_CHECK_LIB(m, sin,, 
137  echo "Error: Math library not found.";
138  exit;
139  )
140  AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
141  AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
142  AC_CHECK_LIB(t1, T1_LoadFont,, T1LIBMISSING=true)
143
144 RFX_CHECK_BYTEORDER
145 AC_SUBST(WORDS_BIGENDIAN)
146 RFX_CHECK_SYSTEM_BACKTICKS
147 AC_SUBST(SYSTEM_BACKTICKS)
148
149 AC_ARG_PROGRAM
150
151 dnl Checks for header files.
152  AC_CONFIG_HEADER(config.h)
153  AC_HEADER_DIRENT
154  AC_HEADER_STDC
155  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
157 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
158 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
159 AC_SUBST(PACKAGE)
160 AC_SUBST(VERSION)
161
162 AC_SUBST(HAVE_UNISTD_H)
163 AC_SUBST(EXEEXT)
164
165 dnl Checks for typedefs, structures, and compiler characteristics.
166  AC_C_CONST
167  AC_C_INLINE
168  AC_TYPE_OFF_T
169  AC_TYPE_SIZE_T
170  AC_STRUCT_TM
171  AC_CHECK_TYPE(boolean,int) #needed for jpeglib
172  dnl AC_CHECK_TYPE(bool,char)
173  dnl AC_CHECK_TYPE(uchar,unsigned char)
174  dnl AC_CHECK_TYPE(schar,signed char)
175  dnl AC_CHECK_TYPE(word,unsigned short int)
176  dnl AC_CHECK_TYPE(sword,unsigned short int)
177  dnl AC_CHECK_TYPE(uint,unsigned long int)
178
179 dnl Checks for library functions.
180  AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
181
182 # ------------------------------------------------------------------
183
184 RFX_CHECK_FREETYPE
185
186 RFX_CHECK_FONTCONFIG
187
188 # ------------------------------------------------------------------
189  
190 lame_objects= 
191 lame_makefile=
192 if test "x${DISABLE_LAME}" = "xtrue"; then
193     echo "*" Disabling lame support...
194 else
195     # old lame code at lib/lame
196     if test -f lib/lame/Makefile.in; then
197         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"
198         lame_makefile="lib/lame/Makefile"
199         CPPFLAGS="$CPPFLAGS -Ilame"
200         AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
201     else
202         if test -d /usr/include/lame; then
203             CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
204         else
205             if test -d /usr/local/include/lame; then
206                 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
207             fi
208         fi
209         AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
210         AC_CHECK_HEADERS(lame.h)
211         if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$ac_cv_header_lame_h" "!=" "x";then
212             AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
213         fi
214     fi
215 fi
216 AC_SUBST(lame_objects)
217
218 # ------------------------------------------------------------------
219  
220 RFX_CHECK_AVI2SWF
221 if test "x${AVIFILE}" = "xtrue"; then
222     VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
223     VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
224     AC_DEFINE_UNQUOTED(HAVE_AVIFILE, 1)
225 fi
226
227 if test "x${WIN32}" != "x"; then
228     #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
229     #if test "x${AVIFIL32}" != "x"; then
230     #  VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
231     #fi
232     VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
233     AVIFIL32=true
234 fi
235
236 AC_SUBST(VIDEO_LIBS)
237 AC_SUBST(VIDEO_CFLAGS)
238 # ------------------------------------------------------------------
239
240 if test "x${UNCOMPRESS}" = "xgzip"; then
241     AC_DEFINE_UNQUOTED(USE_GZIP, 1)
242 fi
243 AC_SUBST(USE_GZIP)
244
245 # ------------------------------------------------------------------
246
247 RFX_CHECK_PYTHON
248
249 if test "x$PYTHON_OK" '!=' "xyes";then
250     echo all install uninstall clean: > lib/python/Makefile
251     # fail silently- the most users won't have any need for the
252     # python interface anyway
253 else
254     pythonrfxswf="lib/python/Makefile"
255 fi
256
257 # ------------------------------------------------------------------
258
259 AC_MSG_CHECKING([for missing libraries])
260  
261 if test "x$ZLIBMISSING" = "xtrue";then
262     MISSINGLIBS="${MISSINGLIBS} zlib"
263     DISABLEPNG2SWF=true;
264 fi
265 if test "x$JPEGLIBMISSING" = "xtrue";then
266     MISSINGLIBS="${MISSINGLIBS} jpeglib"
267     DISABLEPDF2SWF=true;
268     DISABLEJPEG2SWF=true;
269 fi
270 if test "x$T1LIBMISSING" = "xtrue";then
271     MISSINGLIBS="${MISSINGLIBS} t1lib"
272 fi
273
274 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
275  DISABLEPDF2SWF=true;
276  DISABLEJPEG2SWF=true;
277  MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
278 fi
279 if test "x$HAVE_FREETYPE" '!=' "x1"; then
280  DISABLEPDF2SWF=true;
281  MISSINGLIBS="${MISSINGLIBS} freetype"
282 fi
283 if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
284  DISABLEPDF2SWF=true;
285  MISSINGLIBS="${MISSINGLIBS} t1lib.h"
286 fi
287 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
288  DISABLEPNG2SWF=true;
289  MISSINGLIBS="${MISSINGLIBS} zlib.h"
290 fi
291 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
292  MISSINGLIBS="${MISSINGLIBS} avifile"
293 fi
294
295 AC_MSG_RESULT(${MISSINGLIBS})
296
297 # ------------------------------------------------------------------
298
299 if test "x${MISSINGLIBS}" '!=' "x"; then
300   echo "***************************************************"
301   echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
302 fi
303
304 avi2swf="avi2swf/Makefile"
305 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
306  echo "* Disabling avi2swf tool..."
307  echo all install uninstall clean: > avi2swf/Makefile
308  avi2swf=
309 fi
310
311 pdf2swf_makefile="pdf2swf/Makefile pdf2swf/xpdf/Makefile"
312 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
313   echo "* Disabling pdf2swf tool..."
314   rm -f pdf2swf/Makefile
315   echo all install uninstall clean: > pdf2swf/Makefile
316   pdf2swf_makefile=""
317 fi
318
319 if test "x${ZLIBMISSING}" = "xtrue"; then
320   echo
321   echo "* Warning! Without zlib, you will not be able to read"
322   echo "* or write compressed Flash MX files!"
323 fi
324
325 JPEG2SWF='jpeg2swf$(E)'
326 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
327   echo "* Disabling jpeg2swf tool..."
328   JPEG2SWF=
329 fi
330 export JPEG2SWF
331 AC_SUBST(JPEG2SWF)
332
333 PNG2SWF='png2swf$(E)'
334 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
335   echo "* Disabling png2swf tool..."
336   PNG2SWF=
337 fi
338 export PNG2SWF
339 AC_SUBST(PNG2SWF)
340
341 if test "x${MISSINGLIBS}" '!=' "x"; then
342   echo "***************************************************"
343 fi
344
345 # ------------------------------------------------------------------
346
347 if test -f "release.in"; then release_in="./release"; fi
348 FILES="$release_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythonrfxswf} ${lame_makefile}"
349
350 dnl AC_OUTPUT(${FILES}) old autoconf
351 AC_CONFIG_FILES([${FILES}])
352 AC_OUTPUT
353