dnl Process this file with autoconf to produce a configure script. AC_INIT(apdf/apdf.c) dnl ##### Optional features. SERVER_OPTIONS="" CLIENT_OPTIONS="" BUILD_CLIENT="yes" BUILD_SERVER="yes" CLIENT_CPU="68020" SERVER_CPU="68020" SERVER_FPU="" AC_ARG_ENABLE(client, [ --disable-client don't build the client], if test "$enableval" = "no"; then BUILD_CLIENT="no" fi) AC_ARG_ENABLE(server, [ --disable-server don't build the server], if test "$enableval" = no; then BUILD_SERVER="no" fi) AC_ARG_WITH(cpu, [ --with-cpu=x build the server for cpu x (x=68000,...,68060,603e,604e)], SERVER_CPU="$withval") AC_ARG_ENABLE(fpu, [ --enable-fpu build a server that uses the fpu (68k only)], if test "$enableval" != no; then SERVER_FPU="yes" fi) AC_ARG_WITH(client-cpu, [ --with-client-cpu=x build the client for cpu x (x=68000,...,68060)], CLIENT_CPU="$withval") AC_ARG_ENABLE(memdebug, [ --enable-memdebug server memory management debugging], SERVER_OPTIONS="$SERVER_OPTIONS -DDEBUGMEM") AC_ARG_ENABLE(custom-mem, [ --disable-custom-mem don't use custom memory manager], if test "$enableval" = no; then SERVER_OPTIONS="$SERVER_OPTIONS -DNO_CUSTOM_MEM" fi) AC_SUBST(SERVER_OPTIONS) AC_SUBST(CLIENT_OPTIONS) dnl ##### If CFLAGS is not set, build one according to CPU. SERVER_CFLAGS="" CLIENT_CFLAGS="" POWERUP="no" if printenv CFLAGS; then CLIENT_CFLAGS="$CFLAGS" SERVER_CFLAGS="$CFLAGS" fi if test -z "$SERVER_CFLAGS"; then if expr match "$SERVER_CPU" "680*0"; then SERVER_CFLAGS="-O2 -m$SERVER_CPU -fomit-frame-pointer -noixemul" if test "$SERVER_FPU" = "yes"; then SERVER_CFLAGS="$SERVER_CFLAGS -m68881" fi else POWERUP="yes" SERVER_CFLAGS="-O2 -mcpu=$SERVER_CPU -mmultiple" fi fi if test -z "$CLIENT_CFLAGS"; then CLIENT_CFLAGS="-O2 -m$CLIENT_CPU -fomit-frame-pointer -noixemul" fi SERVER_CXXFLAGS="" CLIENT_CXXFLAGS="" if printenv CXXFLAGS; then SERVER_CXXFLAGS="$CXXFLAGS" CLIENT_CXXFLAGS="$CXXFLAGS" else SERVER_CXXFLAGS="$SERVER_CFLAGS" CLIENT_CXXFLAGS="$CLIENT_CFLAGS" fi SERVER_LDFLAGS="" CLIENT_LDFLAGS="" if printenv LDFLAGS; then SERVER_LDFLAGS="$LDFLAGS" CLIENT_LDFLAGS="$LDFLAGS" fi if test "$POWERUP" = yes; then SERVER_CFLAGS="$SERVER_CFLAGS -DPOWERUP" SERVER_CXXFLAGS="$SERVER_CXXFLAGS -DPOWERUP" fi AC_SUBST(SERVER_CFLAGS) AC_SUBST(SERVER_CXXFLAGS) AC_SUBST(SERVER_LDFLAGS) AC_SUBST(SERVER_LIBS) AC_SUBST(CLIENT_CFLAGS) AC_SUBST(CLIENT_LDFLAGS) AC_SUBST(CLIENT_LIBS) dnl ##### Checks for programs. SCC="" CCC="" tmp="$CC" if test -z "$tmp"; then tmp="gcc" fi CC="$tmp" tmp="$CCPPC" if test -z "$tmp"; then tmp="ppc-amigaos-gcc" fi CCPPC="$tmp" if printenv SERVER_CC; then SCC="$SERVER_CC" else if test "$POWERUP" = yes; then SCC="$CCPPC" else SCC="$CC" fi fi SERVER_CC="$SCC" if printenv CLIENT_CC; then CCC="$CLIENT_CC" else CCC="$CC" fi SERVER_CC="$SCC" SERVER_CXX="$SCC" CLIENT_CC="$CCC" AC_SUBST(SERVER_CC) AC_SUBST(SERVER_CXX) AC_SUBST(CLIENT_CC) dnl ##### Default values for Amiga. EXE="" LIBPREFIX="lib" UP_DIR="" CLIENT_STRIP="strip" if test "$POWERUP" = "yes"; then SERVER_AR="ppc-amigaos-ar rc" SERVER_RANLIB="ppc-amigaos-ranlib" SERVER_STRIP="echo" else SERVER_AR="ar rc" AC_PROG_RANLIB SERVER_RANLIB="$RANLIB" SERVER_STRIP="strip" fi dnl ##### Do substitutions. AC_SUBST(EXE) AC_SUBST(LIBPREFIX) AC_SUBST(SERVER_AR) AC_SUBST(SERVER_RANLIB) AC_SUBST(SERVER_STRIP) AC_SUBST(CLIENT_STRIP) AC_SUBST(UP_DIR) if test 0 -eq 1; then dnl ##### Checks for header files. AC_HEADER_DIRENT dnl ##### Look for header that defines fd_set. AC_MSG_CHECKING([fd_set and sys/select.h or sys/bsdtypes.h]) AC_TRY_COMPILE([#include ], [fd_set fds;], xpdf_ok=yes, xpdf_ok=no) if test $xpdf_ok = yes; then AC_MSG_RESULT([not needed]) else AC_TRY_COMPILE([#include #include ], [fd_set fds;], xpdf_ok=yes, xpdf_ok=no) if test $xpdf_ok = yes; then AC_DEFINE(HAVE_SYS_SELECT_H) AC_MSG_RESULT([need sys/select.h]) else AC_TRY_COMPILE([#include #include ], [fd_set fds;], xpdf_ok=yes, xpdf_ok=no) if test $xpdf_ok = yes; then AC_DEFINE(HAVE_SYS_BSDTYPES_H) AC_MSG_RESULT([need sys/bsdtypes.h]) else AC_MSG_RESULT([problem]) fi fi fi dnl ##### Look for header that defines FD_ZERO. AC_MSG_CHECKING([FD_ZERO and strings.h or bstring.h]) AC_TRY_COMPILE([#include #ifdef HAVE_SYS_SELECT_H #include #endif], [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no) if test $xpdf_ok = yes; then AC_MSG_RESULT([not needed]) else AC_TRY_COMPILE([#include #include #ifdef HAVE_SYS_SELECT_H #include #endif], [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no) if test $xpdf_ok = yes; then AC_DEFINE(HAVE_STRINGS_H) AC_MSG_RESULT([need strings.h]) else AC_TRY_COMPILE([#include #include #ifdef HAVE_SYS_SELECT_H #include #endif], [fd_set fds; FD_ZERO(&fds);], xpdf_ok=yes, xpdf_ok=no) if test $xpdf_ok = yes; then AC_DEFINE(HAVE_BSTRING_H) AC_MSG_RESULT([need bstring.h]) else AC_MSG_RESULT([problem]) fi fi fi dnl ##### Look for rewinddir. AC_CHECK_FUNCS(rewinddir) if test $ac_cv_func_rewinddir = no; then AC_CHECK_LIB(cposix, rewinddir) fi dnl ##### Checks for library functions. AC_CHECK_FUNCS(popen) dnl ##### Check select argument type: on HP-UX before version 10, select dnl ##### takes (int *) instead of (fd_set *). AC_LANG_CPLUSPLUS AC_CACHE_CHECK([whether select takes fd_set arguments], xpdf_cv_func_select_arg, [AC_TRY_COMPILE([#include #include #ifdef HAVE_SYS_SELECT_H #include #endif], [fd_set fds; select(1, &fds, &fds, &fds, 0);], xpdf_cv_func_select_arg=yes, xpdf_cv_func_select_arg=no)]) if test "$xpdf_cv_func_select_arg" != yes; then AC_DEFINE(SELECT_TAKES_INT) fi AC_LANG_C fi dnl ##### Client defines CLIENT_DEFS="" if test "$BUILD_CLIENT" = yes; then CC="$CLIENT_CC" CFLAGS="$CLIENT_FLAGS" OPTIONS="$CLIENT_OPTIONS" dnl ##### Look for mui/Listtree_mcc.h AC_CACHE_CHECK([mui/Listtree_mcc.h], apdf_listtree, [AC_CHECK_HEADER(mui/Listtree_mcc.h, apdf_listtree=yes,apdf_listtree=no)]) if test "$apdf_listtree" = yes; then CLIENT_DEFS="$CLIENT_DEFS -DHAVE_MUI_LISTTREE_H" else AC_MSG_WARN([no : the outlines window will not be available]) fi dnl ##### Look for the PowerUp developer kit AC_CACHE_CHECK([powerup/ppclib/ppc.h], apdf_powerupppclib, [AC_CHECK_HEADER(powerup/ppclib/ppc.h, apdf_powerupppclib=yes,apdf_powerupppclib=no)]) if test "$apdf_powerupppclib" = yes; then CLIENT_DEFS="$CLIENT_DEFS -DHAVE_POWERUP" dnl else dnl AC_CACHE_CHECK([ppclib/ppc.h], dnl apdf_ppclib, dnl [AC_CHECK_HEADER(ppclib/ppc.h, dnl apdf_ppclib=yes,apdf_ppclib=no)]) dnl if test "$apdf_ppclib" = yes; then dnl CLIENT_DEFS="$CLIENT_DEFS -DHAVE_POWERUP" dnl fi fi dnl ##### cybergraphics or cybergfx ? AC_CACHE_CHECK([cybergraphics/cybergraphics.h], apdf_cybergraphics, [AC_CHECK_HEADER(cybergraphics/cybergraphics.h, apdf_cybergraphics=yes,apdf_cybergraphics=no)]) if test "$apdf_cybergraphics" = yes; then CLIENT_DEFS="$CLIENT_DEFS -DHAVE_CYBERGRAPHICS_CYBERGRAPHICS_H" else AC_CACHE_CHECK([cybergraphx/cybergraphics.h], apdf_cybergraphx, [AC_CHECK_HEADER(cybergraphx/cybergraphics.h, apdf_cybergraphx=yes,apdf_cybergraphx=no)]) if test "$apdf_cybergraphx" = yes; then CLIENT_DEFS="$CLIENT_DEFS -DHAVE_CYBERGRAPHX_CYBERGRAPHICS_H" else AC_MSG_WARN([No cybergraphics includes: won't take advantage of Hi/TrueColor screens]) fi fi fi AC_SUBST(CLIENT_DEFS) dnl ##### Server defines SERVER_DEFS="" if test "$BUILD_SERVER" = yes; then CC="$SERVER_CC" CFLAGS="$SERVER_FLAGS" OPTIONS="$SERVER_OPTIONS" dnl ##### Check for broken atoi() AC_CACHE_CHECK([whether atoi() is buggy], apdf_cv_func_atoi_broken, [old_ac_link="$ac_link" if test "$POWERUP" = yes; then ac_link="$ac_link; chmod 744 conftest" fi AC_TRY_RUN([ #include int main() { exit(atoi("010")!=10); } ],apdf_cv_func_atoi_broken=no,apdf_cv_func_atoi_broken=yes, apdf_cv_func_atoi_broken=no) ac_link="$old_ac_link"]) if test "$apdf_cv_func_atoi_broken" = yes; then SERVER_DEFS="$SERVER_DEFS -DBUGGY_ATOI" fi dnl ##### Check for broken strncpy() AC_CACHE_CHECK([whether strncpy() is buggy], apdf_cv_func_strncpy_broken, [old_ac_link="$ac_link" if test "$POWERUP" = yes; then ac_link="$ac_link; chmod 744 conftest" fi AC_TRY_RUN([ #include int main() { char buf[16]; memset(buf,1,sizeof(buf)); strncpy(buf,"0123456789ab",13); exit(buf[13]!=1); } ],apdf_cv_func_strncpy_broken=no,apdf_cv_func_strncpy_broken=yes, apdf_cv_func_strncpy_broken=no) ac_link="$old_ac_link"]) if test "$apdf_cv_func_strncpy_broken" = yes; then SERVER_DEFS="$SERVER_DEFS -DBUGGY_STRNCPY" fi dnl ##### Check for broken __divdi3() AC_CACHE_CHECK([whether long long division is buggy], apdf_cv_func_divdi3_broken, [old_ac_link="$ac_link" if test "$POWERUP" = yes; then ac_link="$ac_link; chmod 744 conftest" fi AC_TRY_RUN([ #include long long f(long long x,long long y); int main() { exit(f(0x100000000LL,0x1000000)!=256); } long long f(long long x,long long y) { return x/y; } ],apdf_cv_func_divdi3_broken=no,apdf_cv_func_divdi3_broken=yes,apdf_cv_func_divdi3_broken=no) ac_link="$old_ac_link"]) if test "$apdf_cv_func_divdi3_broken" = yes; then SERVER_DEFS="$SERVER_DEFS -DBUGGY_DIVDI3" fi dnl ##### Check for broken long long >> 16 AC_CACHE_CHECK([whether long long right shift is buggy], apdf_cv_func_llrsh16_broken, [old_ac_link="$ac_link" if test "$POWERUP" = yes; then ac_link="$ac_link; chmod 744 conftest" fi AC_TRY_RUN([ #include long long f(long long x); int main() { exit(f(-1ll)==-1ll); } long long f(long long x) { return x>>16; } ],apdf_cv_func_llrsh16_broken=no,apdf_cv_func_llrsh16_broken=yes,apdf_cv_func_llrsh16_broken=no) ac_link="$old_ac_link"]) if test "$apdf_cv_func_llrsh16_broken" = yes; then SERVER_DEFS="$SERVER_DEFS -DBUGGY_LONGLONGRSHIFT16" fi fi AC_SUBST(SERVER_DEFS) dnl ##### Build CPU dependent names ARCHIVE="Apdf_$SERVER_CPU" if printenv ARCHIVENAME; then ARCHIVE="$ARCHIVENAME" else if test "$SERVER_FPU" = "yes"; then ARCHIVE="${ARCHIVE}fpu" fi ARCHIVE="${ARCHIVE}.lha" fi AC_SUBST(ARCHIVE) APDFMOD="Apdf_$SERVER_CPU" if printenv APDFMODNAME; then APDFMOD="$APDFMODNAME" else if test "$SERVER_FPU" = "yes"; then APDFMOD="${APDFMOD}fpu" fi APDFMOD="${APDFMOD}.module" fi AC_SUBST(APDFMOD) VPDFMOD="Vpdf_$SERVER_CPU" if printenv VPDFMODNAME; then VPDFMOD="$VPDFMODNAME" else if test "$SERVER_FPU" = "yes"; then VPDFMOD="${VPDFMOD}fpu" fi VPDFMOD="${VPDFMOD}.module" fi AC_SUBST(VPDFMOD) if test "$POWERUP" = "yes"; then VEROBJS="serverppc.o" SERVER_LDFLAGS="$SERVER_LDFLAGS -Xlinker --script -Xlinker \$(srcdir)/myelf32ppc" SERVER_DEFS="$SERVER_DEFS -DBUGGY_STATIC_CTORS" else VEROBJS="server68k.o" fi AC_SUBST(VEROBJS) dnl ##### Write the makefiles. MAKEFILES="Makefile server/version.cc" TARGETS="" if test "$BUILD_CLIENT"="yes"; then MAKEFILES="$MAKEFILES apdf/Makefile" TARGETS="$TARGETS client" fi if test "$BUILD_SERVER"="yes"; then MAKEFILES="$MAKEFILES server/Makefile xpdf/Makefile goo/Makefile type1/Makefile freetype/Makefile" TARGETS="$TARGETS server" fi AC_SUBST(TARGETS) AC_OUTPUT($MAKEFILES)