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