You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
354 lines
10 KiB
354 lines
10 KiB
14 years ago
|
dnl Process this file with autoconf to produce a configure script.
|
||
|
dnl Copyright 1998-2005 Glyph & Cog, LLC
|
||
|
|
||
|
AC_PREREQ(2.57)
|
||
|
|
||
|
AC_INIT(xpdf/xpdf.cc)
|
||
|
AC_CONFIG_HEADER(aconf.h)
|
||
|
|
||
|
dnl ##### Optional features.
|
||
|
AC_ARG_ENABLE(a4-paper,
|
||
|
[ --enable-a4-paper use A4 paper size instead of Letter for
|
||
|
PostScript output],
|
||
|
AC_DEFINE(A4_PAPER))
|
||
|
AC_ARG_ENABLE(no-text-select,
|
||
|
[ --enable-no-text-select do not allow text selection],
|
||
|
AC_DEFINE(NO_TEXT_SELECT))
|
||
|
AC_ARG_ENABLE(opi,
|
||
|
[ --enable-opi include support for OPI comments],
|
||
|
AC_DEFINE(OPI_SUPPORT))
|
||
|
AC_ARG_ENABLE(multithreaded,
|
||
|
[ --enable-multithreaded include support for multithreading],
|
||
|
AC_DEFINE(MULTITHREADED))
|
||
|
AC_ARG_ENABLE(exceptions,
|
||
|
[ --enable-exceptions use C++ exceptions],
|
||
|
AC_DEFINE(USE_EXCEPTIONS))
|
||
|
AC_ARG_ENABLE(wordlist,
|
||
|
[ --enable-wordlist include support for building word lists],
|
||
|
AC_DEFINE(TEXTOUT_WORD_LIST))
|
||
|
AC_ARG_ENABLE(fixedpoint,
|
||
|
[ --enable-fixedpoint use fixed point (instead of floating point) arithmetic],
|
||
|
AC_DEFINE(USE_FIXEDPOINT))
|
||
|
AC_ARG_ENABLE(cmyk,
|
||
|
[ --enable-cmyk include support for CMYK rasterization],
|
||
|
AC_DEFINE(SPLASH_CMYK))
|
||
|
AC_ARG_WITH(appdef-dir,
|
||
|
[ --with-appdef-dir set app-defaults directory],
|
||
|
AC_DEFINE_UNQUOTED(APPDEFDIR, "$with_appdef_dir"))
|
||
|
|
||
|
dnl ##### Path to xpdfrc.
|
||
|
dnl This ugly kludge to get the sysconfdir path is needed because
|
||
|
dnl autoconf doesn't actually set the prefix variable until later.
|
||
|
if test "$sysconfdir" = '${prefix}/etc'; then
|
||
|
if test "x$prefix" = xNONE; then
|
||
|
system_xpdfrc="$ac_default_prefix/etc/xpdfrc"
|
||
|
else
|
||
|
system_xpdfrc="$prefix/etc/xpdfrc"
|
||
|
fi
|
||
|
else
|
||
|
system_xpdfrc="$sysconfdir/xpdfrc"
|
||
|
fi
|
||
|
AC_DEFINE_UNQUOTED(SYSTEM_XPDFRC, "$system_xpdfrc")
|
||
|
|
||
|
dnl ##### Checks for programs.
|
||
|
AC_PROG_CC
|
||
|
AC_ISC_POSIX
|
||
|
AC_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 <stdlib.h>
|
||
|
#include <stddef.h>
|
||
|
#include <unistd.h>
|
||
|
#include <sys/types.h>],
|
||
|
[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 <stdlib.h>
|
||
|
#include <stddef.h>
|
||
|
#include <unistd.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/select.h>],
|
||
|
[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 <stdlib.h>
|
||
|
#include <stddef.h>
|
||
|
#include <unistd.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <sys/bsdtypes.h>],
|
||
|
[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 <stdlib.h>
|
||
|
#include <sys/types.h>
|
||
|
#ifdef HAVE_SYS_SELECT_H
|
||
|
#include <sys/select.h>
|
||
|
#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 <stdlib.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <strings.h>
|
||
|
#ifdef HAVE_SYS_SELECT_H
|
||
|
#include <sys/select.h>
|
||
|
#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 <stdlib.h>
|
||
|
#include <sys/types.h>
|
||
|
#include <bstring.h>
|
||
|
#ifdef HAVE_SYS_SELECT_H
|
||
|
#include <sys/select.h>
|
||
|
#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 <stdlib.h>
|
||
|
#include <unistd.h>],
|
||
|
[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 for mkstemps, just like mkstemp.
|
||
|
AC_CACHE_CHECK([for mkstemps],
|
||
|
xpdf_cv_func_mkstemps,
|
||
|
[AC_TRY_LINK([#include <stdlib.h>
|
||
|
#include <unistd.h>],
|
||
|
[mkstemps("foo", 0);],
|
||
|
xpdf_cv_func_mkstemps=yes, xpdf_cv_func_mkstemps=no)])
|
||
|
if test "$xpdf_cv_func_mkstemps" = yes; then
|
||
|
AC_DEFINE(HAVE_MKSTEMPS)
|
||
|
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 <sys/types.h>
|
||
|
#include <sys/time.h>
|
||
|
#include <unistd.h>
|
||
|
#ifdef HAVE_SYS_SELECT_H
|
||
|
#include <sys/select.h>
|
||
|
#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 fseeko/ftello or fseek64/ftell64
|
||
|
dnl The LARGEFILE and FSEEKO macros have to be called in C, not C++, mode.
|
||
|
AC_SYS_LARGEFILE
|
||
|
AC_FUNC_FSEEKO
|
||
|
AC_CHECK_FUNCS(fseek64, xpdf_cv_func_fseek64=yes, xpdf_cv_func_fseek64=no)
|
||
|
AC_CHECK_FUNCS(ftell64, xpdf_cv_func_ftell64=yes, xpdf_cv_func_ftell64=no)
|
||
|
if test "$xpdf_cv_func_fseek64" = yes -a "$xpdf_cv_func_ftell64" = yes; then
|
||
|
AC_DEFINE(HAVE_FSEEK64)
|
||
|
fi
|
||
|
|
||
|
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 $X_EXTRA_LIBS -lX11, $X_CFLAGS)
|
||
|
AC_SUBST(Xpm_LIBS)
|
||
|
AC_SUBST(Xpm_CFLAGS)
|
||
|
fi
|
||
|
|
||
|
dnl ##### Check for Motif (libXm).
|
||
|
if test -z "$no_x"; then
|
||
|
dnl # XextAddDisplay isn't defined in any header file, so we provide a
|
||
|
dnl # bogus prototype (so the compiler doesn't complain) and a bogus
|
||
|
dnl # header file (so the smr macro doesn't break).
|
||
|
smr_CHECK_LIB(Xext, Xext, [Motif library],
|
||
|
XextAddDisplay, X11/Xlib.h,
|
||
|
$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS,
|
||
|
[int XextAddDisplay();])
|
||
|
AC_SUBST(Xext_LIBS)
|
||
|
AC_SUBST(Xext_CFLAGS)
|
||
|
smr_CHECK_LIB(Xp, Xp, [Motif library],
|
||
|
XpStartPage, X11/extensions/Print.h,
|
||
|
$X_LIBS $X_PRE_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS)
|
||
|
AC_SUBST(Xp_LIBS)
|
||
|
AC_SUBST(Xp_CFLAGS)
|
||
|
smr_CHECK_LIB(Xt, Xt, [Motif library],
|
||
|
XtAppInitialize, X11/Intrinsic.h,
|
||
|
$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS)
|
||
|
AC_SUBST(Xt_LIBS)
|
||
|
AC_SUBST(Xt_CFLAGS)
|
||
|
smr_CHECK_LIB(Xm, Xm, [Motif library],
|
||
|
XmCreateForm, Xm/XmAll.h,
|
||
|
$Xt_LIBS $X_LIBS $X_PRE_LIBS $Xp_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS)
|
||
|
AC_SUBST(Xm_LIBS)
|
||
|
AC_SUBST(Xm_CFLAGS)
|
||
|
smr_CHECK_LIB(Sgm, Sgm, [SGI Motif library],
|
||
|
SgCreateHorzPanedWindow, Sgm/HPanedW.h,
|
||
|
$Xm_LIBS $Xt_LIBS $X_LIBS $X_PRE_LIBS $Xp_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11, $X_CFLAGS)
|
||
|
AC_SUBST(Sgm_LIBS)
|
||
|
AC_SUBST(Sgm_CFLAGS)
|
||
|
|
||
|
dnl # check for XtAppSetExitFlag, which didn't exist prior to X11R6 (?)
|
||
|
if test "x$smr_have_Xt_library" = xyes; then
|
||
|
AC_CHECK_LIB(Xt, XtAppSetExitFlag,
|
||
|
AC_DEFINE(HAVE_XTAPPSETEXITFLAG), ,
|
||
|
[$Xt_LIBS $X_LIBS $X_PRE_LIBS $Xp_LIBS $Xext_LIBS $X_EXTRA_LIBS -lX11])
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
dnl ##### Check for t1lib.
|
||
|
smr_CHECK_LIB(t1, t1, [Type 1 font rasterizer],
|
||
|
T1_InitLib, t1lib.h,
|
||
|
-lm, $X_CFLAGS)
|
||
|
AC_SUBST(t1_LIBS)
|
||
|
AC_SUBST(t1_CFLAGS)
|
||
|
|
||
|
dnl ##### Check for FreeType 2.x.
|
||
|
dnl ##### (Note: FT_Get_Name_Index was added in FT 2.0.5, and is
|
||
|
dnl ##### the reason that Xpdf requires 2.0.5+.)
|
||
|
smr_CHECK_LIB(freetype2, freetype, [FreeType2 font rasterizer - version 2.0.5+],
|
||
|
FT_Get_Name_Index, ft2build.h, -lm)
|
||
|
AC_SUBST(freetype2_LIBS)
|
||
|
AC_SUBST(freetype2_CFLAGS)
|
||
|
if test "x$smr_have_freetype2_library" = xyes; then
|
||
|
AC_DEFINE(HAVE_FREETYPE_FREETYPE_H)
|
||
|
AC_DEFINE(HAVE_SPLASH)
|
||
|
fi
|
||
|
|
||
|
dnl ##### Check for libpaper (Debian).
|
||
|
smr_CHECK_LIB(libpaper, paper, [Debian libpaper], paperinit, paper.h)
|
||
|
AC_SUBST(libpaper_LIBS)
|
||
|
AC_SUBST(libpaper_CFLAGS)
|
||
|
|
||
|
dnl ##### Disable X-specific stuff in top-level Makefile.
|
||
|
if test -n "$no_x" -o "x$smr_have_Xm_library" != xyes -o "x$smr_have_freetype2_library" != xyes; 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 goo/Makefile fofi/Makefile splash/Makefile xpdf/Makefile)
|
||
|
|
||
|
dnl ##### Warn user if X is missing.
|
||
|
if test -n "$no_x" -o "x$smr_have_Xm_library" != xyes -o "x$smr_have_freetype2_library" != xyes; then
|
||
|
if test -n "$no_x"; then
|
||
|
AC_MSG_WARN([Couldn't find X]);
|
||
|
fi
|
||
|
if test "x$smr_have_Xm_library" != xyes; then
|
||
|
AC_MSG_WARN([Couldn't find Motif]);
|
||
|
fi
|
||
|
if test "x$smr_have_freetype2_library" != xyes; then
|
||
|
AC_MSG_WARN([Couldn't find FreeType]);
|
||
|
fi
|
||
|
AC_MSG_WARN([-- You will be able to compile pdftops, pdftotext,
|
||
|
pdfinfo, pdffonts, and pdfimages, but not xpdf or pdftoppm])
|
||
|
fi
|