1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
|
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(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_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)
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
|