moved python checks into m4/python.m4.
[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 SLEXT="so"
90 if test "x${MINGW}" != "xyes"; then
91     # no mingW
92     AC_DEFINE_UNQUOTED(O_BINARY, 0)
93 else
94     # mingW
95     SLEXT="dll"
96 fi
97 export SLEXT
98 AC_SUBST(SLEXT)
99
100 # The following tries to make use of includes and libraries in
101 # /usr/local, too. Notice: A -I/usr/local/include might break
102 # things (MingW, cross-compiling etc.) in the same way as -I/usr/include, 
103 # especially on systems which link /usr/local to /usr, so it has yet
104 # to be seen how useful this is.
105 if test -d /usr/local/lib; then
106     LDFLAGS="$LDFLAGS -L/usr/local/lib"
107 fi
108 if test -d /usr/local/include; then
109 # Leave that alone. It's causing trouble e.g. with gcc 3.2 on gentoo.
110 #   CPPFLAGS="$CPPFLAGS -I/usr/local/include"
111     echo > /dev/null
112 fi
113 if test "$prefix" != "NONE" -a "$prefix" != "/usr/local" -a "$prefix" != "/usr/local/"; then
114     # if the user has a special prefix (like /opt), there might also be $prefix/lib
115     # and $prefix/include, which should be included in our search paths for libraries
116     # and includes.
117     LDFLAGS="$LDFLAGS -L${libdir}"
118     CPPFLAGS="$CPPFLAGS -I${includedir}"
119     # TODO- test whether gcc still works after this
120 fi
121
122 # this must be done after (I believe) AC_PROG_MAKE_SET
123 if test "x$DEBUG" '!=' "x";then
124     STRIP="@echo debug enabled, not stripping "
125     export STRIP
126     AC_SUBST(STRIP)
127 fi
128
129 dnl Checks for libraries.
130  AC_CHECK_LIB(m, sin,, 
131  echo "Error: Math library not found.";
132  exit;
133  )
134  AC_CHECK_LIB(z, deflate,, 
135  DISABLEPNG2SWF=true;
136  MISSINGLIBS="${MISSINGLIBS} zlib"
137  ZLIBMISSING=true;
138  )
139  AC_CHECK_LIB(jpeg, jpeg_write_raw_data,, 
140  DISABLEPDF2SWF=true;
141  DISABLEJPEG2SWF=true;
142  MISSINGLIBS="${MISSINGLIBS} jpeglib"
143  )
144  AC_CHECK_LIB(t1, T1_LoadFont,,
145  DISABLEPDF2SWF=true;
146  MISSINGLIBS="${MISSINGLIBS} t1lib"
147  )
148
149 RFX_CHECK_FREETYPE
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 if test "x${ac_cv_header_jpeglib_h}" != "xyes"; then
165  DISABLEPDF2SWF=true;
166  DISABLEJPEG2SWF=true;
167  MISSINGLIBS="${MISSINGLIBS} jpeglib.h"
168 fi
169 if test "x${ac_cv_header_t1lib_h}" != "xyes"; then
170  DISABLEPDF2SWF=true;
171  MISSINGLIBS="${MISSINGLIBS} t1lib.h"
172 fi
173 if test "x${ac_cv_header_zlib_h}" != "xyes"; then
174  DISABLEPNG2SWF=true;
175  MISSINGLIBS="${MISSINGLIBS} zlib.h"
176  ZLIBMISSING=true;
177 fi
178
179 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
180 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
181 AC_SUBST(PACKAGE)
182 AC_SUBST(VERSION)
183
184 AC_SUBST(HAVE_UNISTD_H)
185 AC_SUBST(EXEEXT)
186
187 dnl Checks for typedefs, structures, and compiler characteristics.
188  AC_C_CONST
189  AC_C_INLINE
190  AC_TYPE_OFF_T
191  AC_TYPE_SIZE_T
192  AC_STRUCT_TM
193  AC_CHECK_TYPE(boolean,int)
194  AC_CHECK_TYPE(bool,char)
195  dnl AC_CHECK_TYPE(uchar,unsigned char)
196  dnl AC_CHECK_TYPE(schar,signed char)
197  dnl AC_CHECK_TYPE(word,unsigned short int)
198  dnl AC_CHECK_TYPE(sword,unsigned short int)
199  dnl AC_CHECK_TYPE(uint,unsigned long int)
200
201 dnl Checks for library functions.
202  AC_CHECK_FUNCS(popen mkstemp stat lrand48 rand srand48 srand bcopy bzero time)
203
204 # ------------------------------------------------------------------
205  
206 RFX_CHECK_AVI2SWF
207
208 avi2swf="avi2swf/Makefile"
209 if test "x${AVIFILE}" != "xtrue"; then
210  echo "* Couldn't compile the avifile test program."
211  echo "* Disabling avi2swf tool..."
212  echo all install uninstall clean: > avi2swf/Makefile
213  avi2swf=
214 fi
215
216 # ------------------------------------------------------------------
217
218 if test "x${UNCOMPRESS}" = "xgzip"; then
219     AC_DEFINE_UNQUOTED(USE_GZIP, 1)
220 fi
221 AC_SUBST(USE_GZIP)
222
223 # ------------------------------------------------------------------
224
225 if test "x${DISABLE_LAME}" = "xtrue"; then
226     echo "*" Disabling lame support...
227     lame_objects= 
228 else
229     AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
230     lame_objects='$(lame_objects_2)'
231 fi
232 AC_SUBST(lame_objects)
233
234 # ------------------------------------------------------------------
235
236 RFX_CHECK_PYTHON
237
238 if test "x$PYTHON_OK" '!=' "xyes";then
239     echo all install uninstall clean: > lib/python/Makefile
240     echo "* No usable python installation found"
241     echo "* Not compiling the python interface"
242 fi
243
244 # ------------------------------------------------------------------
245
246 JPEG2SWF='jpeg2swf$(E)'
247 export JPEG2SWF
248 PNG2SWF='png2swf$(E)'
249 export PNG2SWF
250
251 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
252   echo "***************************************************"
253   echo "The following headers/libraries are missing: " ${MISSINGLIBS}
254   if test "x${DISABLEPDF2SWF}" = "xtrue"; then
255     echo "Disabling pdf2swf tool..."
256     rm -f pdf2swf/Makefile
257     echo all install uninstall clean: > pdf2swf/Makefile
258   fi
259   if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
260     echo "Disabling jpeg2swf tool..."
261     JPEG2SWF=
262     export JPEG2SWF
263   fi
264   if test "x${DISABLEPNG2SWF}" = "xtrue"; then
265     echo "Disabling png2swf tool..."
266     PNG2SWF=
267     export PNG2SWF
268   fi
269   if test "x${ZLIBMISSING}" = "xtrue"; then
270     echo
271     echo "Warning! Without zlib, you will not be able to read"
272     echo "or write compressed Flash MX files!"
273   fi
274   echo "***************************************************"
275   FILES="./release Makefile.common ${avi2swf} Makefile lib/lame/Makefile lib/Makefile lib/action/Makefile src/Makefile swfs/Makefile ${pythonrfxswf}"
276 else
277   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}"
278 fi
279 AC_SUBST(JPEG2SWF)
280 AC_SUBST(PNG2SWF)
281
282 dnl AC_OUTPUT(${FILES}) old autoconf
283 AC_CONFIG_FILES([${FILES}])
284 AC_OUTPUT
285
286 if test "x${srcdir}" != "x."; then
287     echo "Warning: --srcdir is not supported"
288 fi