1dnl Copyright (C) 2001-2007 Artifex Software, Inc. 2 3dnl This file is part of GNU ghostscript 4dnl 5dnl GNU ghostscript is free software; you can redistribute it and/or 6dnl modify it under the terms of the version 2 of the GNU General 7dnl Public License as published by the Free Software Foundation. 8dnl 9dnl GNU ghostscript is distributed in the hope that it will be useful, but WITHOUT 10dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11dnl FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12dnl 13dnl You should have received a copy of the GNU General Public License along with 14dnl ghostscript; see the file COPYING. If not, write to the Free Software Foundation, 15dnl Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16dnl 17dnl $Id: configure.ac,v 1.18 2008/05/04 14:35:10 Arabidopsis Exp $ 18dnl Process this file with autoconf to produce a configure script 19 20dnl ------------------------------------------------ 21dnl Initialization and Versioning 22dnl ------------------------------------------------ 23 24AC_PREREQ(2.60) 25AC_INIT([gnu-ghostscript], [8.62.0], [gnu-ghostscript-bug@gnu.org]) 26AC_CONFIG_SRCDIR(src/gs.c) 27AM_INIT_AUTOMAKE([-Wall]) 28 29dnl Inherit compiler flags from the environment... 30CFLAGS="${CFLAGS:=}" 31CPPFLAGS="${CPPFLAGS:=}" 32CXXFLAGS="${CXXFLAGS:=}" 33LDFLAGS="${LDFLAGS:=}" 34 35GS_VERSION_MAJOR=8 36GS_VERSION_MINOR=62 37GS_VERSION_PATCH=0 38GS_REVISIONDATE=20080229 39 40GS_VERSION=`expr $GS_VERSION_MAJOR \* 10000 + $GS_VERSION_MINOR \* 100 + $GS_VERSION_PATCH` 41 42if test $GS_VERSION_MINOR -lt 10; then 43 GS_VERSION_MINOR0=0$GS_VERSION_MINOR 44else 45 GS_VERSION_MINOR0=$GS_VERSION_MINOR 46fi 47 48GS_REVISION=`expr $GS_VERSION_MAJOR \* 100 + $GS_VERSION_MINOR0` 49 50AC_SUBST(GS_REVISIONDATE, $GS_REVISIONDATE) 51AC_SUBST(GS_VERSION_MAJOR, $GS_VERSION_MAJOR) 52AC_SUBST(GS_VERSION_MINOR, $GS_VERSION_MINOR) 53AC_SUBST(GS_VERSION_MINOR0, $GS_VERSION_MINOR0) 54AC_SUBST(GS_VERSION_PATCH, $GS_VERSION_PATCH) 55AC_SUBST(GS_VERSION, $GS_VERSION) 56AC_SUBST(GS_REVISION, $GS_REVISION) 57 58dnl -------------------------------------------------- 59dnl Local utilities 60dnl -------------------------------------------------- 61 62dnl GS_SPLIT_LIBS( LIBS, LINKLINE ) 63dnl Split a unix-style link line into a list of 64dnl bare library names. For example, the line 65dnl '-L/usr/X11R6/lib -lX11 -lXt' splits into 66dnl LIB='X11 Xt' 67dnl 68AC_DEFUN([GS_SPLIT_LIBS], [ 69# the makefile wants a list of just the library names 70for gs_item in $2; do 71 gs_stripped_item=`echo "$gs_item" | sed -e 's/-l//'` 72 if test "x$gs_stripped_item" != "x$gs_item"; then 73 $1="$[$1] $gs_stripped_item" 74 fi 75done 76]) 77 78dnl GS_SPLIT_LIBPATHS( LIBPATHS, LINKLINE ) 79dnl Split a unix-style link line into a list of 80dnl bare search path entries. For example, 81dnl '-L/usr/X11R6/lib -lX11 -L/opt/lib -lXt' 82dnl splits to LIBPATHS='/usr/X11R6/lib /opt/lib' 83dnl 84AC_DEFUN([GS_SPLIT_LIBPATHS], [ 85for gs_item in $2; do 86 gs_stripped_item=`echo "$gs_item" | sed -e 's/-L//'` 87 if test "x$gs_stripped_item" != "x$gs_item"; then 88 $1="$[$1] $gs_stripped_item" 89 fi 90done 91]) 92 93dnl -------------------------------------------------- 94dnl Check for programs 95dnl -------------------------------------------------- 96 97dnl AC_PROG_CC likes to add '-g -O2' to CFLAGS. however, 98dnl we ignore those flags and construct our own. 99save_cflags=$CFLAGS 100AC_PROG_CC 101AC_PROG_CPP 102CFLAGS=$save_cflags 103 104AC_PROG_LIBTOOL 105AC_PROG_INSTALL 106 107dnl -------------------------------------------------- 108dnl Allow excluding the contributed drivers 109dnl -------------------------------------------------- 110 111AC_ARG_ENABLE(contrib, [ --disable-contrib do not include contributed drivers [default=include]]) 112CONTRIBINCLUDE="include contrib/contrib.mak" 113INSTALL_CONTRIB="install-contrib-extras" 114if test x$enable_contrib = xno; then 115 CONTRIBINCLUDE="" 116 INSTALL_CONTRIB="" 117 CFLAGS="$CFLAGS -DNOCONTRIB" 118fi 119AC_SUBST(CONTRIBINCLUDE) 120AC_SUBST(INSTALL_CONTRIB) 121 122dnl -------------------------------------------------- 123dnl Set build flags based on environment 124dnl -------------------------------------------------- 125 126#AC_CANONICAL_HOST 127 128if test $ac_cv_prog_gcc = yes; then 129 cflags_to_try="-Wall -Wstrict-prototypes -Wundef \ 130-Wmissing-declarations -Wmissing-prototypes -Wwrite-strings \ 131-Wno-strict-aliasing \ 132-fno-builtin -fno-common" 133 optflags_to_try="-O2" 134else 135 cflags_to_try= 136 optflags_to_try="-O" 137fi 138 139AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]]) 140if test x$enable_debug = xyes; then 141 optflags_to_try="-g" 142 CFLAGS="-DDEBUG $CFLAGS" 143fi 144 145AC_MSG_CHECKING([supported compiler flags]) 146old_cflags=$CFLAGS 147echo 148for flag in $optflags_to_try; do 149 CFLAGS="$CFLAGS $flag" 150 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[ 151 echo " $flag" 152 OPT_CFLAGS="$OPT_CFLAGS $flag" 153 ],[]) 154 CFLAGS=$old_cflags 155done 156for flag in $cflags_to_try; do 157 CFLAGS="$CFLAGS $flag" 158 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[return 0;]])],[ 159 echo " $flag" 160 GCFLAGS="$GCFLAGS $flag" 161 ],[]) 162 CFLAGS=$old_cflags 163done 164AC_MSG_RESULT([ ...done.]) 165 166dnl -------------------------------------------------- 167dnl Check for headers 168dnl -------------------------------------------------- 169 170AC_HEADER_DIRENT 171AC_HEADER_STDC 172AC_CHECK_HEADERS([errno.h fcntl.h limits.h malloc.h memory.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/time.h syslog.h unistd.h]) 173 174# for gdev3b1.c (AT&T terminal interface) 175AC_CHECK_HEADER([sys/window.h]) 176 177dnl -------------------------------------------------- 178dnl Check for typedefs, structures, etc 179dnl -------------------------------------------------- 180 181AC_C_CONST 182AC_C_INLINE 183AC_TYPE_MODE_T 184AC_TYPE_OFF_T 185AC_TYPE_SIZE_T 186AC_STRUCT_ST_BLOCKS 187AC_HEADER_TIME 188AC_STRUCT_TM 189 190dnl see if we're on a system that puts the *int*_t types 191dnl from stdint.h in sys/types.h 192if test "x$ac_cv_header_stdint_h" != xyes; then 193 AC_CHECK_TYPES([int8_t, int16_t, int32_t, uint8_t, uint16_t, uint32_t],,,[#include <sys/types.h>]) 194 if test "$ac_cv_type_uint8_t" = yes; then 195 AC_DEFINE([SYS_TYPES_HAS_STDINT_TYPES]) 196 GCFLAGS="$GCFLAGS -DSYS_TYPES_HAS_STDINT_TYPES" 197 fi 198fi 199 200dnl we aren't interested in all of DEFS, so manually insert 201dnl the flags we care about 202if test "$ac_cv_c_const" != yes; then 203 GCFLAGS="$GCFLAGS -Dconst=" 204fi 205if test "x$ac_cv_header_stdint_h" = xyes; then 206 GCFLAGS="$GCFLAGS -DHAVE_STDINT_H" 207fi 208 209dnl try to find a 64 bit type for devicen color index 210uint64_type="none" 211 AC_CHECK_SIZEOF(unsigned long int) 212 if test $ac_cv_sizeof_unsigned_long_int = 8; then 213 uint64_type="unsigned long int" 214 else 215 AC_CHECK_SIZEOF(unsigned long long) 216 if test $ac_cv_sizeof_unsigned_long_long = 8; then 217 uint64_type="unsigned long long" 218 else 219 AC_CHECK_SIZEOF(unsigned __int64) 220 if test $ac_cv_sizeof_unsigned___int64 = 8; then 221 uint64_type="unsigned __int64" 222 else 223 AC_CHECK_SIZEOF(u_int64_t) 224 if test $ac_cv_sizeof_u_int64_t = 8; then 225 uint64_type="u_int64_t" 226 fi 227 fi 228 fi 229 fi 230dnl we don't need to do anything if a 64-bit type wasn't found 231dnl the code falls back to a (probably 32-bit) default 232if test "$uint64_type" != "none"; then 233 GCFLAGS="$GCFLAGS -DGX_COLOR_INDEX_TYPE=\"$uint64_type\"" 234fi 235 236dnl pkg-config is used for several tests now... 237AC_PATH_PROG(PKGCONFIG, pkg-config) 238 239dnl Fontconfig support 240HAVE_FONTCONFIG="" 241FONTCONFIG_CFLAGS="" 242FONTCONFIG_LIBS="" 243AC_ARG_ENABLE(fontconfig, [ --disable-fontconfig Don't use fontconfig to list system fonts]) 244if test "$enable_fontconfig" != "no"; then 245 # We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard 246 # autoconf macro and b) requires pkg-config on the system, which is 247 # NOT standard on ANY OS, including Linux! 248 if test "x$PKGCONFIG" != x; then 249 AC_MSG_CHECKING(for fontconfig with pkg-config) 250 if $PKGCONFIG --exists fontconfig; then 251 AC_MSG_RESULT(yes) 252 FONTCONFIG_CFLAGS="$CFLAGS `$PKGCONFIG --cflags fontconfig`" 253 FONTCONFIG_LIBS="`$PKGCONFIG --libs fontconfig`" 254 HAVE_FONTCONFIG=-DHAVE_FONTCONFIG 255 else 256 AC_MSG_RESULT(no) 257 fi 258 fi 259 if test -z "$HAVE_FONTCONFIG"; then 260 AC_CHECK_LIB([fontconfig], [FcInitLoadConfigAndFonts], [ 261 AC_CHECK_HEADER([fontconfig/fontconfig.h], [ 262 FONTCONFIG_LIBS="-lfontconfig" 263 HAVE_FONTCONFIG="-DHAVE_FONTCONFIG" 264 ]) 265 ]) 266 fi 267fi 268AC_SUBST(HAVE_FONTCONFIG) 269AC_SUBST(FONTCONFIG_CFLAGS) 270AC_SUBST(FONTCONFIG_LIBS) 271 272dnl -------------------------------------------------- 273dnl Check for libraries 274dnl -------------------------------------------------- 275 276AC_CHECK_LIB(m, cos) 277dnl AC_CHECK_LIB(pthread, pthread_create) 278 279dnl Tests for iconv (Needed for OpenPrinting Vector, "opvp" output device) 280AC_ARG_WITH(libiconv, 281 [AC_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@], 282 [use the libiconv library])],, 283 [with_libiconv=maybe]) 284found_iconv=no 285case $with_libiconv in 286 maybe) 287 # Check in the C library first 288 AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes]) 289 # Check if we have GNU libiconv 290 if test $found_iconv = "no"; then 291 AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) 292 fi 293 # Check if we have a iconv in -liconv, possibly from vendor 294 if test $found_iconv = "no"; then 295 AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) 296 fi 297 ;; 298 no) 299 AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes]) 300 ;; 301 gnu|yes) 302 AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) 303 ;; 304 native) 305 AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) 306 ;; 307esac 308if test x$found_iconv != xno -a x$with_libiconv != xno ; then 309 LIBS="$LIBS -liconv" 310fi 311 312case $with_libiconv in 313 gnu) 314 AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv]) 315 ;; 316 native) 317 AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library]) 318 ;; 319esac 320 321AC_CHECK_LIB(dl, dlopen) 322 323AC_MSG_CHECKING([for local jpeg library source]) 324dnl At present, we give the local source priority over the shared 325dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied. 326dnl A more sophisticated approach would be to test the shared lib 327dnl to see whether it has already been patched. 328LIBJPEGDIR=src 329if test -f jpeg/jpeglib.h; then 330 AC_MSG_RESULT([jpeg]) 331 SHARE_LIBJPEG=0 332 LIBJPEGDIR=jpeg 333elif test -f jpeg-6b/jpeglib.h; then 334 AC_MSG_RESULT([jpeg-6b]) 335 SHARE_LIBJPEG=0 336 LIBJPEGDIR=jpeg-6b 337else 338 AC_MSG_RESULT([no]) 339 AC_CHECK_LIB(jpeg, jpeg_set_defaults, [ 340 AC_CHECK_HEADERS([jpeglib.h], [SHARE_LIBJPEG=1]) 341 ]) 342fi 343if test -z "$SHARE_LIBJPEG"; then 344 AC_MSG_ERROR([I wasn't able to find a copy 345 of the jpeg library. This is required for compiling 346 ghostscript. Please download a copy of the source, 347 e.g. from http://www.ijg.org/, unpack it at the 348 top level of the gs source tree, and rename 349 the directory to 'jpeg'. 350 ]) 351fi 352AC_SUBST(SHARE_LIBJPEG) 353AC_SUBST(LIBJPEGDIR) 354dnl check for the internal jpeg memory header 355AC_MSG_CHECKING([for jmemsys.h]) 356if test -r $LIBJPEGDIR/jmemsys.h; then 357 AC_MSG_RESULT([yes]) 358else 359 AC_MSG_RESULT([no]) 360 AC_DEFINE([DONT_HAVE_JMEMSYS_H], 1, 361 [define if the libjpeg memory system prototypes aren't available]) 362fi 363 364dnl these are technically optional 365 366dnl zlib is needed for language level 3, and libpng 367AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib],[include zlib support (local, shared, no) (required for PNG and language level 3)])) 368# we must define ZLIBDIR regardless because libpng.mak does a -I$(ZLIBDIR) 369# this seems a harmless default 370ZLIBDIR=src 371if test x$with_zlib != xno; then 372 AC_MSG_CHECKING([for local zlib source]) 373 if test x$with_zlib != xshared && test -d zlib; then 374 AC_MSG_RESULT([yes]) 375 SHARE_ZLIB=0 376 ZLIBDIR=zlib 377 else 378 AC_MSG_RESULT([shared]) 379 AC_CHECK_LIB(z, deflate, [ 380 AC_CHECK_HEADERS(zlib.h, [SHARE_ZLIB=1]) 381 ]) 382 fi 383 if test -z "$SHARE_ZLIB"; then 384 AC_MSG_ERROR([I did not find a copy of zlib on your system. 385 Please either install it, or unpack a copy of the source in a 386 local directory named 'zlib'. See http://www.gzip.org/zlib/ 387 for more information. 388 ]) 389 fi 390fi 391AC_SUBST(SHARE_ZLIB) 392AC_SUBST(ZLIBDIR) 393 394dnl png for the png output device; it also requires zlib 395AC_ARG_WITH(png, AC_HELP_STRING([--with-png],[include PNG support (local, shared, no)])) 396dnl set safe defaults 397 LIBPNGDIR=src 398 PNGDEVS='' 399 PNGDEVS_ALL='$(DD)png48.dev $(DD)png16m.dev $(DD)pnggray.dev $(DD)pngmono.dev $(DD)png256.dev $(DD)png16.dev $(DD)pngalpha.dev' 400if test x$with_png != xno; then 401 AC_MSG_CHECKING([for local png library source]) 402 if test x$with_png != xshared && test -f libpng/pngread.c; then 403 AC_MSG_RESULT([yes]) 404 SHARE_LIBPNG=0 405 LIBPNGDIR=libpng 406 PNGDEVS="$PNGDEVS_ALL" 407 else 408 AC_MSG_RESULT([shared]) 409 AC_CHECK_LIB(png, png_check_sig, [ 410 AC_CHECK_HEADERS(png.h, [ 411 SHARE_LIBPNG=1 412 PNGDEVS="$PNGDEVS_ALL" 413 ], [SHARE_LIBPNG=0]) 414 ], [SHARE_LIBPNG=0], [-lz]) 415 fi 416 if test -z "$PNGDEVS"; then 417 AC_MSG_NOTICE([disabling png output devices]) 418 fi 419fi 420AC_SUBST(SHARE_LIBPNG) 421AC_SUBST(LIBPNGDIR) 422AC_SUBST(PNGDEVS) 423 424dnl look for CUPS... 425AC_ARG_ENABLE(cups, [ --enable-cups turn on CUPS support, default=yes]) 426 427CUPSDEV="" 428CUPSINCLUDE="" 429CUPSCFLAGS="" 430CUPSLIBS="" 431CUPSLIBDIRS="" 432CUPSCONFIG="${CUPSCONFIG:=}" 433CUPSSERVERBIN="" 434CUPSSERVERROOT="" 435CUPSDATA="" 436 437if ( test -d cups ); then 438 if test x$enable_cups != xno; then 439 AC_PATH_PROG(CUPSCONFIG,cups-config) 440dnl AC_CHECK_HEADER([cups/raster.h],[],[CUPSCONFIG=""]) 441 if test "x$CUPSCONFIG" != x; then 442 dnl Use values from CUPS config... 443 CUPSCFLAGS="`$CUPSCONFIG --cflags` $CFLAGS" 444# CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --static --image --libs | sed -e '1,$s/-lssl//'` $LIBS" 445 CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --image --libs`" 446 GS_SPLIT_LIBS([CUPSLIBS], [$CUPSLINK]) 447 GS_SPLIT_LIBPATHS([CUPSLIBDIRS],[$CUPSLINK]) 448 CUPSSERVERROOT="`$CUPSCONFIG --serverroot`" 449 CUPSSERVERBIN="`$CUPSCONFIG --serverbin`" 450 CUPSDATA="`$CUPSCONFIG --datadir`" 451 CUPSINCLUDE="include cups/cups.mak" 452 CUPSDEV="\$(DD)cups.dev" 453 fi 454 fi 455fi 456 457AC_SUBST(CUPSDEV) 458AC_SUBST(CUPSCFLAGS) 459AC_SUBST(CUPSLIBS) 460AC_SUBST(CUPSLIBDIRS) 461AC_SUBST(CUPSINCLUDE) 462AC_SUBST(CUPSSERVERBIN) 463AC_SUBST(CUPSSERVERROOT) 464AC_SUBST(CUPSDATA) 465 466 467dnl look for IJS implementation 468AC_ARG_WITH(ijs, AC_HELP_STRING([--with-ijs],[include IJS driver support])) 469dnl set safe defaults 470 IJSDIR=src 471 IJSDEVS='' 472if test x$with_ijs != xno; then 473 AC_MSG_CHECKING([for local ijs library source]) 474 if test -d ijs; then 475 AC_MSG_RESULT([yes]) 476 IJSDIR=ijs 477 IJSDEVS='$(DD)ijs.dev' 478 else 479 AC_MSG_RESULT([no]) 480 fi 481fi 482AC_SUBST(IJSDIR) 483AC_SUBST(IJSDEVS) 484 485dnl look for jbig2dec 486AC_ARG_WITH(jbig2dec, AC_HELP_STRING([--with-jbig2dec],[include JBIG2 decode support])) 487JBIG2DIR=src 488SHARE_JBIG2=0 489JBIG2DEVS='' 490if test x$with_jbig2dec != xno; then 491 AC_MSG_CHECKING([for local jbig2dec library source]) 492 for d in jbig2dec jbig2dec-0.2 jbig2dec-0.3; do 493 test -d "$d" && JBIG2DIR=$d && break 494 done 495 if test "x$JBIG2DIR" != xsrc; then 496 AC_MSG_RESULT([$JBIG2DIR]) 497 else 498 AC_MSG_RESULT([no]) 499 AC_CHECK_LIB([jbig2dec], [jbig2_page_out], [ 500 SHARE_JBIG2=1 501 ], [ 502 AC_MSG_WARN([disabling support for JBIG2 files]) 503 with_jbig2dec=no 504 ]) 505 fi 506fi 507if test x$with_jbig2dec != xno; then 508 if test x$ac_cv_header_stdint_h != xyes; then 509 AC_MSG_WARN([JBIG2 support requires stdint types which do not seem to be available.]) 510 else 511 JBIG2DEVS='$(PSD)jbig2.dev' 512 fi 513fi 514 515AC_SUBST(JBIG2DIR) 516AC_SUBST(SHARE_JBIG2) 517AC_SUBST(JBIG2DEVS) 518 519dnl look for the jasper JPEG 2000 library 520AC_ARG_WITH(jasper, AC_HELP_STRING([--with-jasper],[link to the JasPer library for JPEG 2000])) 521JASPERDIR=src 522SHARE_JASPER=0 523JPXDEVS='' 524if test x$with_jasper != xno; then 525 AC_MSG_CHECKING([for local jasper library source]) 526 for d in jasper jasper-1.7*; do 527 test -d "$d" && JASPERDIR=$d && break 528 done 529 if test "x$JASPERDIR" != xsrc; then 530 AC_MSG_RESULT([$JASPERDIR]) 531 AC_MSG_CHECKING([for local jasper config header]) 532 if test -r $JASPERDIR/src/libjasper/include/jasper/jas_config_ac.h; then 533 AC_MSG_RESULT([yes]) 534 else 535 AC_MSG_RESULT([no]) 536 AC_MSG_CHECKING([for local jasper configure script]) 537 if test -r $JASPERDIR/configure; then 538 AC_MSG_RESULT([yes]) 539 echo 540 echo "Running jasper configure script..." 541 olddir=`pwd` 542 cd $JASPERDIR && sh ./configure 543 cd $olddir 544 echo 545 echo "Continuing with Ghostscript configuration..." 546 else 547 AC_MSG_RESULT([no]) 548 AC_MSG_CHECKING([for local jasper autogen.sh script]) 549 if test -x $JASPERDIR/autogen.sh; then 550 AC_MSG_RESULT([yes]) 551 echo 552 echo "Running jasper autogen script..." 553 olddir=`pwd` 554 cd $JASPERDIR && ./autogen.sh 555 cd $olddir 556 echo 557 echo "Continuing with Ghostscript configuration..." 558 else 559 AC_MSG_WARN([ 560Unable to find $JASPERDIR/src/libjasper/include/jas_config.h, 561or generate such a file for this system. You will 562have to build one by hand, or configure, build and install 563the jasper library separately. 564 565You can also pass --without-jasper to configure to disable 566JPEG 2000 PDF image support entirely. 567]) 568 with_jasper=no 569 fi 570 fi 571 fi 572 else 573 AC_MSG_RESULT([no]) 574 AC_CHECK_LIB([jasper], [jas_image_create], [ 575 SHARE_JASPER=1 576 ], [ 577 AC_MSG_WARN([disabling support for JPEG 2000 images]) 578 with_jasper=no 579 ]) 580 fi 581fi 582if test x$with_jasper != xno; then 583 JPXDEVS='$(PSD)jpx.dev' 584fi 585 586AC_SUBST(JASPERDIR) 587AC_SUBST(SHARE_JASPER) 588AC_SUBST(JPXDEVS) 589 590dnl check if we can/should build the gtk loader 591AC_ARG_ENABLE([gtk], AC_HELP_STRING([--disable-gtk], [Don't build the gtk loader])) 592SOC_CFLAGS="" 593SOC_LIBS="" 594SOC_LOADER="dxmainc.c" 595if test "x$enable_gtk" != "xno"; then 596 # Try GTK+ 2.x first... 597 if test "x$PKGCONFIG" != x; then 598 AC_MSG_CHECKING(for GTK+ 2.x) 599 if $PKGCONFIG --exists gtk+-2.0; then 600 SOC_LOADER="dxmain.c" 601 SOC_CFLAGS="`$PKGCONFIG gtk+-2.0 --cflags`" 602 SOC_LIBS="`$PKGCONFIG gtk+-2.0 --libs`" 603 AC_MSG_RESULT([yes]) 604 else 605 AC_MSG_RESULT([no]) 606 fi 607 fi 608 609 # Then fall back on GTK+ 1.x... 610 if test "x$SOC_LOADER" = x; then 611 AC_PATH_PROG(GTKCONFIG, gtk-config) 612 if test "x$GTKCONFIG" != x; then 613 SOC_LOADER="dxmain.c" 614 SOC_CFLAGS="`$GTKCONFIG --cflags`" 615 SOC_LIBS="`$GTKCONFIG --libs`" 616 fi 617 fi 618fi 619AC_SUBST(SOC_CFLAGS) 620AC_SUBST(SOC_LIBS) 621AC_SUBST(SOC_LOADER) 622 623dnl look for omni implementation 624AC_ARG_WITH([omni], AC_HELP_STRING([--with-omni], 625 [build the omni driver])) 626dnl set safe defaults 627OMNIDEVS='' 628INCLUDEOMNI=yes 629if ( ! test -z "$CONTRIBINCLUDE" ) && ( test x$with_omni != xno ); then 630 OMNIDEVS='$(DD)omni.dev' 631 632 if test -n "$GCC"; then 633 LIBS="$LIBS -lstdc++" 634 fi 635fi 636AC_SUBST(OMNIDEVS) 637 638dnl optional X11 for display devices 639AC_PATH_XTRA 640 641X_LDFLAGS="" 642X_CFLAGS="" 643X_DEVS="" 644X_LIBS="" 645 646if test x$no_x != xyes; then 647 if test "$x_libraries" = "/usr/lib"; then 648 echo "Ignoring X library directory \"$x_libraries\" requested by configure." 649 x_libraries="NONE" 650 fi 651 if test ! "$x_libraries" = "NONE" -a ! "$x_libraries" = ""; then 652 X_LDFLAGS="-L$x_libraries" 653 if test "$uname" = "SunOS"; then 654 X_LDFLAGS="$X_LDFLAGS -R$x_libraries" 655 fi 656 fi 657 658 if test "$x_includes" = "/usr/include"; then 659 echo "Ignoring X include directory \"$x_includes\" requested by configure." 660 x_includes="NONE" 661 fi 662 if test ! "$x_includes" = "NONE" -a ! "$x_includes" = ""; then 663 X_CFLAGS="-I$x_includes" 664 fi 665 666 SAVELIBS="$LIBS" 667 SAVELDFLAGS="$LDFLAGS" 668 LDFLAGS="$LDFLAGS $X_LDFLAGS" 669 670 AC_CHECK_LIB(X11,XOpenDisplay) 671 AC_CHECK_LIB(Xext,XdbeQueryExtension) 672 AC_CHECK_LIB(Xt,XtAppCreateShell) 673 674 LDFLAGS="$SAVELDFLAGS" 675 LIBS="$SAVELIBS" 676 677 if test "$ac_cv_lib_Xt_XtAppCreateShell" = yes; then 678 X11DEVS="\$(DD)x11.dev \$(DD)x11alpha.dev \$(DD)x11cmyk.dev \$(DD)x11mono.dev \$(DD)x11_.dev \$(DD)x11alt_.dev \$(DD)x11cmyk2.dev \$(DD)x11cmyk4.dev \$(DD)x11cmyk8.dev \$(DD)x11rg16x.dev \$(DD)x11rg32x.dev \$(DD)x11gray2.dev \$(DD)x11gray4.dev" 679 X_DEVS=$X11DEVS 680 # the makefile wants a list of just the library names in X_LIBS 681 GS_SPLIT_LIBS([X_LIBS], 682 [-lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS]) 683 fi 684fi 685 686AC_SUBST(X_LDFLAGS) 687AC_SUBST(X_CFLAGS) 688AC_SUBST(X_LIBS) 689AC_SUBST(X_DEVS) 690AC_SUBST(X11DEVS) 691AC_SUBST(XLIBS) 692 693dnl executible name 694AC_ARG_WITH(gs, AC_HELP_STRING([--with-gs=NAME], 695 [name of the ghostscript executible [[gs]]]), 696 [GS="$with_gs"],[GS='gs']) 697AC_SUBST(GS) 698 699dnl do we compile the postscript initialization files into Ghostscript? 700COMPILE_INITS="1" 701AC_ARG_ENABLE(compile-inits, AC_HELP_STRING([--disable-compile-inits], 702 [don't compile in initialization files]),[ 703 if test "x$enable_compile_inits" = xno; then 704 COMPILE_INITS="0" 705 fi]) 706AC_SUBST(COMPILE_INITS) 707 708dnl look for drivers to compile... 709AC_ARG_WITH(drivers, 710[ --with-drivers=LIST Drivers to support, separated by commas. 711 Either list the drivers or use aliases: 712 ALL = all drivers 713 FILES = all file format drivers 714 PRINTERS = all printer drivers 715 Printers: 716 APPLE = all Apple printers 717 BROTHER = all Brother printers 718 CANON = all Canon printers 719 EPSON = all Epson printers 720 HP = all HP printers 721 IBM = all IBM printers 722 JAPAN = older japanese printers 723 LEXMARK = all Lexmark printers 724 OKI = all OKI printers 725 PCLXL = all PCL XL/6 printers 726 File formats: 727 BMP = Output to bmp files 728 FAX = Output to fax files 729 JPEG = Output to JPEG files 730 PBM = Output to PBM/PNM 731 PCX = Output to PCX 732 PNG = Output to PNG 733 PS = Output to PostScript/PDF 734 TIFF = Output to TIFF 735 WTS = WTS Halftoning devices 736 You can mix both variants, e.g. 737 --with-drivers=HP,stcolor would build HP drivers and 738 the Epson stcolor driver. 739 Aliases must be uppercase (a 3rd party driver might 740 have the same name). 741 Default: ALL],drivers="$withval",drivers="ALL") 742 743AC_ARG_WITH(driversfile, 744[ --with-driversfile=FILE Drivers to support from file, separated by newlines.], 745driversfile="$withval",driversfile="") 746 747if test "x$driversfile" != x; then 748 # Add drivers from file... 749 drivers="`tr '\n' ',' <$driversfile`" 750fi 751 752dnl Check which drivers we'd like to support. 753P_DEVS="" 754F_DEVS="" 755 756dnl Known printers 757HP_DEVS="cdj500 djet500 djet500c dnj650c cljet5pr deskjet laserjet ljetplus ljet2p ljet3 ljet3d ljet4 ljet4d lj4dith lj5mono lj5gray cdeskjet cdjcolor cdjmono cdj550 pj pjxl pjxl300 lp2563 paintjet pjetxl cljet5 cljet5c pxlmono pxlcolor cdj670 cdj850 cdj880 cdj890 cdj970 cdj1600 chp2200 pcl3 hpdjplus hpdjportable hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdj1120c lj3100sw" 758PCLXL_DEVS="pxlmono pxlcolor" 759EPSON_DEVS="eps9high eps9mid epson epsonc escp lp8000 lq850 photoex st800 stcolor alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 lp3000c lp8000c lp8200c lp8300c lp8500c lp8800c lp9000c lp9200c lp9500c lp9800c lps6500 epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 epl6200 lp1800 lp1900 lp2200 lp2400 lp2500 lp7500 lp7700 lp7900 lp8100 lp8300f lp8400f lp8600 lp8600f lp8700 lp8900 lp9000b lp9100 lp9200b lp9300 lp9400 lp9600 lp9600s lps4500" 760CANON_DEVS="bj10e bj200 bjc600 bjc800 lbp8 lips3 bjcmono bjcgray bjccmyk bjccolor" 761LEXMARK_DEVS="lxm5700m lx5000 lxm3200 lex2050 lex3200 lex5700 lex7000" 762BROTHER_DEVS="hl7x0 hl1240 hl1250" 763APPLE_DEVS="appledmp iwhi iwlo iwlq" 764IBM_DEVS="ibmpro jetp3852" 765OKI_DEVS="oki182 okiibm oki4w" 766JAPAN_DEVS="lips4 lips4v ljet4pjl lj4dithp dj505j picty180 lips2p bjc880j pr201 pr150 pr1000 pr1000_4 jj100 bj10v bj10vh mj700v2c mj500c mj6000c mj8000c fmpr fmlbp ml600 lbp310 lbp320 md50Mono md50Eco md1xMono escpage lp2000 npdl rpdl" 767MISC_PDEVS="uniprint ap3250 atx23 atx24 atx38 coslw2p coslwxl cp50 declj250 fs600 imagen lj250 m8510 necp6 oce9050 r4081 sj48 tek4696 t4693d2 t4693d4 t4693d8 dl2100 la50 la70 la75 la75plus ln03 xes md2k md5k gdi samsunggdi wep9pin wep24pin" 768OPVP_DEVS="opvp oprp" 769 770dnl Known file formats 771BMP_DEVS="bmpmono bmpgray bmpsep1 bmpsep8 bmp16 bmp256 bmp16m bmp32b" 772FAX_DEVS="cfax dfaxlow dfaxhigh fax tfax tiffg3 tiffg32d tiffg4 faxg3 faxg32d faxg4" 773JPEG_DEVS="jpeg jpeggray jpegcmyk" 774PNG_DEVS="png16 png16m png256 pngalpha pnggray pngmono" 775TIFF_DEVS="tiffs tiff12nc tiff24nc tiff32nc tiffcrle tifflzw tiffpack tiffgray tiffsep" 776PCX_DEVS="pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk pcx2up" 777PBM_DEVS="pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm pksmraw pam" 778PS_DEVS="psdf psdcmyk psdrgb pdfwrite pswrite ps2write epswrite psgray psmono psrgb bbox" 779WTS_HALFTONING_DEVS="imdi simdi wtsimdi wtscmyk" 780MISC_FDEVS="ccr cgm24 cgm8 cgmmono cif inferno mag16 mag256 mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono miff24 plan9bm sgirgb sunhmono bit bitrgb bitrgbtags bitcmyk devicen spotcmyk xcf" 781 782while test -n "$drivers"; do 783 if echo $drivers |grep "," >/dev/null; then 784 THIS="`echo $drivers |sed -e 's/,.*//'`" 785 drivers="`echo $drivers |sed -e \"s/$THIS,//\"`" 786 else 787 THIS=$drivers 788 drivers="" 789 fi 790 case "$THIS" in 791 ALL) 792 # ALL = PRINTERS + FILES... 793 if test -z "$drivers"; then 794 drivers="PRINTERS,FILES" 795 else 796 drivers="$drivers,PRINTERS,FILES" 797 fi 798 ;; 799 PRINTERS) 800 P_DEVS="$P_DEVS $CANON_DEVS $EPSON_DEVS $HP_DEVS $LEXMARK_DEVS $BROTHER_DEVS $APPLE_DEVS $IBM_DEVS $OKI_DEVS $JAPAN_DEVS $MISC_PDEVS $OPVP_DEVS" 801 ;; 802 FILES) 803 F_DEVS="$F_DEVS $BMP_DEVS $FAX_DEVS $JPEG_DEVS $PNG_DEVS $TIFF_DEVS $PCX_DEVS $PBM_DEVS $PS_DEVS $WTS_HALFTONING_DEVS $MISC_FDEVS" 804 ;; 805 APPLE) 806 # All Apple printers 807 P_DEVS="$P_DEVS $APPLE_DEVS" 808 ;; 809 BMP) 810 # BMP file format 811 F_DEVS="$F_DEVS $BMP_DEVS" 812 ;; 813 CANON) 814 # All Canon printers 815 P_DEVS="$P_DEVS $CANON_DEVS" 816 ;; 817 EPSON) 818 # All Epson printers 819 P_DEVS="$P_DEVS $EPSON_DEVS" 820 ;; 821 FAX) 822 # Fax file formats 823 F_DEVS="$F_DEVS $FAX_DEVS" 824 ;; 825 JPEG) 826 # Jpeg file formats 827 F_DEVS="$F_DEVS $JPEG_DEVS" 828 ;; 829 PNG) 830 # PNG file formats 831 F_DEVS="$F_DEVS $PNG_DEVS" 832 ;; 833 TIFF) 834 # TIFF file formats 835 F_DEVS="$F_DEVS $TIFF_DEVS" 836 ;; 837 PCLXL) 838 # PCL XL/PCL 6 drivers 839 F_DEVS="$F_DEVS $PCLXL_DEVS" 840 ;; 841 PCX) 842 # PCX file formats 843 F_DEVS="$F_DEVS $PCX_DEVS" 844 ;; 845 PBM) 846 # PBM file formats 847 F_DEVS="$F_DEVS $PBM_DEVS" 848 ;; 849 HP) 850 # All HP printers 851 P_DEVS="$P_DEVS $HP_DEVS" 852 ;; 853 LEXMARK) 854 # All Lexmark printers 855 P_DEVS="$P_DEVS $LEXMARK_DEVS" 856 ;; 857 BROTHER) 858 # All Brother printers 859 P_DEVS="$P_DEVS $BROTHER_DEVS" 860 ;; 861 OKI) 862 # All OKI printers 863 P_DEVS="$P_DEVS $OKI_DEVS" 864 ;; 865 IBM) 866 # All IBM printers 867 P_DEVS="$P_DEVS $IBM_DEVS" 868 ;; 869 JAPAN) 870 # All old japanese printers 871 P_DEVS="$P_DEVS $JAPAN_DEVS" 872 ;; 873 PS) 874 # PostScript/PDF writing 875 F_DEVS="$F_DEVS $PS_DEVS" 876 ;; 877 WTS) 878 # WTS Halftoning devices 879 F_DEVS="$F_DEVS $WTS_HALFTONING_DEVS" 880 ;; 881 opvp) 882 # Open Vector Printing driver... 883 if test x$ac_cv_lib_dl_dlopen != xno -a x$found_iconv != xno; then 884 P_DEVS="$P_DEVS $OPVP_DEVS" 885 else 886 AC_MSG_WARN(Unable to include opvp/oprp driver due to missing prerequisites...) 887 fi 888 ;; 889 *) 890 # It's a driver name (or a user messup) 891 P_DEVS="$P_DEVS `echo $THIS |sed -e 's,\.dev$,,'`" 892 ;; 893 esac 894done 895# No need to include opvp/oprp driver without iconv/libiconv. 896if test -n "$P_DEVS"; then 897 if test x$found_iconv = xno ; then 898 P_DEVS=`echo $P_DEVS | sed -e 's|opvp||' -e 's|oprp||'` 899 AC_MSG_WARN(Unable to include opvp/oprp driver due to missing iconv/libiconv...) 900 fi 901 902# Remove contributed drivers if requested and make sure we don't have any 903# duplicates in there, add $(DD)foo.dev constructs 904 noncontribmakefiles=`find . -name '*.mak' -print | grep -v '^\./contrib/'` 905 PRINTERS=`(for i in $P_DEVS; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null ) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012' ' '` 906fi 907if test -n "$F_DEVS"; then 908 FILES=`(for i in $F_DEVS; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012' ' '` 909fi 910AC_SUBST(PRINTERS) 911AC_SUBST(FILES) 912 913dnl Dynamic device support. 914DYNAMIC_CFLAGS="" 915DYNAMIC_DEVS="" 916DYNAMIC_FLAGS="" 917DYNAMIC_LDFLAGS="" 918DYNAMIC_LIBS="" 919INSTALL_SHARED="" 920 921AC_ARG_ENABLE(dynamic, [ --enable-dynamic enable dynamically loaded drivers (default=no)], 922[ case `uname` in 923 Linux*) 924 INSTALL_SHARED="install-shared" 925 DYNAMIC_CFLAGS="-fPIC" 926 if test "x$X_DEVS" != x; then 927 DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so" 928 else 929 DYNAMIC_DEVS="" 930 fi 931 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 932 DYNAMIC_LDFLAGS="-fPIC -shared" 933 DYNAMIC_LIBS="-rdynamic -ldl" 934 X_DEVS="" 935 ;; 936 *BSD) 937 DYNAMIC_CFLAGS="-fPIC" 938 DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so" 939 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 940 DYNAMIC_LDFLAGS="-fPIC -shared" 941 DYNAMIC_LIBS="" 942 X_DEVS="" 943 ;; 944 Darwin*) 945 INSTALL_SHARED="install-shared" 946 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 947 DYNAMIC_LDFLAGS="-dynamiclib" 948 DYNAMIC_LIBS="" 949 X_DEVS="" 950 ;; 951 SunOS) 952 DYNAMIC_CFLAGS="-KPIC" 953 DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so" 954 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 955 DYNAMIC_LDFLAGS="-G" 956 DYNAMIC_LIBS="" 957 X_DEVS="" 958 ;; 959 *) 960 AC_MSG_ERROR([Sorry, dynamic driver support not available on this platform!]) 961 ;; 962 esac 963]) 964 965AC_SUBST(DYNAMIC_CFLAGS) 966AC_SUBST(DYNAMIC_DEVS) 967AC_SUBST(DYNAMIC_FLAGS) 968AC_SUBST(DYNAMIC_LDFLAGS) 969AC_SUBST(DYNAMIC_LIBS) 970AC_SUBST(INSTALL_SHARED) 971 972dnl look for default font path... 973AC_ARG_WITH(fontpath, [ --with-fontpath set font path for gs],fontpath="$withval",fontpath="") 974 975dnl Fix "prefix" variable... 976if test "x$prefix" = xNONE; then 977 prefix=/usr/local 978fi 979 980dnl Fix "datadir" variable... 981if test "x$datadir" = 'x${prefix}/share'; then 982 datadir="$prefix/share" 983fi 984 985dnl Fix "fontpath" variable... 986if test "x$fontpath" = "x"; then 987 # These font directories are used by various Linux distributions... 988 fontpath="$datadir/fonts/default/ghostscript" 989 fontpath="${fontpath}:$datadir/fonts/default/Type1" 990 fontpath="${fontpath}:$datadir/fonts/default/TrueType" 991 992 # These font directories are used by IRIX... 993 fontpath="${fontpath}:/usr/lib/DPS/outline/base" 994 995 # These font directories are used by Solaris... 996 fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/Type1" 997 fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/TrueType" 998 999 # This font directory is used by CUPS... 1000 if test "x$CUPSCONFIG" != x; then 1001 fontpath="${fontpath}:`$CUPSCONFIG --datadir`/fonts" 1002 fi 1003fi 1004 1005AC_SUBST(fontpath) 1006 1007dnl -------------------------------------------------- 1008dnl Check for library functions 1009dnl -------------------------------------------------- 1010 1011AC_CHECK_FUNCS([mkstemp], [HAVE_MKSTEMP=-DHAVE_MKSTEMP]) 1012AC_SUBST(HAVE_MKSTEMP) 1013 1014AC_CHECK_FUNCS([hypot], [HAVE_HYPOT=-DHAVE_HYPOT]) 1015AC_SUBST(HAVE_HYPOT) 1016 1017AC_CHECK_FUNCS([fopen64], [HAVE_FILE64=-DHAVE_FILE64]) 1018AC_SUBST(HAVE_FILE64) 1019 1020AC_CHECK_FUNCS([mkstemp64], [HAVE_MKSTEMP64=-DHAVE_MKSTEMP64]) 1021AC_SUBST(HAVE_MKSTEMP64) 1022 1023AC_PROG_GCC_TRADITIONAL 1024 1025dnl NB: We don't actually provide autoconf-switched fallbacks for any 1026dnl of these functions, so the checks are purely informational. 1027AC_FUNC_FORK 1028AC_FUNC_MALLOC 1029AC_FUNC_MEMCMP 1030AC_TYPE_SIGNAL 1031AC_FUNC_STAT 1032AC_FUNC_VPRINTF 1033AC_CHECK_FUNCS([bzero dup2 floor gettimeofday memchr memmove memset mkdir mkfifo modf pow putenv rint setenv sqrt strchr strerror strrchr strspn strstr]) 1034 1035dnl -------------------------------------------------- 1036dnl Do substitutions 1037dnl -------------------------------------------------- 1038 1039AC_SUBST(OPT_CFLAGS) 1040AC_SUBST(GCFLAGS) 1041AC_CONFIG_FILES([Makefile lib/gs_init.ps doc/version.texi cups/pstopxl cups/pstoraster]) 1042AC_OUTPUT 1043 1044chmod +x cups/pstopxl cups/pstoraster 1045