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