added comment about autoconf changes.
[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-05-18-1254
20
21
22
23 WARNINGS="-Wparentheses -Wimplicit -Wreturn-type"
24 if test "x$ENABLE_WARNINGS" '!=' "x";then
25     WARNINGS="-Wall -Wno-unused -Wno-format -Wno-redundant-decls"
26 fi
27
28 if test "x$CHECKMEM" '!=' "x";then
29     DEBUG=yes
30 fi
31 if test "x$DEBUG" '!=' "x";then
32     CFLAGS="$WARNINGS -g $CFLAGS"
33     CXXFLAGS="$WARNINGS -g $CXXFLAGS"
34 else if test "x$OPTIMIZE" '!=' "x"; then
35     CFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CFLAGS"
36     CXXFLAGS="$WARNINGS -O3 -fomit-frame-pointer -Winline $CXXFLAGS"
37 else
38     CFLAGS="$WARNINGS -O -fomit-frame-pointer $CFLAGS"
39     CXXFLAGS="$WARNINGS -O -fomit-frame-pointer $CXXFLAGS"
40 fi
41 fi
42 #OLDGCC=1
43 #if test "x$OLDGCC" '!=' "x";then
44 #     #CFLAGS="$CFLAGS --std=c89 -ansi -pendantic"
45 #     #CXXFLAGS="$CXXFLAGS --std=c89 -ansi -pendantic"
46 #     CFLAGS="$CFLAGS -ansi -pendantic"
47 #     CXXFLAGS="$CXXFLAGS -ansi -pendantic"
48 #fi
49
50 export PACKAGE VERSION CFLAGS CXXFLAGS
51
52 dnl Checks for programs.
53  AC_CANONICAL_HOST
54 MACOSX=
55 case $host_os in
56     *darwin* ) 
57         MACOSX=yes
58         CFLAGS="$CFLAGS -fno-rtti"
59         CXXFLAGS="$CXXFLAGS -fno-rtti"
60         ;;
61 esac
62 dnl Checks for programs.
63  AC_PROG_CC
64  AC_PROG_CXX
65     
66 if test "x$CHECKMEM" '!=' "x";then
67     CC="ccmalloc $CC"
68     CXX="ccmalloc $CXX"
69     #echo running again
70     #unset ac_cv_prog_CC
71     #unset ac_cv_prog_CXX
72     #AC_PROG_CC
73     #AC_PROG_CXX
74 fi
75  AC_PROG_CPP
76
77  AC_PROG_RANLIB
78  AC_PROG_MAKE_SET
79  AC_PROG_INSTALL
80  AC_PROG_LN_S
81  AC_PROG_LIBTOOL
82  AC_CHECK_PROGS(UNCOMPRESS, gzip uncompress compress, )
83
84 dnl Checks for system services
85  AC_EXEEXT
86
87 RFX_CHECK_MING
88
89 if test "x${MINGW}" != "xyes"; then
90     AC_DEFINE_UNQUOTED(O_BINARY, 0)
91 fi
92 # The following tries to make use of includes and libraries in
93 # /usr/local, too. Notice: A -I/usr/local/include might break
94 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include, 
95 # especially on systems which link /usr/local to /usr, so it has yet
96 # to be seen how useful this is.
97 if test -d /usr/local/lib; then
98     LDFLAGS="$LDFLAGS -L/usr/local/lib"
99 fi
100 if test -d /usr/local/include; then
101 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
102 #   CPPFLAGS="$CPPFLAGS -I/usr/local/include"
103     echo > /dev/null
104 fi
105 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
106     # if the user has a special prefix (like /opt), there might also be $prefix/lib
107     # and $prefix/include, which should be included in our search paths for libraries
108     # and includes.
109     LDFLAGS="$LDFLAGS -L${libdir}"
110     CPPFLAGS="$CPPFLAGS -I${includedir}"
111     # TODO- test whether gcc still works after this
112 fi
113
114 # this must be done after (I believe) AC_PROG_MAKE_SET
115 if test "x$DEBUG" '!=' "x";then
116     STRIP="@echo debug enabled, not stripping "
117     export STRIP
118     AC_SUBST(STRIP)
119 fi
120
121 dnl Checks for libraries.
122  AC_CHECK_LIB(m, sin,, 
123  echo "Error: Math library not found.";
124  exit;
125  )
126  AC_CHECK_LIB(z, deflate,, 
127  DISABLEPNG2SWF=true;
128  MISSINGLIBS="${MISSINGLIBS} zlib"
129  ZLIBMISSING=true;
130  )
131  AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, 
132  DISABLEPDF2SWF=true;
133  DISABLEJPEG2SWF=true;
134  MISSINGLIBS="${MISSINGLIBS} jpeglib"
135  )
136  AC_CHECK_LIB(t1, T1_LoadFont,,
137  DISABLEPDF2SWF=true;
138  MISSINGLIBS="${MISSINGLIBS} t1lib"
139  )
140
141 RFX_CHECK_FREETYPE
142
143 RFX_CHECK_BYTEORDER
144 AC_SUBST(WORDS_BIGENDIAN)
145 RFX_CHECK_SYSTEM_BACKTICKS
146 AC_SUBST(SYSTEM_BACKTICKS)
147
148 AC_ARG_PROGRAM
149
150 dnl Checks for header files.
151  AC_CONFIG_HEADER(config.h)
152  AC_HEADER_DIRENT
153  AC_HEADER_STDC
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)
155
156 if test "x${ac_cv_header_jpeglib_h}" != "xyes"; then
157  DISABLEPDF2SWF=true;
158  DISABLEJPEG2SWF=true;
159  MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
160 fi
161 if test "x${ac_cv_header_t1lib_h}" != "xyes"; then
162  DISABLEPDF2SWF=true;
163  MISSINGLIBS="${MISSINGLIBS} t1lib.h"
164 fi
165 if test "x${ac_cv_header_zlib_h}" != "xyes"; then
166  DISABLEPNG2SWF=true;
167  MISSINGLIBS="${MISSINGLIBS} zlib.h"
168  ZLIBMISSING=true;
169 fi
170
171 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
172 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
173 AC_SUBST(PACKAGE)
174 AC_SUBST(VERSION)
175
176 AC_SUBST(HAVE_UNISTD_H)
177 AC_SUBST(EXEEXT)
178
179 dnl Checks for typedefs, structures, and compiler characteristics.
180  AC_C_CONST
181  AC_C_INLINE
182  AC_TYPE_OFF_T
183  AC_TYPE_SIZE_T
184  AC_STRUCT_TM
185  AC_CHECK_TYPE(boolean,int)
186  AC_CHECK_TYPE(bool,char)
187  dnl AC_CHECK_TYPE(uchar,unsigned char)
188  dnl AC_CHECK_TYPE(schar,signed char)
189  dnl AC_CHECK_TYPE(word,unsigned short int)
190  dnl AC_CHECK_TYPE(sword,unsigned short int)
191  dnl AC_CHECK_TYPE(uint,unsigned long int)
192
193 dnl Checks for library functions.
194  AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
195  RFX_CHECK_AVI2SWF
196
197 avi2swf="avi2swf/Makefile"
198 if test "x${AVIFILE}" != "xtrue"; then
199  echo "* Couldn't compile the avifile test program."
200  echo "* Disabling avi2swf tool..."
201  echo all install uninstall clean: > avi2swf/Makefile
202  avi2swf=
203 fi
204
205 if test "x${DISABLE_LAME}" = "xtrue"; then
206     echo "*" Disabling lame support...
207     lame_objects= 
208 else
209     AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
210     lame_objects='$(lame_objects_2)'
211 fi
212 AC_SUBST(lame_objects)
213
214 if test "x${UNCOMPRESS}" = "xgzip"; then
215     AC_DEFINE_UNQUOTED(USE_GZIP, 1)
216 fi
217 AC_SUBST(USE_GZIP)
218
219 JPEG2SWF='jpeg2swf$(E)'
220 export JPEG2SWF
221 PNG2SWF='png2swf$(E)'
222 export PNG2SWF
223
224 if test "x" = "x"; then
225     pythonrfxswf="lib/python/Makefile"
226 else
227     echo all install uninstall clean: > lib/python/Makefile
228 fi
229
230 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
231   echo "***************************************************"
232   echo "The following headers/libraries are missing: " ${MISSINGLIBS}
233   if test "x${DISABLEPDF2SWF}" = "xtrue"; then
234     echo "Disabling pdf2swf tool..."
235     rm -f pdf2swf/Makefile
236     echo all install uninstall clean: > pdf2swf/Makefile
237   fi
238   if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
239     echo "Disabling jpeg2swf tool..."
240     JPEG2SWF=
241     export JPEG2SWF
242   fi
243   if test "x${DISABLEPNG2SWF}" = "xtrue"; then
244     echo "Disabling png2swf tool..."
245     PNG2SWF=
246     export PNG2SWF
247   fi
248   if test "x${ZLIBMISSING}" = "xtrue"; then
249     echo
250     echo "Warning! Without zlib, you will not be able to read"
251     echo "or write compressed Flash MX files!"
252   fi
253   echo "***************************************************"
254   FILES="./release Makefile.common ${avi2swf} Makefile lib/lame/Makefile lib/Makefile lib/action/Makefile src/Makefile swfs/Makefile ${pythonrfxswf}"
255 else
256   FILES="./release Makefile.common ${avi2swf} Makefile lib/lame/Makefile lib/Makefile lib/action/Makefile src/Makefile pdf2swf/Makefile pdf2swf/xpdf/Makefile pdf2swf/ttf2pt1/Makefile swfs/Makefile ${pythonrfxswf}"
257 fi
258 AC_SUBST(JPEG2SWF)
259 AC_SUBST(PNG2SWF)
260
261 dnl AC_OUTPUT(${FILES}) old autoconf
262 AC_CONFIG_FILES([${FILES}])
263 AC_OUTPUT
264
265 if test "x${srcdir}" != "x."; then
266     echo "Warning: --srcdir is not supported"
267 fi