1 dnl Process this file with autoconf to produce a configure script.
2 dnl Copyright 1998-2005 Glyph & Cog, LLC
5 AC_CONFIG_HEADER(aconf.h)
15 dnl ##### Optional features.
17 [ --enable-opi include support for OPI comments],
18 SERVER_OPTIONS="$SERVER_OPTIONS -DOPI_SUPPORT=1")
19 AC_ARG_ENABLE(wordlist,
20 [ --enable-wordlist include support for building word lists],
21 SERVER_OPTIONS="$SERVER_OPTIONS -DTEXTOUT_WORD_LIST=1")
23 AC_ARG_ENABLE(fixedpoint,
24 [ --enable-fixedpoint use fixed point (instead of floating point) arithmetic],
25 AC_DEFINE(USE_FIXEDPOINT))
26 [ --disable-client don't build the client],
27 if test "$enableval" = no; then
31 [ --disable-server don't build the server],
32 if test "$enableval" = no; then
36 [ --disable-plugin don't include the plugin in default targets],
37 if test "$enableval" = no; then
41 [ --with-cpu=x build the server for cpu x (x=603e,604e,...)],
42 SERVER_CPU="$withval")
43 AC_ARG_WITH(client-cpu,
44 [ --with-client-cpu=x build the client for cpu x (x=603e,604e,...)],
45 CLIENT_CPU="$withval")
46 AC_ARG_ENABLE(memdebug,
47 [ --enable-memdebug server memory management debugging],
48 SERVER_OPTIONS="$SERVER_OPTIONS -DDEBUGMEM -DDEBUG_MEM")
49 AC_ARG_ENABLE(custom-mem,
50 [ --disable-custom-mem don't use custom memory manager],
51 if test "$enableval" = no; then
52 SERVER_OPTIONS="$SERVER_OPTIONS -DNO_CUSTOM_MEM"
54 AC_SUBST(SERVER_OPTIONS)
55 AC_SUBST(CLIENT_OPTIONS)
58 dnl ##### Check for host.
63 echo "Building Apdf for MorphOS"
73 AC_MSG_ERROR(Building for AmigaOS no longer supported.)
77 AC_MSG_ERROR(Building for 680x0 no longer supported.)
82 CLIENT_CFLAGS="$CFLAGS -O2 -mcpu=$CLIENT_CPU -mmultiple -noixemul"
83 SERVER_CFLAGS="-O2 -mcpu=$SERVER_CPU -mmultiple -noixemul"
84 SERVER_CXXFLAGS="$SERVER_CFLAGS"
85 SERVER_CFLAGS="$CFLAGS $SERVER_CFLAGS"
86 if printenv CXXFLAGS; then
87 SERVER_CXXFLAGS="$CXXFLAGS $SERVER_CXXFLAGS"
89 SERVER_CXXFLAGS="$CFLAGS $SERVER_CXXFLAGS"
92 SERVER_LDFLAGS="$SERVER_LDFLAGS $LDFLAGS"
93 CLIENT_LDFLAGS="$CLIENT_LDFLAGS $LDFLAGS"
95 AC_SUBST(SERVER_CFLAGS)
96 AC_SUBST(SERVER_CXXFLAGS)
97 AC_SUBST(CLIENT_CFLAGS)
99 CLIENT_LDFLAGS="$LDFLAGS -noixemul"
100 SERVER_LDFLAGS="$LDFLAGS -noixemul"
102 AC_SUBST(CLIENT_LDFLAGS)
103 AC_SUBST(SERVER_LDFLAGS)
112 AC_SUBST(CLIENT_STRIP)
118 SERVER_RANLIB="ranlib"
123 AC_SUBST(SERVER_RANLIB)
124 AC_SUBST(SERVER_STRIP)
129 AC_SUBST(CLIENT_LIBS)
130 AC_SUBST(SERVER_LIBS)
139 if test "$BUILD_CLIENT"; then
140 echo Variables used for client:
142 echo STRIP= $CLIENT_STRIP
143 echo CFLAGS= $CLIENT_CFLAGS
144 echo LDFLAGS= $CLIENT_LDFLAGS
145 echo LIBS= $CLIENT_LIBS
146 dnl AC_MSG_CHECKING(Checking if the C compiler works)
148 dnl ac_link='${CLIENT_CC} -o conftest $CLIENT_CFLAGS $CLIENT_LDFLAGS conftest.$ac_ext $CLIENT_LIBS 1>&5'
149 dnl AC_TRY_LINK([#include <stdlib.h>],[exit(EXIT_SUCCESS);],tmp=yes,tmp=no)
150 dnl AC_MSG_RESULT($tmp)
151 dnl if test "$tmp" = no; then
152 dnl AC_MSG_ERROR(The client can not be built with the given options.)
156 if test "$BUILD_SERVER"; then
157 echo Variables used for server:
159 echo CXX= $SERVER_CXX
161 echo RANLIB= $SERVER_RANLIB
162 echo STRIP= $SERVER_STRIP
163 echo CFLAGS= $SERVER_CFLAGS
164 echo CXXFLAGS= $SERVER_CXXFLAGS
165 echo LDFLAGS= $SERVER_LDFLAGS
166 echo LIBS= $SERVER_LIBS
167 dnl AC_MSG_CHECKING(Checking if the C compiler works)
169 dnl ac_link='${SERVER_CC} -o conftest $SERVER_CFLAGS $SERVER_LDFLAGS conftest.$ac_ext $SERVER_LIBS 1>&5'
170 dnl AC_TRY_LINK([#include <stdlib.h>],[exit(EXIT_SUCCESS);],tmp=yes,tmp=no)
171 dnl AC_MSG_RESULT($tmp)
172 dnl if test "$tmp" = no; then
173 dnl AC_MSG_ERROR(The server can not be built with the given options.)
175 dnl AC_MSG_CHECKING(Checking if the C++ compiler works)
176 dnl AC_LANG_CPLUSPLUS
177 dnl ac_link='${SERVER_CXX} -o conftest $SERVER_CXXFLAGS $SERVER_LDFLAGS conftest.$ac_ext $SERVER_LIBS 1>&5'
178 dnl AC_TRY_LINK([#include <stdlib.h>],[exit(EXIT_SUCCESS);],tmp=yes,tmp=no)
179 dnl AC_MSG_RESULT($tmp)
180 dnl if test "$tmp" = no; then
181 dnl AC_MSG_ERROR(The server can not be built with the given options.)
186 dnl ##### Client defines
187 CLIENT_DEFS="-DMORPHOS"
188 AC_SUBST(CLIENT_DEFS)
190 dnl ##### Server defines
192 dnl if test "$BUILD_SERVER" = yes; then
194 dnl CFLAGS="$SERVER_FLAGS"
195 dnl OPTIONS="$SERVER_OPTIONS"
197 dnl ac_link='${SERVER_CC} -o conftest $SERVER_CFLAGS $SERVER_LDFLAGS conftest.$ac_ext $SERVER_LIBS 1>&5; chmod 744 conftest'
199 dnl dnl ##### Check for broken atoi()
200 dnl AC_CACHE_CHECK([whether atoi() is buggy],
201 dnl apdf_cv_func_atoi_broken,
203 dnl #include <stdlib.h>
205 dnl exit(atoi("010")!=10);
207 dnl ],apdf_cv_func_atoi_broken=no,apdf_cv_func_atoi_broken=yes,
208 dnl apdf_cv_func_atoi_broken=no))
209 dnl if test "$apdf_cv_func_atoi_broken" = yes; then
210 dnl SERVER_DEFS="$SERVER_DEFS -DBUGGY_ATOI"
213 dnl dnl ##### Check for broken __divdi3()
214 dnl AC_CACHE_CHECK([whether long long division is buggy],
215 dnl apdf_cv_func_divdi3_broken,
217 dnl #include <stdlib.h>
218 dnl long long f(long long x,long long y);
220 dnl exit(f(0x100000000LL,0x1000000)!=256);
222 dnl long long f(long long x,long long y) {
225 dnl ],apdf_cv_func_divdi3_broken=no,apdf_cv_func_divdi3_broken=yes,apdf_cv_func_divdi3_broken=no))
226 dnl if test "$apdf_cv_func_divdi3_broken" = yes; then
227 dnl SERVER_DEFS="$SERVER_DEFS -DBUGGY_DIVDI3"
230 dnl dnl ##### Check for broken long long >> 16
231 dnl AC_CACHE_CHECK([whether long long right shift is buggy],
232 dnl apdf_cv_func_llrsh16_broken,
234 dnl #include <stdlib.h>
235 dnl long long f(long long x);
237 dnl exit(f(-1ll)!=-1ll);
239 dnl long long f(long long x) {
242 dnl ],apdf_cv_func_llrsh16_broken=no,apdf_cv_func_llrsh16_broken=yes,apdf_cv_func_llrsh16_broken=no))
243 dnl if test "$apdf_cv_func_llrsh16_broken" = yes; then
244 dnl SERVER_DEFS="$SERVER_DEFS -DBUGGY_LONGLONGRSHIFT16"
248 AC_SUBST(SERVER_DEFS)
251 dnl ##### Build CPU dependent names
252 ARCHIVE="Apdf_$SERVER_CPU"
253 if printenv ARCHIVENAME; then
254 ARCHIVE="$ARCHIVENAME"
256 ARCHIVE="${ARCHIVE}.lha"
261 if printenv PROCNAME; then
280 dnl if test "$BUILD_PLUGIN" = yes; then
281 dnl APDF_TARGETS="$APDF_TARGETS $VPDF $VPDF2"
283 AC_SUBST(APDF_TARGETS)
285 dnl ##### Write the makefiles.
286 MAKEFILES="Makefile server/version.cc"
288 if test "$BUILD_CLIENT"=yes; then
289 MAKEFILES="$MAKEFILES apdf/Makefile"
290 TARGETS="$TARGETS client"
292 if test "$BUILD_SERVER"=yes; then
293 MAKEFILES="$MAKEFILES server/Makefile xpdf/Makefile goo/Makefile fofi/Makefile freetype2/Makefile"
294 TARGETS="$TARGETS server"
298 AC_OUTPUT($MAKEFILES)
300 echo >apdf/Makefile.dep
301 echo >goo/Makefile.dep
302 echo >freetype2/Makefile.dep
303 echo >xpdf/Makefile.dep
304 echo >server/Makefile.dep
305 echo >fofi/Makefile.dep