dnl Process this file with autoconf to produce a configure script. AC_INIT(xpdf/xpdf.cc) dnl ##### Optional features. OPTIONS="" AC_ARG_ENABLE(a4-paper, [ --enable-a4-paper use A4 paper size instead of Letter for PostScript output], OPTIONS="$OPTIONS -DA4_PAPER") AC_ARG_ENABLE(japanese, [ --enable-japanese enable Japanese font support], OPTIONS="$OPTIONS -DJAPANESE_SUPPORT") AC_ARG_ENABLE(no-text-select, [ --enable-no-text-select do not allow text selection], OPTIONS="$OPTIONS -DNO_TEXT_SELECT") AC_ARG_WITH(gzip, [ --with-gzip use gzip instead of uncompress], OPTIONS="$OPTIONS -DUSE_GZIP") AC_SUBST(OPTIONS) dnl ##### Checks for programs. AC_PROG_CC AC_ISC_POSIX AM_PROG_CC_STDC #if test -z "$CXX" -a "$CC" = "gcc"; then # CXX="gcc" #fi AC_PROG_CXX AC_PROG_INSTALL AC_PROG_RANLIB AC_CHECK_PROG(STRIP, strip, strip, :) dnl ##### Check for OS/2. AC_CACHE_CHECK([for OS/2 (with EMX)], xpdf_cv_sys_os2, [AC_TRY_COMPILE([], [__EMX__], xpdf_cv_sys_os2=yes, xpdf_cv_sys_os2=no)]) if test "$xpdf_cv_sys_os2" = yes; then EXE=".exe" LIBPREFIX="" AR="ar -rc" else EXE="" LIBPREFIX="lib" AR="ar rc" fi AC_SUBST(EXE) AC_SUBST(LIBPREFIX) AC_SUBST(AR) dnl ##### Checks for header files. AC_PATH_XTRA 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 dnl ##### Check for libXpm. smr_CHECK_LIB(Xpm, Xpm, [pixmap library, used only for icon], XpmCreatePixmapFromData, X11/xpm.h, $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS) AC_SUBST(Xpm_LIBS) AC_SUBST(Xpm_CFLAGS) dnl ##### Write the makefiles. AC_OUTPUT(Makefile xpdf/Makefile ltk/Makefile goo/Makefile) dnl ##### Warn user if X is missing. if test -n "$no_x"; then AC_MSG_WARN([Couldn't find X -- you will be able to compile pdftops, pdftotext, and pdfinfo, but not xpdf]) fi