changed version to 0.7.0
[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(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)
17 AC_ARG_ENABLE(lame,
18 [  --disable-lame          don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
19
20 PACKAGE=swftools
21 VERSION=0.7.0
22
23
24 # ------------------------------------------------------------------
25
26 if test "x${srcdir}" != "x."; then
27     echo "--srcdir is not supported"
28     exit 1
29 fi
30
31 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
32 if test "x$ENABLE_WARNINGS" '!=' "x";then
33     WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls"
34 fi
35
36 if test "x$CHECKMEM" '!=' "x";then
37     DEBUG=yes
38 fi
39 if test "x$PROFILING" '!=' "x";then
40     DEBUG=yes
41 fi
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"
46     else
47         CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
48         CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
49         LDFLAGS="-g -pg $LIBS"
50     fi
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"
54 else
55     CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
56     CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
57 fi
58 fi
59 #OLDGCC=1
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"
65 #fi
66
67 export PACKAGE VERSION CFLAGS CXXFLAGS
68
69 dnl Checks for programs.
70
71 AC_CANONICAL_HOST
72
73 SHARED="-shared"
74 MACOSX=
75 case $host_os in
76     *darwin* ) 
77         MACOSX=yes
78         CFLAGS="$CFLAGS"
79         CXXFLAGS="$CXXFLAGS -fno-rtti"
80         SHARED="-bundle"
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"
85         #fi
86         ;;
87 esac
88
89 AC_SUBST(SHARED)
90
91 dnl Checks for programs.
92  AC_PROG_CC
93  AC_PROG_CXX
94     
95 if test "x$CHECKMEM" '!=' "x";then
96     CC="ccmalloc $CC"
97     CXX="ccmalloc $CXX"
98     #echo running again
99     #unset ac_cv_prog_CC
100     #unset ac_cv_prog_CXX
101     #AC_PROG_CC
102     #AC_PROG_CXX
103 fi
104  AC_PROG_CPP
105
106  AC_PROG_RANLIB
107  AC_PROG_MAKE_SET
108  AC_PROG_INSTALL
109  AC_PROG_LN_S
110  AC_PROG_LIBTOOL
111  AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
112
113 dnl Checks for system services
114 OBJEXT="o"
115 AREXT=".a"
116
117 AC_EXEEXT
118
119 if test "x$EXEEXT" = "x.exe";then
120     OBJEXT="obj"
121     AREXT=".lib"
122 fi
123 AC_SUBST(OBJEXT)
124 AC_SUBST(AREXT)
125
126 RFX_CHECK_MING
127
128 SLEXT="so"
129 if test "x${MINGW}" != "xyes"; then
130     # no mingW
131     AC_DEFINE_UNQUOTED(O_BINARY, 0)
132 else
133     # mingW
134     SLEXT="dll"
135 fi
136 export SLEXT
137 AC_SUBST(SLEXT)
138
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"
146 fi
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"
150     echo > /dev/null
151 fi
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
155     # and includes.
156     LDFLAGS="$LDFLAGS -L${libdir}"
157     CPPFLAGS="$CPPFLAGS -I${includedir}"
158     # TODO- test whether gcc still works after this
159 fi
160
161 #Mac OS:
162 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
163
164
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 "
168     export STRIP
169     AC_SUBST(STRIP)
170 fi
171
172 dnl Checks for libraries.
173  AC_CHECK_LIB(m, sin,, 
174  echo "Error: Math library not found.";
175  exit;
176  )
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)
181
182 RFX_CHECK_BYTEORDER
183 AC_SUBST(WORDS_BIGENDIAN)
184 RFX_CHECK_SYSTEM_BACKTICKS
185 AC_SUBST(SYSTEM_BACKTICKS)
186
187 AC_ARG_PROGRAM
188
189 dnl Checks for header files.
190  AC_CONFIG_HEADER(config.h)
191  AC_HEADER_DIRENT
192  AC_HEADER_STDC
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)
194
195 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
196 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
197 AC_SUBST(PACKAGE)
198 AC_SUBST(VERSION)
199
200 AC_SUBST(HAVE_UNISTD_H)
201 AC_SUBST(EXEEXT)
202
203 dnl Checks for typedefs, structures, and compiler characteristics.
204  AC_C_CONST
205  AC_C_INLINE
206  AC_TYPE_OFF_T
207  AC_TYPE_SIZE_T
208  AC_STRUCT_TM
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)
216
217 dnl Checks for library functions.
218  AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
219
220 # ------------------------------------------------------------------
221
222 RFX_CHECK_FREETYPE
223
224 RFX_CHECK_FONTCONFIG
225
226 # ------------------------------------------------------------------
227  
228 lame_objects= 
229 lame_makefile=
230 if test "x${DISABLE_LAME}" = "xtrue"; then
231     echo "*" Disabling lame support...
232 else
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)
239     else
240         if test -d /usr/include/lame; then
241             CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
242         else
243             if test -d /usr/local/include/lame; then
244                 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
245             fi
246         fi
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)
251         fi
252     fi
253 fi
254 AC_SUBST(lame_objects)
255
256 # ------------------------------------------------------------------
257  
258 RFX_CHECK_AVI2SWF
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)
263 fi
264
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"
269     #fi
270     VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
271     AVIFIL32=true
272 fi
273
274 AC_SUBST(VIDEO_LIBS)
275 AC_SUBST(VIDEO_CFLAGS)
276 # ------------------------------------------------------------------
277
278 if test "x${UNCOMPRESS}" = "xgzip"; then
279     AC_DEFINE_UNQUOTED(USE_GZIP, 1)
280 fi
281 AC_SUBST(USE_GZIP)
282
283 # ------------------------------------------------------------------
284
285 RFX_CHECK_PYTHON
286
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
291 else
292     pythonrfxswf="lib/python/Makefile"
293 fi
294
295 # ------------------------------------------------------------------
296
297 AC_MSG_CHECKING([for missing libraries])
298
299 if test "x$ZLIBMISSING" = "xtrue";then
300     MISSINGLIBS="${MISSINGLIBS} zlib"
301     DISABLEPNG2SWF=true
302     PARTIAL=true
303 fi
304 if test "x$JPEGLIBMISSING" = "xtrue";then
305     MISSINGLIBS="${MISSINGLIBS} jpeglib"
306     DISABLEPDF2SWF=true
307     DISABLEJPEG2SWF=true
308     PARTIAL=true
309 fi
310 if test "x$T1LIBMISSING" = "xtrue";then
311     MISSINGLIBS="${MISSINGLIBS} t1lib"
312 fi
313 if test "x$UNGIFMISSING" = "xtrue";then
314     DISABLEGIF2SWF=true
315     MISSINGLIBS="${MISSINGLIBS} ungif"
316     PARTIAL=true
317 fi
318
319 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
320     DISABLEPDF2SWF=true;
321     DISABLEJPEG2SWF=true;
322     MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
323     PARTIAL=true
324 fi
325 if test "x$HAVE_FREETYPE" '!=' "x1"; then
326     DISABLEPDF2SWF=true;
327     MISSINGLIBS="${MISSINGLIBS} freetype"
328     PARTIAL=true
329 fi
330 if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
331     MISSINGLIBS="${MISSINGLIBS} t1lib.h"
332 fi
333 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
334     DISABLEGIF2SWF=true
335     MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
336     PARTIAL=true
337 fi
338 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
339     DISABLEPNG2SWF=true;
340     MISSINGLIBS="${MISSINGLIBS} zlib.h"
341     PARTIAL=true
342 fi
343 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
344     MISSINGLIBS="${MISSINGLIBS} avifile"
345     PARTIAL=true
346 fi
347
348 AC_MSG_RESULT(${MISSINGLIBS})
349
350 # ------------------------------------------------------------------
351
352 if test "x${MISSINGLIBS}" '!=' "x"; then
353   echo "***************************************************"
354   echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
355 fi
356
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
361  avi2swf=
362 fi
363
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
369   pdf2swf_makefile=""
370 fi
371
372 if test "x${ZLIBMISSING}" = "xtrue"; then
373   echo
374   echo "* Warning! Without zlib, you will not be able to read"
375   echo "* or write compressed Flash MX files!"
376 fi
377
378 JPEG2SWF='jpeg2swf$(E)'
379 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
380   echo "* Disabling jpeg2swf tool..."
381   JPEG2SWF=
382 fi
383 export JPEG2SWF
384 AC_SUBST(JPEG2SWF)
385
386 GIF2SWF='gif2swf$(E)'
387 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
388   echo "* Disabling gif2swf tool..."
389   GIF2SWF=
390 fi
391 export GIF2SWF
392 AC_SUBST(GIF2SWF)
393
394 PNG2SWF='png2swf$(E)'
395 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
396   echo "* Disabling png2swf tool..."
397   PNG2SWF=
398 fi
399 export PNG2SWF
400 AC_SUBST(PNG2SWF)
401
402 if test "x${MISSINGLIBS}" '!=' "x"; then
403   if test "x${PARTIAL}" '=' "x"; then
404     echo "* (never mind)"
405   fi
406   echo "***************************************************"
407 fi
408
409 # ------------------------------------------------------------------
410
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"
413
414 dnl AC_OUTPUT(${FILES}) old autoconf
415 AC_CONFIG_FILES([${FILES}])
416 AC_OUTPUT
417
418 #
419 # On development trees, create snapshots of config.status
420 #
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
425     else
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
429         fi
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
433         fi
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
437         fi
438     fi
439 fi