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(chinese-gb, [ --enable-chinese-gb enable Chinese GB font support], OPTIONS="$OPTIONS -DCHINESE_GB_SUPPORT") AC_ARG_ENABLE(chinese-cns, [ --enable-chinese-cns enable Chinese CNS font support], OPTIONS="$OPTIONS -DCHINESE_CNS_SUPPORT") AC_ARG_ENABLE(no-text-select, [ --enable-no-text-select do not allow text selection], OPTIONS="$OPTIONS -DNO_TEXT_SELECT") AC_ARG_ENABLE(opi, [ --enable-opi include support for OPI comments], OPTIONS="$OPTIONS -DOPI_SUPPORT") 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 dnl ##### Default values for Unix. EXE="" LIBPREFIX="lib" AR="ar rc" UP_DIR="" 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" fi dnl ##### Check for DOS (with DJGPP). AC_CACHE_CHECK([for DOS (with DJGPP)], xpdf_cv_sys_dos, [AC_TRY_COMPILE([], [__DJGPP__], xpdf_cv_sys_dos=yes, xpdf_cv_sys_dos=no)]) if test "$xpdf_cv_sys_dos" = yes; then EXE=".exe" LIBPREFIX="lib" AR="ar -rc" UP_DIR="../" fi dnl ##### Do substitutions. AC_SUBST(EXE) AC_SUBST(LIBPREFIX) AC_SUBST(AR) AC_SUBST(UP_DIR) dnl ##### Checks for header files. AC_PATH_XTRA AC_HEADER_DIRENT dnl ##### Switch over to C++. This will make the checks below a little dnl ##### bit stricter (requiring function prototypes in include files). dnl ##### (99% of xpdf is written in C++.) AC_LANG_CPLUSPLUS dnl ##### Check for extra libraries needed by X. (LynxOS needs this.) AC_CHECK_FUNC(gethostbyname) if test $ac_cv_func_gethostbyname = no; then AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd") fi dnl ##### Look for header that defines select() and fd_set. AC_MSG_CHECKING([select() and fd_set in sys/select.h and sys/bsdtypes.h]) AC_TRY_COMPILE([#include #include #include #include ], [fd_set fds; select(0, NULL, NULL, NULL, NULL);], xpdf_ok=yes, xpdf_ok=no) if test $xpdf_ok = yes; then AC_MSG_RESULT([not needed]) else AC_TRY_COMPILE([#include #include #include #include #include ], [fd_set fds; select(0, NULL, NULL, NULL, NULL);], 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 #include #include #include ], [fd_set fds; select(0, NULL, NULL, NULL, NULL);], 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 # This should use 'AC_CHECK_FUNCS(mkstemp)' but that fails if dnl # the mkstemp exists in the library but isn't declared in the dnl # include file (e.g., in cygwin 1.1.2). AC_CACHE_CHECK([for mkstemp], xpdf_cv_func_mkstemp, [AC_TRY_LINK([#include #include ], [mkstemp("foo");], xpdf_cv_func_mkstemp=yes, xpdf_cv_func_mkstemp=no)]) if test "$xpdf_cv_func_mkstemp" = yes; then AC_DEFINE(HAVE_MKSTEMP) fi dnl ##### Check select argument type: on HP-UX before version 10, select dnl ##### takes (int *) instead of (fd_set *). AC_CACHE_CHECK([whether select takes fd_set arguments], xpdf_cv_func_select_arg, [AC_TRY_COMPILE([#include #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 dnl ##### Back to C for the library tests. AC_LANG_C dnl ##### Check for libXpm. if test -z "$no_x"; then smr_CHECK_LIB(Xpm, Xpm, [pixmap library, used only for icon], XpmCreatePixmapFromData, X11/xpm.h, $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS, $X_CFLAGS) AC_SUBST(Xpm_LIBS) AC_SUBST(Xpm_CFLAGS) fi dnl ##### Check for t1lib. if test -z "$no_x"; then smr_CHECK_LIB(t1, t1, [Type 1 font rasterizer], T1_InitLib, t1lib.h, $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm, $X_CFLAGS) AC_SUBST(t1_LIBS) AC_SUBST(t1_CFLAGS) fi dnl ##### Check for FreeType. if test -z "$no_x"; then smr_CHECK_LIB(freetype, ttf, [FreeType font rasterizer], TT_Init_FreeType, freetype/freetype.h, $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm, $X_CFLAGS) if test x"$freetype_LIBS" = x; then smr_CHECK_LIB(freetype, ttf, [FreeType font rasterizer], TT_Init_FreeType, freetype.h, $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS -lm, $X_CFLAGS) fi AC_SUBST(freetype_LIBS) AC_SUBST(freetype_CFLAGS) fi dnl ##### Disable X-specific stuff in top-level Makefile. if test -n "$no_x"; then X="#" XPDF_TARGET="all-no-x" else X="" XPDF_TARGET="all" fi AC_SUBST(X) AC_SUBST(XPDF_TARGET) 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, pdfinfo, and pdfimages, but not xpdf]) fi