added arts device
[swftools.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl old autoconf
4 AC_INIT(src/)
5
6 dnl new autoconf
7 dnl AC_INIT
8 dnl AC_CONFIG_SRCDIR([src/])
9
10 AC_ARG_ENABLE(checkmem,
11 [  --enable-checkmem       turn on ccmalloc debugging], CHECKMEM=true)
12 AC_ARG_ENABLE(debug,
13 [  --enable-debug          turn on debugging], DEBUG=true)
14 AC_ARG_ENABLE(profiling,
15 [  --enable-profiling      turn on profiling], PROFILING=true)
16 AC_ARG_ENABLE(warnings,
17 [  --enable-warnings       turn on compiler warnings], ENABLE_WARNINGS=true)
18 AC_ARG_ENABLE(optimizations,
19 [  --enable-optimizations  turn on compiler optimizations (recommended for avi2swf)], OPTIMIZE=true)
20 AC_ARG_ENABLE(lame,
21 [  --disable-lame          don't compile any L.A.M.E. mp3 encoding code in], DISABLE_LAME=true)
22
23 PACKAGE=swftools
24 VERSION=2006-05-01-1103
25
26
27 # ------------------------------------------------------------------
28
29 if test "x${srcdir}" != "x."; then
30     echo "--srcdir is not supported"
31     exit 1
32 fi
33
34 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
35 if test "x$ENABLE_WARNINGS" '!=' "x";then
36     WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls"
37 fi
38
39 if test "x$CHECKMEM" '!=' "x";then
40     DEBUG=yes
41 fi
42 if test "x$PROFILING" '!=' "x";then
43     DEBUG=yes
44 fi
45 if test "x$DEBUG" '!=' "x";then
46     if test "x$PROFILING" = "x";then
47         CFLAGS="$WARNINGS -O2 -g $CFLAGS"
48         CXXFLAGS="$WARNINGS -O2 -g $CXXFLAGS"
49     else
50         CFLAGS="$WARNINGS -O2 -g -pg $CFLAGS"
51         CXXFLAGS="$WARNINGS -O2 -g -pg $CXXFLAGS"
52         LDFLAGS="-g -pg $LIBS"
53     fi
54 else if test "x$OPTIMIZE" '!=' "x"; then
55     CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
56     CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
57 else
58     CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
59     CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
60 fi
61 fi
62 #OLDGCC=1
63 #if test "x$OLDGCC" '!=' "x";then
64 #     #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
65 #     #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
66 #     CFLAGS="$CFLAGS -ansi -pendantic"
67 #     CXXFLAGS="$CXXFLAGS -ansi -pendantic"
68 #fi
69
70 export PACKAGE VERSION CFLAGS CXXFLAGS
71
72 dnl Checks for programs.
73
74 AC_CANONICAL_HOST
75
76 SHARED="-shared"
77 MACOSX=
78 case $host_os in
79     *darwin* ) 
80         MACOSX=yes
81         CFLAGS="$CFLAGS"
82         CXXFLAGS="$CXXFLAGS -fno-rtti"
83         SHARED="-bundle"
84         # Use fink packages if available.
85         #if test -d /sw/include && test -d /sw/lib; then
86         #    CPPFLAGS="${CPPFLAGS} -I/sw/include"
87         #    LDFLAGS="${LDFLAGS} -L/sw/lib"
88         #fi
89         ;;
90 esac
91
92 AC_SUBST(SHARED)
93
94 dnl Checks for programs.
95  AC_PROG_CC
96  AC_PROG_CXX
97
98
99 RFX_CHECK_OLDGCC
100
101 if test "x$GCC_IS_OK" '=' "x";then
102     echo "***************************************************"
103     echo "* Your gcc is too old to compile this!"
104     echo "* "
105     echo "* The last version compilable by this compiler is "
106     echo "* swftools 0.7.0, which you can download from "
107     echo "* http://www.swftools.org/swftools-0.7.0.tar.gz "
108     echo "* ."
109     echo "* Newer versions require at least gcc 3.0.0 "
110     echo "***************************************************"
111     exit 1
112 fi
113     
114 if test "x$CHECKMEM" '!=' "x";then
115     CC="ccmalloc $CC"
116     CXX="ccmalloc $CXX"
117     #echo running again
118     #unset ac_cv_prog_CC
119     #unset ac_cv_prog_CXX
120     #AC_PROG_CC
121     #AC_PROG_CXX
122 fi
123  AC_PROG_CPP
124
125  AC_PROG_RANLIB
126  AC_PROG_MAKE_SET
127  AC_PROG_INSTALL
128  AC_PROG_LN_S
129  AC_PROG_LIBTOOL
130  AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
131
132 dnl Checks for system services
133 OBJEXT="o"
134 AREXT=".a"
135 CXXLIBS="-lstdc++"
136
137 AC_EXEEXT
138
139 if test "x$EXEEXT" = "x.exe";then
140     OBJEXT="obj"
141     AREXT=".lib"
142     CXXLIBS=""
143 fi
144 AC_SUBST(OBJEXT)
145 AC_SUBST(AREXT)
146
147 RFX_CHECK_MING
148
149 SLEXT="so"
150 if test "x${MINGW}" != "xyes"; then
151     # no mingW
152     AC_DEFINE_UNQUOTED(O_BINARY, 0)
153 else
154     # mingW
155     SLEXT="dll"
156     CXXLIBS=""
157 fi
158 export SLEXT
159 AC_SUBST(SLEXT)
160 AC_SUBST(CXXLIBS)
161
162 # The following tries to make use of includes and libraries in
163 # /usr/local, too. Notice: A -I/usr/local/include might break
164 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include, 
165 # especially on systems which link /usr/local to /usr, so it has yet
166 # to be seen how useful this is.
167 if test -d /usr/local/lib; then
168     LDFLAGS="$LDFLAGS -L/usr/local/lib"
169 fi
170 if test -d /usr/local/include; then
171 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
172 #   CPPFLAGS="$CPPFLAGS -I/usr/local/include"
173     echo > /dev/null
174 fi
175 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
176     # if the user has a special prefix (like /opt), there might also be $prefix/lib
177     # and $prefix/include, which should be included in our search paths for libraries
178     # and includes.
179     LDFLAGS="$LDFLAGS -L${libdir}"
180     CPPFLAGS="$CPPFLAGS -I${includedir}"
181     # TODO- test whether gcc still works after this
182 fi
183
184 #Mac OS:
185 #LDFLAGS "-L/sw/lib" ; CPPFLAGS "-I/sw/include -I/sw/include/lame"
186
187
188 # this must be done after (I believe) AC_PROG_MAKE_SET
189 if test "x$DEBUG" '!=' "x";then
190     STRIP="@echo debug enabled, not stripping "
191     export STRIP
192     AC_SUBST(STRIP)
193 fi
194
195 dnl Checks for libraries.
196  AC_CHECK_LIB(m, sin,, 
197  echo "Error: Math library not found.";
198  exit;
199  )
200  AC_CHECK_LIB(z, deflate,, ZLIBMISSING=true)
201  AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, JPEGLIBMISSING=true)
202  AC_CHECK_LIB(t1, T1_LoadFont,, T1LIBMISSING=true)
203  AC_CHECK_LIB(ungif, DGifOpen,, UNGIFMISSING=true)
204
205 RFX_CHECK_BYTEORDER
206 AC_SUBST(WORDS_BIGENDIAN)
207 RFX_CHECK_SYSTEM_BACKTICKS
208 AC_SUBST(SYSTEM_BACKTICKS)
209
210 AC_ARG_PROGRAM
211
212 dnl Checks for header files.
213  AC_CONFIG_HEADER(config.h)
214  AC_HEADER_DIRENT
215  AC_HEADER_STDC
216  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)
217
218 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
219 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
220 AC_SUBST(PACKAGE)
221 AC_SUBST(VERSION)
222
223 AC_SUBST(HAVE_UNISTD_H)
224 AC_SUBST(EXEEXT)
225
226 dnl Checks for typedefs, structures, and compiler characteristics.
227  AC_C_CONST
228  AC_C_INLINE
229  AC_TYPE_OFF_T
230  AC_TYPE_SIZE_T
231  AC_STRUCT_TM
232  AC_CHECK_TYPE(boolean,int) #needed for jpeglib
233  dnl AC_CHECK_TYPE(bool,char)
234  dnl AC_CHECK_TYPE(uchar,unsigned char)
235  dnl AC_CHECK_TYPE(schar,signed char)
236  dnl AC_CHECK_TYPE(word,unsigned short int)
237  dnl AC_CHECK_TYPE(sword,unsigned short int)
238  dnl AC_CHECK_TYPE(uint,unsigned long int)
239
240 dnl Checks for library functions.
241  AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
242
243 # ------------------------------------------------------------------
244
245 RFX_CHECK_FREETYPE
246
247 #RFX_CHECK_FONTCONFIG
248
249 # ------------------------------------------------------------------
250  
251 lame_objects= 
252 lame_makefile=
253 if test "x${DISABLE_LAME}" = "xtrue"; then
254     echo "*" Disabling lame support...
255 else
256     # old lame code at lib/lame
257     if test -f lib/lame/Makefile.in; then
258         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)"
259         lame_makefile="lib/lame/Makefile"
260         CPPFLAGS="$CPPFLAGS -Ilame"
261         AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
262     else
263         if test -d /usr/include/lame; then
264             CPPFLAGS="$CPPFLAGS -I /usr/include/lame"
265         else
266             if test -d /usr/local/include/lame; then
267                 CPPFLAGS="$CPPFLAGS -I /usr/local/include/lame"
268             fi
269         fi
270         AC_CHECK_LIB(mp3lame, lame_init,, NO_LIBMP3LAME=1)
271         AC_CHECK_HEADERS(lame.h)
272         if test "x$NO_LIBMP3LAME" "!=" "x1" -a "x$ac_cv_header_lame_h" "!=" "x";then
273             AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
274         fi
275     fi
276 fi
277 AC_SUBST(lame_objects)
278
279 # ------------------------------------------------------------------
280  
281 RFX_CHECK_AVI2SWF
282 if test "x${AVIFILE}" = "xtrue"; then
283     VIDEO_LIBS="$VIDEO_LIBS $AVIFILE_LIBS"
284     VIDEO_CFLAGS="$VIDEO_CFLAGS $AVIFILE_CFLAGS"
285     AC_DEFINE_UNQUOTED(HAVE_AVIFILE, 1)
286 fi
287
288 if test "x${WIN32}" != "x"; then
289     #AC_CHECK_LIB(avifil32, AVIFileInit,AVIFIL32=true)
290     #if test "x${AVIFIL32}" != "x"; then
291     #  VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
292     #fi
293     VIDEO_LIBS="$VIDEO_LIBS -lavifil32"
294     AVIFIL32=true
295 fi
296
297 AC_SUBST(VIDEO_LIBS)
298 AC_SUBST(VIDEO_CFLAGS)
299 # ------------------------------------------------------------------
300
301 if test "x${UNCOMPRESS}" = "xgzip"; then
302     AC_DEFINE_UNQUOTED(USE_GZIP, 1)
303 fi
304 AC_SUBST(USE_GZIP)
305
306 # ------------------------------------------------------------------
307
308 RFX_CHECK_PYTHON
309
310 if test "x$PYTHON_OK" '!=' "xyes";then
311     echo all install uninstall clean: > lib/python/Makefile
312     # fail silently- the most users won't have any need for the
313     # python interface anyway
314 else
315     pythonrfxswf="lib/python/Makefile"
316 fi
317
318 # ------------------------------------------------------------------
319
320 AC_MSG_CHECKING([for missing libraries])
321
322 if test "x$ZLIBMISSING" = "xtrue";then
323     MISSINGLIBS="${MISSINGLIBS} zlib"
324     DISABLEPNG2SWF=true
325     PARTIAL=true
326 fi
327 if test "x$JPEGLIBMISSING" = "xtrue";then
328     MISSINGLIBS="${MISSINGLIBS} jpeglib"
329     DISABLEPDF2SWF=true
330     DISABLEJPEG2SWF=true
331     PARTIAL=true
332 fi
333 if test "x$T1LIBMISSING" = "xtrue";then
334     MISSINGLIBS="${MISSINGLIBS} t1lib"
335 fi
336 if test "x$UNGIFMISSING" = "xtrue";then
337     DISABLEGIF2SWF=true
338     MISSINGLIBS="${MISSINGLIBS} ungif"
339     PARTIAL=true
340 fi
341
342 if test "x${ac_cv_header_jpeglib_h}" '!=' "xyes"; then
343     DISABLEPDF2SWF=true;
344     DISABLEJPEG2SWF=true;
345     MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
346     PARTIAL=true
347 fi
348 if test "x$HAVE_FREETYPE" '!=' "x1"; then
349     DISABLEPDF2SWF=true;
350     MISSINGLIBS="${MISSINGLIBS} freetype"
351     PARTIAL=true
352 fi
353 if test "x${ac_cv_header_t1lib_h}" '!=' "xyes"; then
354     MISSINGLIBS="${MISSINGLIBS} t1lib.h"
355 fi
356 if test "x${ac_cv_header_gif_lib_h}" '!=' "xyes"; then
357     DISABLEGIF2SWF=true
358     MISSINGLIBS="${MISSINGLIBS} gif_lib.h"
359     PARTIAL=true
360 fi
361 if test "x${ac_cv_header_zlib_h}" '!=' "xyes"; then
362     DISABLEPNG2SWF=true;
363     MISSINGLIBS="${MISSINGLIBS} zlib.h"
364     PARTIAL=true
365 fi
366 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
367     MISSINGLIBS="${MISSINGLIBS} avifile"
368     PARTIAL=true
369 fi
370
371 AC_MSG_RESULT(${MISSINGLIBS})
372
373 # ------------------------------------------------------------------
374
375 if test "x${MISSINGLIBS}" '!=' "x"; then
376   echo "***************************************************"
377   echo "* The following headers/libraries are missing: " ${MISSINGLIBS}
378 fi
379
380 avi2swf="avi2swf/Makefile"
381 if test "x${AVIFILE}" '!=' "xtrue" -a "x${AVIFIL32}" '!=' "xtrue"; then
382  echo "* Disabling avi2swf tool..."
383  echo all install uninstall clean: > avi2swf/Makefile
384  avi2swf=
385 fi
386
387 pdf2swf_makefile="pdf2swf/Makefile pdf2swf/xpdf/Makefile"
388 PDF2SWF='pdf2swf$(E)'
389 LIBPDF='libpdf$(A)'
390
391 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
392   echo "* Disabling pdf2swf tool..."
393   rm -f pdf2swf/Makefile
394   echo all install uninstall clean: > pdf2swf/Makefile
395   pdf2swf_makefile=""
396   PDF2SWF=
397   LIBPDF=
398 fi
399 AC_SUBST(PDF2SWF)
400 AC_SUBST(LIBPDF)
401
402 if test "x${ZLIBMISSING}" = "xtrue"; then
403   echo
404   echo "* Warning! Without zlib, you will not be able to read"
405   echo "* or write compressed Flash MX files!"
406 fi
407
408 JPEG2SWF='jpeg2swf$(E)'
409 if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
410   echo "* Disabling jpeg2swf tool..."
411   JPEG2SWF=
412 fi
413 export JPEG2SWF
414 AC_SUBST(JPEG2SWF)
415
416 GIF2SWF='gif2swf$(E)'
417 if test "x${DISABLEGIF2SWF}" = "xtrue"; then
418   echo "* Disabling gif2swf tool..."
419   GIF2SWF=
420 fi
421 export GIF2SWF
422 AC_SUBST(GIF2SWF)
423
424 PNG2SWF='png2swf$(E)'
425 if test "x${DISABLEPNG2SWF}" = "xtrue"; then
426   echo "* Disabling png2swf tool..."
427   PNG2SWF=
428 fi
429 export PNG2SWF
430 AC_SUBST(PNG2SWF)
431
432 if test "x${MISSINGLIBS}" '!=' "x"; then
433   if test "x${PARTIAL}" '=' "x"; then
434     echo "* (never mind)"
435   fi
436   echo "***************************************************"
437 fi
438
439 # ------------------------------------------------------------------
440
441 if test -f "release.in"; then release_in="./release"; fi
442 FILES="$release_in Makefile.common ${avi2swf} Makefile lib/Makefile lib/action/Makefile src/Makefile ${pdf2swf_makefile} swfs/Makefile ${pythonrfxswf} ${lame_makefile} lib/art/Makefile"
443
444 dnl old autoconf
445 AC_OUTPUT(${FILES})
446
447 dnl new autoconf
448 dnl AC_CONFIG_FILES([${FILES}])
449 dnl AC_OUTPUT
450
451 #
452 # On development trees, create snapshots of config.status
453 #
454 if test -f snapshot -a "x$CHECKMEM" = "x" -a "x$PROFILING" = "x";then
455     if test "x${MINGW}" = "xyes"; then
456         echo cp config.status config.status.win32
457         cp config.status config.status.win32
458     else
459         if test "x$DEBUG" '=' "x" -a "x$OPTIMIZE"  '=' "x";then
460             echo cp config.status config.status.linux
461             cp config.status config.status.linux
462         fi
463         if test "x$DEBUG" '!=' "x" -a "x$OPTIMIZE"  '=' "x";then
464             echo cp config.status config.status.debug
465             cp config.status config.status.debug
466         fi
467         if test "x$DEBUG"    = "x" -a "x$OPTIMIZE" '!=' "x"; then
468             echo cp config.status config.status.optimize
469             cp config.status config.status.optimize
470         fi
471     fi
472 fi