fixed python search log output.
[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  RFX_CHECK_AVI2SWF
204
205 avi2swf="avi2swf/Makefile"
206 if test "x${AVIFILE}" != "xtrue"; then
207  echo "* Couldn't compile the avifile test program."
208  echo "* Disabling avi2swf tool..."
209  echo all install uninstall clean: > avi2swf/Makefile
210  avi2swf=
211 fi
212
213 if test "x${DISABLE_LAME}" = "xtrue"; then
214     echo "*" Disabling lame support...
215     lame_objects= 
216 else
217     AC_DEFINE_UNQUOTED(HAVE_LAME, 1)
218     lame_objects='$(lame_objects_2)'
219 fi
220 AC_SUBST(lame_objects)
221
222 if test "x${UNCOMPRESS}" = "xgzip"; then
223     AC_DEFINE_UNQUOTED(USE_GZIP, 1)
224 fi
225 AC_SUBST(USE_GZIP)
226
227 JPEG2SWF='jpeg2swf$(E)'
228 export JPEG2SWF
229 PNG2SWF='png2swf$(E)'
230 export PNG2SWF
231
232 # ------------------------------------------------------------------
233
234 AC_MSG_CHECKING([for Python.h and PIL])
235 # should we support python versions below 2.2?
236 if test -f "/usr/lib/python2.2/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.2/Python.h";then
237     PY_VERSION=2.2
238 fi
239 if test -f "/usr/lib/python2.3/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.3/Python.h";then
240     PY_VERSION=2.3
241 fi
242 if test -f "/usr/lib/python2.4/site-packages/PIL/_imaging.so" -a -f "/usr/include/python2.4/Python.h";then
243     PY_VERSION=2.4
244 fi
245
246 if test "x$PY_VERSION" "!=" "x"; then
247     pythonrfxswf="lib/python/Makefile"
248     if test "x$PYTHON_LIB" = "x";then
249         PYTHON_LIB="-lpython$PY_VERSION /usr/lib/python$PY_VERSION/site-packages/PIL/_imaging.so"
250     fi
251     if test "x$PYTHON_INCLUDES" = "x";then
252         PYTHON_INCLUDES="-I/usr/include/python$PY_VERSION"
253     fi
254     export PYTHON_INCLUDES PYTHON_LIB
255     AC_SUBST(PYTHON_LIB)
256     AC_SUBST(PYTHON_INCLUDES)
257     AC_MSG_RESULT(yes)
258 else
259     echo all install uninstall clean: > lib/python/Makefile
260     AC_MSG_RESULT(nope)
261     echo "* No usable python installation found"
262     echo "* Not compiling the python interface"
263 fi
264
265 # ------------------------------------------------------------------
266
267 if test "x${DISABLEPDF2SWF}" = "xtrue"; then
268   echo "***************************************************"
269   echo "The following headers/libraries are missing: " ${MISSINGLIBS}
270   if test "x${DISABLEPDF2SWF}" = "xtrue"; then
271     echo "Disabling pdf2swf tool..."
272     rm -f pdf2swf/Makefile
273     echo all install uninstall clean: > pdf2swf/Makefile
274   fi
275   if test "x${DISABLEJPEG2SWF}" = "xtrue"; then
276     echo "Disabling jpeg2swf tool..."
277     JPEG2SWF=
278     export JPEG2SWF
279   fi
280   if test "x${DISABLEPNG2SWF}" = "xtrue"; then
281     echo "Disabling png2swf tool..."
282     PNG2SWF=
283     export PNG2SWF
284   fi
285   if test "x${ZLIBMISSING}" = "xtrue"; then
286     echo
287     echo "Warning! Without zlib, you will not be able to read"
288     echo "or write compressed Flash MX files!"
289   fi
290   echo "***************************************************"
291   FILES="./release Makefile.common ${avi2swf} Makefile lib/lame/Makefile lib/Makefile lib/action/Makefile src/Makefile swfs/Makefile ${pythonrfxswf}"
292 else
293   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}"
294 fi
295 AC_SUBST(JPEG2SWF)
296 AC_SUBST(PNG2SWF)
297
298 dnl AC_OUTPUT(${FILES}) old autoconf
299 AC_CONFIG_FILES([${FILES}])
300 AC_OUTPUT
301
302 if test "x${srcdir}" != "x."; then
303     echo "Warning: --srcdir is not supported"
304 fi