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