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