1dnl Copyright (C) 2001-2012 Artifex Software, Inc. 2dnl All Rights Reserved. 3dnl 4dnl This software is provided AS-IS with no warranty, either express or 5dnl implied. 6dnl 7dnl This software is distributed under license and may not be copied, 8dnl modified or distributed except as expressly authorized under the terms 9dnl of the license contained in the file LICENSE in this distribution. 10dnl 11dnl Refer to licensing information at http://www.artifex.com or contact 12dnl Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael, 13dnl CA 94903, U.S.A., +1(415)492-9861, for further information. 14 15 16dnl Process this file with autoconf to produce a configure script 17 18dnl ------------------------------------------------ 19dnl Initialization and Versioning 20dnl ------------------------------------------------ 21 22AC_INIT 23AC_PREREQ(2.52) 24AC_LANG(C) 25AC_CONFIG_SRCDIR(psi/gs.c) 26 27dnl Inherit compiler flags from the environment... 28CFLAGS="${CFLAGS:=}" 29CPPFLAGS="${CPPFLAGS:=}" 30CXXFLAGS="${CXXFLAGS:=}" 31LDFLAGS="${LDFLAGS:=}" 32 33dnl -------------------------------------------------- 34dnl Local utilities 35dnl -------------------------------------------------- 36 37dnl GS_SPLIT_LIBS( LIBS, LINKLINE ) 38dnl Split a unix-style link line into a list of 39dnl bare library names. For example, the line 40dnl '-L/usr/X11R6/lib -lX11 -lXt' splits into 41dnl LIB='X11 Xt' 42dnl 43AC_DEFUN([GS_SPLIT_LIBS], [ 44# the makefile wants a list of just the library names 45for gs_item in $2; do 46 gs_stripped_item=`echo "$gs_item" | sed -e 's/^-l//'` 47 if test "x$gs_stripped_item" != "x$gs_item"; then 48 $1="$[$1] $gs_stripped_item" 49 fi 50done 51]) 52 53dnl GS_SPLIT_LIBPATHS( LIBPATHS, LINKLINE ) 54dnl Split a unix-style link line into a list of 55dnl bare search path entries. For example, 56dnl '-L/usr/X11R6/lib -lX11 -L/opt/lib -lXt' 57dnl splits to LIBPATHS='/usr/X11R6/lib /opt/lib' 58dnl 59AC_DEFUN([GS_SPLIT_LIBPATHS], [ 60for gs_item in $2; do 61 gs_stripped_item=`echo "$gs_item" | sed -e 's/-L//'` 62 if test "x$gs_stripped_item" != "x$gs_item"; then 63 $1="$[$1] $gs_stripped_item" 64 fi 65done 66]) 67 68dnl -------------------------------------------------- 69dnl Check for programs 70dnl -------------------------------------------------- 71 72dnl AC_PROG_CC likes to add '-g -O2' to CFLAGS. however, 73dnl we ignore those flags and construct our own. 74save_cflags=$CFLAGS 75AC_PROG_CC 76AC_PROG_CPP 77CFLAGS=$save_cflags 78 79AC_PROG_SED 80dnl See if it is GNU sed or else. 81dnl - need more work to tell SED features. 82SED_EXTENDED_REGEX_OPT=-nre 83sed_variant=`sed --version 2>&1` 84sed_variant=`echo $sed_variant|sed -e 's/ .*//'` 85if test "$sed_variant" != GNU ; then 86SED_EXTENDED_REGEX_OPT=-nEe 87fi 88AC_SUBST(SED_EXTENDED_REGEX_OPT) 89 90AC_PROG_RANLIB 91#AC_PROG_INSTALL 92 93dnl pkg-config is used for several tests now... 94AC_PATH_PROG(PKGCONFIG, pkg-config) 95 96dnl -------------------------------------------------- 97dnl Allow excluding the contributed drivers 98dnl -------------------------------------------------- 99 100AC_ARG_ENABLE([contrib], AC_HELP_STRING([--disable-contrib], 101 [Do not include contributed drivers])) 102CONTRIBINCLUDE="include contrib/contrib.mak" 103INSTALL_CONTRIB="install-contrib-extras" 104 105case `uname` in 106 MINGW*) 107 AC_MSG_WARN([disabling contrib devices]) 108 enable_contrib=no 109 ;; 110 *) 111# This is just an arbitrary file in contrib to check 112 if !(test -f contrib/gdevbjc_.c); then 113 enable_contrib=no 114 fi 115 ;; 116esac 117 118if test x$enable_contrib = xno; then 119 CONTRIBINCLUDE="" 120 INSTALL_CONTRIB="" 121 CFLAGS="$CFLAGS -DNOCONTRIB" 122fi 123AC_SUBST(CONTRIBINCLUDE) 124AC_SUBST(INSTALL_CONTRIB) 125 126dnl -------------------------------------------------- 127dnl Set build flags based on environment 128dnl -------------------------------------------------- 129 130#AC_CANONICAL_HOST 131 132CC_OPT_FLAGS_TO_TRY="-O" 133SET_DT_SONAME="-soname=" 134SO_FOR_MAC="" 135 136case `uname` in 137 Linux*|GNU*) 138 if test $ac_cv_prog_gcc = yes; then 139 CC_OPT_FLAGS_TO_TRY="-O2" 140 CC_DBG_FLAGS_TO_TRY="-g -O0" 141 fi 142 ;; 143 *BSD|DragonFly) 144 if test $ac_cv_prog_gcc = yes; then 145 CC_OPT_FLAGS_TO_TRY="-O2" 146 CC_DBG_FLAGS_TO_TRY="-g -O0" 147 fi 148 ;; 149 Darwin*) 150 if test $ac_cv_prog_gcc = yes; then 151 CC_OPT_FLAGS_TO_TRY="-O2" 152 CC_DBG_FLAGS_TO_TRY="-g -O0" 153 fi 154 SET_DT_SONAME="" 155 SO_FOR_MAC="_1" 156 ;; 157 SunOS) 158 CC_OPT_FLAGS_TO_TRY="-O2" 159 # the trailing space is required! 160 if test $ac_cv_prog_gcc = no; then 161 SET_DT_SONAME="-h " 162 fi 163 CC_DBG_FLAGS_TO_TRY="-g -O0" 164 ;; 165esac 166 167AC_SUBST(SET_DT_SONAME) 168AC_SUBST(SO_FOR_MAC) 169 170 171if test $ac_cv_prog_gcc = yes; then 172 cflags_to_try="-Wall -Wstrict-prototypes -Wundef \ 173-Wmissing-declarations -Wmissing-prototypes -Wwrite-strings \ 174-Wno-strict-aliasing -Wdeclaration-after-statement \ 175-fno-builtin -fno-common" 176 optflags_to_try="$CC_OPT_FLAGS_TO_TRY" 177 dbgflags_to_try="$CC_DBG_FLAGS_TO_TRY" 178else 179 cflags_to_try= 180 optflags_to_try="$CC_OPT_FLAGS_TO_TRY" 181 dbgflags_to_try="$CC_DBG_FLAGS_TO_TRY" 182fi 183 184# debug configurarion is available by default with "make debug" 185#AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], 186# [turn on debugging])) 187#if test x$enable_debug = xyes; then 188# optflags_to_try="-g" 189# CFLAGS="-DDEBUG $CFLAGS" 190#fi 191 192AC_MSG_CHECKING([supported compiler flags]) 193old_cflags=$CFLAGS 194echo 195for flag in $optflags_to_try; do 196 CFLAGS="$CFLAGS $flag" 197 AC_TRY_COMPILE(, [return 0;], [ 198 echo " $flag" 199 OPT_CFLAGS="$OPT_CFLAGS $flag" 200 ]) 201 CFLAGS=$old_cflags 202done 203for flag in $cflags_to_try; do 204 CFLAGS="$CFLAGS $flag" 205 AC_TRY_COMPILE(, [return 0;], [ 206 echo " $flag" 207 GCFLAGS="$GCFLAGS $flag" 208 ]) 209 CFLAGS=$old_cflags 210done 211old_cflags=$CFLAGS 212echo 213for flag in $dbgflags_to_try; do 214 CFLAGS="$CFLAGS $flag" 215 AC_TRY_COMPILE(, [return 0;], [ 216 echo " $flag" 217 DBG_CFLAGS="$DBG_CFLAGS $flag" 218 ]) 219 CFLAGS=$old_cflags 220done 221 222AC_MSG_RESULT([ ...done.]) 223 224dnl -------------------------------------------------- 225dnl Check for headers 226dnl -------------------------------------------------- 227 228AC_HEADER_DIRENT 229AC_HEADER_STDC 230AC_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 sys/times.h syslog.h unistd.h dirent.h ndir.h sys/dir.h sys/ndir.h]) 231 232dnl -------------------------------------------------- 233dnl Check for *BSD and apply BSD Make workaround 234dnl - BSD Make treats obj special and cd into it first. 235dnl -------------------------------------------------- 236 237OBJDIR_BSDMAKE_WORKAROUND=obj 238 239case `uname` in 240 *BSD|DragonFly) 241 OBJDIR_BSDMAKEWORKAOROUND="notobj" 242 ;; 243esac 244AC_SUBST(OBJDIR_BSDMAKE_WORKAROUND) 245 246# for gdev3b1.c (AT&T terminal interface) 247AC_CHECK_HEADER([sys/window.h]) 248 249dnl -------------------------------------------------- 250dnl Check for typedefs, structures, etc 251dnl -------------------------------------------------- 252 253AC_C_CONST 254AC_C_INLINE 255AC_TYPE_MODE_T 256AC_TYPE_OFF_T 257AC_TYPE_SIZE_T 258AC_STRUCT_ST_BLOCKS 259AC_HEADER_TIME 260AC_STRUCT_TM 261 262dnl see if we're on a system that puts the *int*_t types 263dnl from stdint.h in sys/types.h 264if test "x$ac_cv_header_stdint_h" != xyes; then 265 AC_CHECK_TYPES([int8_t, int16_t, int32_t, uint8_t, uint16_t, uint32_t],,,[#include <sys/types.h>]) 266 if test "$ac_cv_type_uint8_t" = yes; then 267 AC_DEFINE([SYS_TYPES_HAS_STDINT_TYPES]) 268 GCFLAGS="$GCFLAGS -DSYS_TYPES_HAS_STDINT_TYPES" 269 fi 270fi 271 272dnl we aren't interested in all of DEFS, so manually insert 273dnl the flags we care about 274if test "$ac_cv_c_const" != yes; then 275 GCFLAGS="$GCFLAGS -Dconst=" 276fi 277if test "x$ac_cv_header_stdint_h" = xyes; then 278 GCFLAGS="$GCFLAGS -DHAVE_STDINT_H=1" 279fi 280 281if test "x$ac_cv_header_dirent_h" = xyes; then 282 GCFLAGS="$GCFLAGS -DHAVE_DIRENT_H=1" 283fi 284 285if test "x$ac_cv_header_ndir_h" = xyes; then 286 GCFLAGS="$GCFLAGS -DHAVE_NDIR_H=1" 287fi 288 289if test "x$ac_cv_header_sys_dir_h" = xyes; then 290 GCFLAGS="$GCFLAGS -DHAVE_SYS_DIR_H=1" 291fi 292 293if test "x$ac_cv_header_sys_ndir_h" = xyes; then 294 GCFLAGS="$GCFLAGS -DHAVE_SYS_NDIR_H=1" 295fi 296 297if test "x$ac_cv_header_sys_time_h" = xyes; then 298 GCFLAGS="$GCFLAGS -DHAVE_SYS_TIME_H=1" 299fi 300 301if test "x$ac_cv_header_sys_times_h" = xyes; then 302 GCFLAGS="$GCFLAGS -DHAVE_SYS_TIMES_H=1" 303fi 304 305dnl try to find a 64 bit type for devicen color index 306uint64_type="none" 307 AC_CHECK_SIZEOF(unsigned long int) 308 if test $ac_cv_sizeof_unsigned_long_int = 8; then 309 uint64_type="unsigned long int" 310 else 311 AC_CHECK_SIZEOF(unsigned long long) 312 if test $ac_cv_sizeof_unsigned_long_long = 8; then 313 uint64_type="unsigned long long" 314 else 315 AC_CHECK_SIZEOF(unsigned __int64) 316 if test $ac_cv_sizeof_unsigned___int64 = 8; then 317 uint64_type="unsigned __int64" 318 else 319 AC_CHECK_SIZEOF(u_int64_t) 320 if test $ac_cv_sizeof_u_int64_t = 8; then 321 uint64_type="u_int64_t" 322 fi 323 fi 324 fi 325 fi 326dnl we don't need to do anything if a 64-bit type wasn't found 327dnl the code falls back to a (probably 32-bit) default 328if test "$uint64_type" != "none"; then 329 GCFLAGS="$GCFLAGS -DGX_COLOR_INDEX_TYPE=\"$uint64_type\"" 330fi 331 332dnl -------------------------------------------------- 333dnl Set options that we want to pass into all other 334dnl configure scripts we might call 335dnl -------------------------------------------------- 336 337SUBCONFIG_OPTS="" 338 339if test x$build_alias != x; then 340SUBCONFIG_OPTS="$SUBCONFIG_OPTS --build=$build_alias" 341fi 342 343 344dnl -------------------------------------------------- 345dnl Check for libraries 346dnl -------------------------------------------------- 347 348AC_CHECK_LIB(m, cos) 349 350SYNC="nosync" 351PTHREAD_LIBS="" 352 353case `uname` in 354 MINGW*) 355 AC_MSG_WARN([disabling support for pthreads......]) 356 ;; 357 *) 358 AC_CHECK_LIB(pthread, pthread_create, [ 359 SYNC=posync; 360 PTHREAD_LIBS="-lpthread" 361 ]) 362 ;; 363esac 364 365AC_SUBST(SYNC) 366AC_SUBST(PTHREAD_LIBS) 367 368dnl Tests for iconv (Needed for OpenPrinting Vector, "opvp" output device) 369AC_ARG_WITH(libiconv, 370 [AC_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@], 371 [use the libiconv library])],, 372 [with_libiconv=maybe]) 373found_iconv=no 374case $with_libiconv in 375 maybe) 376 # Check in the C library first 377 AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes]) 378 # Check if we have GNU libiconv 379 if test $found_iconv = "no"; then 380 AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) 381 fi 382 # Check if we have a iconv in -liconv, possibly from vendor 383 if test $found_iconv = "no"; then 384 AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) 385 fi 386 ;; 387 no) 388 found_iconv=no 389 ;; 390 gnu|yes) 391 AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes]) 392 ;; 393 native) 394 AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes]) 395 ;; 396esac 397if test x$found_iconv != xno -a x$with_libiconv != xno ; then 398 LIBS="$LIBS -liconv" 399fi 400 401case $with_libiconv in 402 gnu) 403 AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv]) 404 CFLAGS="$CFLAGS -DUSE_LIBICONV_GNU" 405 ;; 406 native) 407 AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library]) 408 ;; 409esac 410 411dnl Check for libidn (needed for Unicode password support) 412AC_ARG_WITH(libidn, 413 [AC_HELP_STRING([--without-libidn], 414 [Do not use libidn to support Unicode passwords])],, 415 [with_libidn=maybe]) 416if test x$with_libidn != xno; then 417 AC_CHECK_LIB(idn, stringprep, [ 418 with_libidn=no 419 AC_CHECK_HEADER([stringprep.h], [with_libidn=yes]) 420 ], [ 421 if test x$with_libidn != xmaybe; then 422 AC_MSG_ERROR([libidn not found]) 423 fi 424 with_libidn=no 425 ]) 426fi 427HAVE_LIBIDN='' 428UTF8DEVS='' 429if test x$with_libidn != xno; then 430 HAVE_LIBIDN=-DHAVE_LIBIDN 431 LIBS="$LIBS -lidn" 432 433 if test x$found_iconv != xno; then 434 UTF8DEVS='$(PSD)utf8.dev' 435 fi 436fi 437AC_SUBST(HAVE_LIBIDN) 438AC_SUBST(UTF8DEVS) 439 440dnl Tests for libpaper (to determine system default paper size) 441AC_ARG_WITH([libpaper], 442 AC_HELP_STRING([--without-libpaper], 443 [disable libpaper support])) 444if test x$with_libpaper != xno; then 445 AC_CHECK_LIB(paper, systempapername, [with_libpaper=yes], 446 [ 447 AC_MSG_WARN([disabling support for libpaper]) 448 with_libpaper=no 449 ]) 450fi 451if test x$with_libpaper != xno; then 452 AC_CHECK_HEADER([paper.h], [with_libpaper=yes], 453 [ 454 AC_MSG_WARN([disabling support for libpaper]) 455 with_libpaper=no 456 ]) 457fi 458 459if test x$with_libpaper != xno; then 460 LIBS="$LIBS -lpaper" 461 AC_DEFINE(USE_LIBPAPER, 1, [Using libpaper]) 462 CFLAGS="$CFLAGS -DUSE_LIBPAPER" 463fi 464 465dnl Fontconfig support 466HAVE_FONTCONFIG="" 467FONTCONFIG_CFLAGS="" 468FONTCONFIG_LIBS="" 469AC_ARG_ENABLE([fontconfig], AC_HELP_STRING([--disable-fontconfig], 470 [Do not use fontconfig to list system fonts])) 471if test "$enable_fontconfig" != "no"; then 472 # We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard 473 # autoconf macro and b) requires pkg-config on the system, which is 474 # NOT standard on ANY OS, including Linux! 475 if test "x$PKGCONFIG" != x; then 476 AC_MSG_CHECKING(for fontconfig with pkg-config) 477 if $PKGCONFIG --exists fontconfig; then 478 AC_MSG_RESULT(yes) 479 FONTCONFIG_CFLAGS="$CFLAGS `$PKGCONFIG --cflags fontconfig`" 480 FONTCONFIG_LIBS="`$PKGCONFIG --libs fontconfig`" 481 HAVE_FONTCONFIG=-DHAVE_FONTCONFIG 482 else 483 AC_MSG_RESULT(no) 484 fi 485 fi 486 if test -z "$HAVE_FONTCONFIG"; then 487 AC_CHECK_LIB([fontconfig], [FcInitLoadConfigAndFonts], [ 488 AC_CHECK_HEADER([fontconfig/fontconfig.h], [ 489 FONTCONFIG_LIBS="-lfontconfig" 490 HAVE_FONTCONFIG="-DHAVE_FONTCONFIG" 491 ]) 492 ]) 493 fi 494fi 495AC_SUBST(HAVE_FONTCONFIG) 496AC_SUBST(FONTCONFIG_CFLAGS) 497AC_SUBST(FONTCONFIG_LIBS) 498 499dnl DBus support 500HAVE_DBUS="" 501DBUS_CFLAGS="" 502DBUS_LIBS="" 503AC_ARG_ENABLE([dbus], AC_HELP_STRING([--disable-dbus], 504 [Do not use dbus to communicate with external services])) 505if test "$enable_dbus" != "no"; then 506 if test "x$PKGCONFIG" != x; then 507 AC_MSG_CHECKING(for dbus with pkg-config) 508 if $PKGCONFIG --exists dbus-1; then 509 AC_MSG_RESULT(yes) 510 DBUS_CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1`" 511 DBUS_LIBS="`$PKGCONFIG --libs dbus-1`" 512 HAVE_DBUS=-DHAVE_DBUS 513 else 514 AC_MSG_RESULT(no) 515 fi 516 fi 517 if test -z "$HAVE_DBUS"; then 518 AC_CHECK_LIB([dbus], [dbus_message_iter_get_basic], [ 519 AC_CHECK_HEADER([dbus-1.0/dbus/dbus.h], [ 520 DBUS_LIBS="-ldbus-1 -lpthread -lrt" 521 HAVE_DBUS="-DHAVE_DBUS" 522 ]) 523 ]) 524 fi 525fi 526AC_SUBST(HAVE_DBUS) 527AC_SUBST(DBUS_CFLAGS) 528AC_SUBST(DBUS_LIBS) 529 530AC_CHECK_LIB(dl, dlopen) 531 532AC_ARG_ENABLE([freetype], AC_HELP_STRING([--disable-freetype], 533 [Disable freetype for font rasterization])) 534FT_BRIDGE=0 535SHARE_FT=0 536FTSRCDIR= 537FT_CFLAGS= 538FT_LIBS= 539 540dnl UFST detection 541AC_ARG_WITH([ufst], AC_HELP_STRING([--with-ufst=UFST_ROOT_DIR], 542 [Use UFST]), 543 [], [with_ufst=no]) 544INSERT_UFST_BRIDGE_EQUAL_ONE= 545UFST_ROOT= 546UFST_CFLAGS= 547UFST_LIB_EXT= 548if test -d $with_ufst; then 549INSERT_UFST_BRIDGE_EQUAL_ONE="UFST_BRIDGE=1" 550UFST_ROOT=$with_ufst 551UFST_CFLAGS=-DGCCx86 552UFST_LIB_EXT=.a 553fi 554AC_SUBST(INSERT_UFST_BRIDGE_EQUAL_ONE) 555AC_SUBST(UFST_ROOT) 556AC_SUBST(UFST_CFLAGS) 557AC_SUBST(UFST_LIB_EXT) 558 559if test x"$enable_freetype" != xno; then 560 AC_MSG_CHECKING([for local freetype library source]) 561 dnl We prefer freetype2 over freetype, so it is easy to override 562 dnl the included freetype source with a checkout from upstream. 563 for dir in freetype2 freetype; do 564 if test -f $dir/src/base/ftbbox.c; then 565 AC_MSG_RESULT(yes) 566 SHARE_FT=0 567 FTSRCDIR="$dir" 568 FT_CFLAGS="-I$dir/include" 569 FT_BRIDGE=1 570 break; 571 fi 572 done 573 if test -z $FTSRCDIR; then 574 AC_MSG_RESULT([no]) 575 if test "x$PKGCONFIG" != x; then 576 AC_MSG_CHECKING(for system freetype2 >= 2.4.2 with pkg-config) 577 # pkg-config needs the libtool version, which != the freetype2 version <sigh!> 578 # There is a table of corresponding ft2<->libtool numbers in freetype/docs/VERSION.DLL 579 if $PKGCONFIG --atleast-version=12.0.6 freetype2; then 580 AC_MSG_RESULT(yes) 581 FT_CFLAGS="$CFLAGS `$PKGCONFIG --cflags freetype2`" 582 FT_LIBS="`$PKGCONFIG --libs freetype2`" 583 FT_BRIDGE=1 584 SHARE_FT=1 585 else 586 AC_MSG_RESULT(no) 587 AC_MSG_WARN([freetype library source not found...using native rasterizer]) 588 AFS=1 589 fi 590 else 591 AC_CHECK_HEADER([ft2build.h], [FT_BRIDGE=1], [AFS=1]) 592 593 if test "x$FT_BRIDGE" = x1; then 594 AC_CHECK_LIB(freetype, FT_Init_FreeType, 595 [FT_BRIDGE=1], [FT_BRIDGE=0; AFS=1]) 596 597 if test "x$FT_BRIDGE" = x1; then 598 AC_MSG_CHECKING(for system freetype2 library >= 2.4.2) 599 AC_COMPILE_IFELSE( 600 [AC_LANG_PROGRAM([#include "ft2build.h" 601 #include FT_FREETYPE_H], [ 602 #if FREETYPE_MAJOR < 2 603 FAIL 604 #endif 605 #if FREETYPE_MINOR < 4 606 FAIL 607 #endif 608 #if FREETYPE_PATCH < 2 609 FAIL 610 #endif 611 return(0); 612 ])], 613 [FT_BRIDGE=1;AC_MSG_RESULT(yes)], [FT_BRIDGE=0; AFS=1;AC_MSG_RESULT(no)]) 614 fi 615 fi 616 617 fi 618 fi 619fi 620AC_SUBST(FT_BRIDGE) 621AC_SUBST(SHARE_FT) 622AC_SUBST(FTSRCDIR) 623AC_SUBST(FT_CFLAGS) 624AC_SUBST(FT_LIBS) 625 626AC_MSG_CHECKING([for local jpeg library source]) 627dnl At present, we give the local source priority over the shared 628dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied. 629dnl A more sophisticated approach would be to test the shared lib 630dnl to see whether it has already been patched. 631LIBJPEGDIR=src 632if test -f jpeg/jpeglib.h; then 633 AC_MSG_RESULT([jpeg]) 634 SHARE_LIBJPEG=0 635 LIBJPEGDIR=jpeg 636elif test -f jpeg-6b/jpeglib.h; then 637 AC_MSG_RESULT([jpeg-6b]) 638 SHARE_LIBJPEG=0 639 LIBJPEGDIR=jpeg-6b 640else 641 AC_MSG_RESULT([no]) 642 AC_CHECK_LIB(jpeg, jpeg_set_defaults, [ 643 AC_CHECK_HEADERS([jpeglib.h], [SHARE_LIBJPEG=1]) 644 ]) 645fi 646if test -z "$SHARE_LIBJPEG"; then 647 AC_MSG_ERROR([I wasn't able to find a copy 648 of the jpeg library. This is required for compiling 649 ghostscript. Please download a copy of the source, 650 e.g. from http://www.ijg.org/, unpack it at the 651 top level of the gs source tree, and rename 652 the directory to 'jpeg'. 653 ]) 654fi 655AC_SUBST(SHARE_LIBJPEG) 656AC_SUBST(LIBJPEGDIR) 657dnl check for the internal jpeg memory header 658AC_MSG_CHECKING([for jmemsys.h]) 659if test -r $LIBJPEGDIR/jmemsys.h; then 660 AC_MSG_RESULT([yes]) 661else 662 AC_MSG_RESULT([no]) 663 AC_DEFINE([DONT_HAVE_JMEMSYS_H], 1, 664 [define if the libjpeg memory system prototypes aren't available]) 665fi 666 667AC_MSG_CHECKING([for local zlib source]) 668dnl zlib is needed for language level 3, and libpng 669# we must define ZLIBDIR regardless because png.mak does a -I$(ZLIBDIR) 670# this seems a harmless default 671ZLIBDIR=src 672AUX_SHARED_ZLIB= 673 674if test -d zlib; then 675 AC_MSG_RESULT([yes]) 676 SHARE_ZLIB=0 677 ZLIBDIR=zlib 678else 679 AC_MSG_RESULT([no]) 680 AC_CHECK_LIB(z, deflate, [ 681 AC_CHECK_HEADERS(zlib.h, [SHARE_ZLIB=1; AUX_SHARED_ZLIB="-l\$(ZLIB_NAME)"]) 682 ]) 683fi 684if test -z "$SHARE_ZLIB"; then 685 AC_MSG_ERROR([I did not find a copy of zlib on your system. 686 Please either install it, or unpack a copy of the source in a 687 local directory named 'zlib'. See http://www.gzip.org/zlib/ 688 for more information. 689 ]) 690fi 691 692dnl if GS is to use the system zlib, freetype 693dnl should do the same 694FT_SYS_ZLIB="" 695if test x$FT_BRIDGE != x0; then 696 if test xx$SHARE_FT != x1; then 697 if test x$SHARE_ZLIB != x0; then 698 FT_SYS_ZLIB="-DFT_CONFIG_OPTION_SYSTEM_ZLIB" 699 fi 700 fi 701fi 702 703AC_SUBST(SHARE_ZLIB) 704AC_SUBST(AUX_SHARED_ZLIB) 705AC_SUBST(ZLIBDIR) 706AC_SUBST(FT_SYS_ZLIB) 707 708dnl png for the png output device; it also requires zlib 709LIBPNGDIR=src 710PNGDEVS='' 711PNGDEVS_ALL='png48 png16m pnggray pngmono png256 png16 pngalpha' 712AC_MSG_CHECKING([for local png library source]) 713if test -f libpng/pngread.c; then 714 AC_MSG_RESULT([yes]) 715 SHARE_LIBPNG=0 716 LIBPNGDIR=libpng 717 PNGDEVS="$PNGDEVS_ALL" 718else 719 AC_MSG_RESULT([no]) 720 AC_CHECK_LIB(png, png_create_write_struct, [ 721 AC_CHECK_HEADERS(png.h, [ 722 SHARE_LIBPNG=1 723 PNGDEVS="$PNGDEVS_ALL" 724 ], [SHARE_LIBPNG=0]) 725 ], [SHARE_LIBPNG=0], [-lz]) 726fi 727if test -z "$PNGDEVS"; then 728 AC_MSG_NOTICE([disabling png output devices]) 729fi 730AC_SUBST(SHARE_LIBPNG) 731AC_SUBST(LIBPNGDIR) 732#AC_SUBST(PNGDEVS) 733 734WHICHLCMS= 735 736AC_ARG_WITH([lcms], AC_HELP_STRING([--with-lcms], 737 [try to use LittleCMS 1.x instead of the default of LittleCMS 2.x])) 738 739if test x$with_lcms != xyes; then 740 AC_MSG_CHECKING([for local lcms2 library source]) 741 LCMS2DIR=lcms2 742 if test -f $LCMS2DIR/include/lcms2.h; then 743 AC_MSG_RESULT([yes]) 744 SHARELCMS=0 745 WHICHLCMS=lcms2 746 else 747 AC_MSG_RESULT([no]) 748 AC_MSG_CHECKING([for system lcms2 library]) 749 AC_CHECK_LIB(lcms2, cmsCreateXYZProfile, [ 750 AC_CHECK_HEADERS([lcms2.h], [LCMS2DIR="";SHARELCMS=1;WHICHLCMS=lcms2]) 751 ]) 752 fi 753fi 754 755if test x$WHICHLCMS = x; then 756 AC_MSG_CHECKING([for local lcms library source]) 757 LCMSDIR=lcms 758 SHARELCMS=0 759 if test -f $LCMSDIR/include/lcms.h; then 760 AC_MSG_RESULT([yes]) 761 SHARELCMS=0 762 WHICHLCMS=lcms 763 else 764 765 AC_MSG_ERROR([LittleCMS source not found!]) 766 #AC_CHECK_LIB(lcms, cmsCreateXYZProfile, [ 767 # AC_CHECK_HEADERS([lcms.h], [SHARELCMS=1;LCMSDIR=""]) 768 # ]) 769 fi 770fi 771 772AC_SUBST(SHARELCMS) 773AC_SUBST(WHICHLCMS) 774AC_SUBST(LCMSDIR) 775AC_SUBST(LCMS2DIR) 776 777dnl look for libtiff, it also requires lib 778dnl png for the png output device; it also requires zlib 779AC_ARG_WITH([system-libtiff], AC_HELP_STRING([--with-system-libtiff], 780 [Force using the systems libtiff]), 781 [], [with_system_libtiff=check]) 782TIFFDEVS='' 783FAX_DEVS='' 784TIFFDEVS_ALL='tiffs tiff12nc tiff24nc tiff48nc tiff32nc tiff64nc tiffcrle tifflzw tiffpack tiffgray tiffsep tiffscaled' 785FAX_DEVS_ALL='cfax dfaxlow dfaxhigh fax faxg3 faxg32d faxg4 tiffg3 tiffg32d tiffg4 tfax' 786case "x$with_system_libtiff" in 787 xcheck) 788 if test -d tiff; then 789 LIBTIFFDIR=tiff 790 HAVE_LOCAL_LIBTIFF=1 791 SHARE_LIBTIFF=0 792 else 793 # We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard 794 # autoconf macro and b) requires pkg-config on the system, which is 795 # NOT standard on ANY OS, including Linux! 796 if test "x$PKGCONFIG" != x; then 797 AC_MSG_CHECKING(for libtiff with pkg-config) 798 if $PKGCONFIG --exists libtiff-4; then 799 AC_MSG_RESULT(yes) 800 CFLAGS="$CFLAGS `$PKGCONFIG --cflags libtiff-4`" 801 LIBS="$LIBS `$PKGCONFIG --libs libtiff-4`" 802 HAVE_SYSTEM_LIBTIFF=1 803 fi 804 fi 805 if test -z "$HAVE_SYSTEM_LIBTIFF"; then 806 AC_CHECK_LIB(tiff, TIFFOpen, 807 [AC_CHECK_HEADERS(tiff.h, [HAVE_SYSTEM_LIBTIFF=1;SHARE_LIBTIFF=1])], 808 [], [-ljpeg]) 809 fi 810 fi 811 if test "x$HAVE_LOCAL_LIBTIFF" = x && test "x$HAVE_SYSTEM_LIBTIFF" = x; then 812 AC_MSG_NOTICE([Could not find a copy of libtiff on your system. 813Disabling tiff output devices.]) 814 else 815 TIFFDEVS="$TIFFDEVS_ALL" 816 FAX_DEVS="$FAX_DEVS_ALL" 817 fi 818 ;; 819 xyes) 820 # We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard 821 # autoconf macro and b) requires pkg-config on the system, which is 822 # NOT standard on ANY OS, including Linux! 823 if test "x$PKGCONFIG" != x; then 824 AC_MSG_CHECKING(for libtiff with pkg-config) 825 if $PKGCONFIG --exists libtiff-4; then 826 AC_MSG_RESULT(yes) 827 CFLAGS="$CFLAGS `$PKGCONFIG --cflags libtiff-4`" 828 LIBS="$LIBS `$PKGCONFIG --libs libtiff-4`" 829 HAVE_SYSTEM_LIBTIFF=1 830 fi 831 fi 832 if test -z "$HAVE_SYSTEM_LIBTIFF"; then 833 AC_CHECK_LIB(tiff, TIFFOpen, 834 [AC_CHECK_HEADERS(tiff.h, [HAVE_SYSTEM_LIBTIFF=1;SHARE_LIBTIFF=1])], 835 [], [-ljpeg]) 836 fi 837 if test "x$HAVE_SYSTEM_LIBTIFF" != x; then 838 SHARE_LIBTIFF=1 839 TIFFDEVS="$TIFFDEVS_ALL" 840 FAX_DEVS="$FAX_DEVS_ALL" 841 else 842 AC_MSG_NOTICE([Could not find a copy of libtiff on your system. 843Disabling tiff output devices.]) 844 fi 845 ;; 846 xno) 847 AC_MSG_CHECKING([for local libtiff source]) 848 if test -d tiff; then 849 AC_MSG_RESULT([yes]) 850 LIBTIFFDIR=tiff 851 SHARE_LIBTIFF=0 852 TIFFDEVS="$TIFFDEVS_ALL" 853 FAX_DEVS="$FAX_DEVS_ALL" 854 else 855 AC_MSG_RESULT([no]) 856 AC_MSG_NOTICE([Could not find local copy of libtiff. 857Disabling tiff output devices.]) 858 fi 859 ;; 860esac 861 862if test $SHARE_LIBTIFF -eq 0; then 863 echo 864 echo "Running libtiff configure script..." 865 olddir=`pwd` 866 cd $LIBTIFFDIR && ./configure --disable-jbig --disable-lzma $SUBCONFIG_OPTS 867 status=$? 868 if test "$status" -ne 0 ; then 869 AC_MSG_ERROR([libtiff configure script failed], $status) 870 fi 871 cd $olddir 872 echo 873 echo "Continuing with Ghostscript configuration..." 874fi 875 876AC_SUBST(SHARE_LIBTIFF) 877AC_SUBST(LIBTIFFDIR) 878 879 880dnl look for CUPS... 881AC_ARG_ENABLE([cups], AC_HELP_STRING([--disable-cups], 882 [Do not include CUPS support])) 883 884AC_ARG_WITH([pdftoraster], AC_HELP_STRING([--without-pdftoraster], 885 [Do not include CUPS' pdftoraster filter])) 886 887AC_ARG_WITH([local-cups], AC_HELP_STRING([--with-local-cups], 888 [Force using the GS supplied cups code - only useful for debugging]), 889 [with_local_cups=yes], [with_local_cups=no]) 890 891AC_ARG_WITH([install-cups], AC_HELP_STRING([--with-install-cups], 892 [Install the cups conversion tools]), 893 [CUPSINSTALL=install-cups], [CUPSINSTALL=]) 894 895AC_ARG_WITH([cups-serverbin], AC_HELP_STRING([--with-cups-serverbin], 896 [override the "cups-config --serverbin" path]), CUPS_SERVERBIN="$withval", CUPS_SERVERBIN="") 897 898AC_ARG_WITH([cups-serverroot], AC_HELP_STRING([--with-cups-serverroot], 899 [override the "cups-config --serverroot" path]), CUPS_SERVERROOT="$withval", CUPS_SERVERROOT="") 900 901 902AC_ARG_WITH([cups-datadir], AC_HELP_STRING([--with-cups-datadir], 903 [override the "cups-config --datadir" path]), CUPS_DATADIR="$withval", CUPS_DATADIR="") 904 905CUPSDEV="" 906CUPSINCLUDE="" 907CUPSCFLAGS="" 908CUPSLIBS="" 909CUPSLIBDIRS="" 910CUPSCONFIG="${CUPSCONFIG:=}" 911CUPSSERVERBIN="" 912CUPSSERVERROOT="" 913CUPSDATA="" 914CUPSVERSION="0" 915CUPSPDFTORASTER="0" 916 917SHARELCUPS=1 918SHARELCUPSI=1 919 920if ( test -d cups ); then 921 if test x$enable_cups != xno; then 922 if test x$with_local_cups != xyes; then 923 AC_PATH_PROG(CUPSCONFIG,cups-config) 924 AC_CHECK_HEADER([cups/raster.h],[],[CUPSCONFIG=""]) 925 if test "x$CUPSCONFIG" != x; then 926 dnl Use values from CUPS config... 927 CUPSCFLAGS="`$CUPSCONFIG --cflags` $CFLAGS" 928# CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --static --image --libs | sed -e '1,$s/-lssl//'` $LIBS" 929 CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --image --libs`" 930 GS_SPLIT_LIBS([CUPSLIBS], [$CUPSLINK]) 931 GS_SPLIT_LIBPATHS([CUPSLIBDIRS],[$CUPSLINK]) 932 933 if test "x$CUPS_SERVERROOT" != "x"; then 934 CUPSSERVERROOT="$CUPS_SERVERROOT" 935 else 936 CUPSSERVERROOT="`$CUPSCONFIG --serverroot`" 937 fi 938 939 if test "x$CUPS_SERVERBIN" != "x"; then 940 CUPSSERVERBIN="$CUPS_SERVERBIN" 941 else 942 CUPSSERVERBIN="`$CUPSCONFIG --serverbin`" 943 fi 944 945 if test "x$CUPS_DATADIR" != "x"; then 946 CUPSDATA="$CUPS_DATADIR" 947 else 948 CUPSDATA="`$CUPSCONFIG --datadir`" 949 fi 950 951 CUPSINCLUDE="include cups/cups.mak" 952 CUPSDEV="cups" 953 CUPSVERSION="`$CUPSCONFIG --version`" 954 LCUPSINCLUDE="include \$(GLSRCDIR)/lcups.mak" 955 LCUPSIINCLUDE="include \$(GLSRCDIR)/lcupsi.mak" 956 if ( test x$with_pdftoraster != xno ); then 957 if test "$CUPSVERSION" ">" "1.2"; then 958 CUPSPDFTORASTER="1" 959 fi 960 fi 961 fi 962 else 963 if test "$(uname)" = "Linux"; then 964 AC_MSG_WARN([* USING LOCAL CUPS SOURCE *]) 965 SHARELCUPS=0 966 SHARELCUPSI=0 967 LCUPSBUILDTYPE=linux 968 LCUPSINCLUDE="include \$(GLSRCDIR)/lcups.mak" 969 LCUPSIINCLUDE="include \$(GLSRCDIR)/lcupsi.mak" 970 CUPSDEV="cups" 971 972 fi 973 fi 974 fi 975fi 976 977#AC_SUBST(CUPSDEV) 978AC_SUBST(CUPSCFLAGS) 979AC_SUBST(CUPSLIBS) 980AC_SUBST(CUPSLIBDIRS) 981AC_SUBST(CUPSINCLUDE) 982AC_SUBST(CUPSSERVERBIN) 983AC_SUBST(CUPSSERVERROOT) 984AC_SUBST(CUPSDATA) 985AC_SUBST(CUPSINSTALL) 986 987AC_SUBST(SHARELCUPS) 988AC_SUBST(SHARELCUPSI) 989AC_SUBST(LCUPSBUILDTYPE) 990AC_SUBST(LCUPSINCLUDE) 991AC_SUBST(LCUPSIINCLUDE) 992 993 994AC_SUBST(CUPSPDFTORASTER) 995 996dnl look for IJS implementation 997AC_ARG_WITH([ijs], AC_HELP_STRING([--without-ijs], 998 [disable IJS driver support])) 999 1000case `uname` in 1001 MINGW*) 1002 AC_MSG_WARN([disabling the ijs device]) 1003 with_ijs=no 1004 ;; 1005 *) 1006 ;; 1007esac 1008 1009 1010dnl set safe defaults 1011 IJSDIR=src 1012 IJSDEVS='' 1013 SHAREIJS=0 1014if test x$with_ijs != xno; then 1015 AC_MSG_CHECKING([for local ijs library source]) 1016 if test -d ijs; then 1017 AC_MSG_RESULT([yes]) 1018 IJSDIR=ijs 1019 IJSDEVS='ijs' 1020 else 1021 AC_MSG_RESULT([no]) 1022 AC_CHECK_LIB(ijs, ijs_server_init, [ 1023 AC_CHECK_HEADERS(ijs/ijs.h, [SHAREIJS=1]) 1024 ]) 1025 if test $SHAREIJS -eq 1 ; then 1026 IJSLIB=ijs 1027 # This is for safety - it prevents our header search path going outside the GS source tree 1028 IJSDIR='$(GLOBJDIR)' 1029 IJSDEVS='ijs' 1030 fi 1031 fi 1032fi 1033AC_SUBST(IJSDIR) 1034AC_SUBST(SHAREIJS) 1035AC_SUBST(IJSLIB) 1036#AC_SUBST(IJSDEVS) 1037 1038 1039JBIG2_DECODER= 1040JBIG2DIR=src 1041SHARE_JBIG2=0 1042JBIG2DEVS='' 1043JBIG2_AUTOCONF_CFLAGS= 1044 1045dnl Luratech detection 1046LURATECHDIR=luratech 1047 1048AC_ARG_WITH([luratech], AC_HELP_STRING([--without-luratech], 1049 [do not try to use the Luratech library for JBIG2 nor JPX decoding])) 1050 1051 1052if test x$with_luratech != xno; then 1053 AC_MSG_CHECKING([for local Luratech JBIG2 library source]) 1054 if test -d luratech/ldf_jb2; then 1055 AC_MSG_RESULT([yes]) 1056 JBIG2_DECODER=luratech 1057 SHARE_JBIG2=0 1058 JBIG2DIR=luratech/ldf_jb2 1059 if test "$(uname)" = "Darwin"; then 1060 JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DMAC -DMAC_OS_X_BUILD" 1061 else 1062 JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DLINUX" 1063 fi 1064 JBIG2DEVS='$(PSD)jbig2.dev' 1065 else 1066 AC_MSG_RESULT([no]) 1067 fi 1068fi 1069 1070if test "x$JBIG2_DECODER" = x; then 1071 dnl look for jbig2dec 1072 AC_ARG_WITH([jbig2dec], AC_HELP_STRING([--without-jbig2dec], 1073 [disable JBIG2 decode support])) 1074 if test x$with_jbig2dec != xno; then 1075 AC_MSG_CHECKING([for local jbig2dec library source]) 1076 for d in jbig2dec jbig2dec-0.2 jbig2dec-0.3; do 1077 test -d "$d" && JBIG2DIR=$d && break 1078 done 1079 if test "x$JBIG2DIR" != xsrc; then 1080 JBIG2_DECODER=jbig2dec 1081 echo "Running jbig2dec configure script..." 1082 olddir=`pwd` 1083 cd $JBIG2DIR && ./configure $SUBCONFIG_OPTS 1084 status=$? 1085 if test "$status" -ne 0 ; then 1086 AC_MSG_ERROR([jbig2dec configure script failed], $status) 1087 fi 1088 if test "$status" -eq 0 ; then 1089 JBIG2_AUTOCONF_CFLAGS=-DHAVE_CONFIG_H 1090 fi 1091 cd $olddir 1092 echo 1093 echo "Continuing with Ghostscript configuration..." 1094 AC_MSG_RESULT([$JBIG2DIR]) 1095 else 1096 AC_MSG_RESULT([no]) 1097 AC_CHECK_LIB([jbig2dec], [jbig2_page_out], [ 1098 SHARE_JBIG2=1 1099 ], [ 1100 AC_MSG_WARN([disabling support for JBIG2 files]) 1101 with_jbig2dec=no 1102 ]) 1103 if test x$with_jbig2dec != xno; then 1104 JBIG2_DECODER=jbig2dec 1105 fi 1106 fi 1107 fi 1108 if test x$with_jbig2dec != xno; then 1109 if test x$ac_cv_header_stdint_h != xyes && test x$ac_cv_header_inttypes_h != xyes; then 1110 AC_MSG_WARN([JBIG2 support requires stdint types which do not seem to be available.]) 1111 else 1112 JBIG2DEVS='$(PSD)jbig2.dev' 1113 fi 1114 fi 1115fi 1116 1117AC_SUBST(JBIG2_DECODER) 1118AC_SUBST(JBIG2DIR) 1119AC_SUBST(SHARE_JBIG2) 1120AC_SUBST(JBIG2DEVS) 1121AC_SUBST(JBIG2_AUTOCONF_CFLAGS) 1122 1123JPXDIR=src 1124SHARE_JPX=0 1125JPXDEVS='' 1126JPX_DECODER= 1127JPX_AUTOCONF_CFLAGS= 1128 1129if test x$with_luratech != xno; then 1130 AC_MSG_CHECKING([for local Luratech JPEG2K library source]) 1131 if test -d luratech/lwf_jp2; then 1132 AC_MSG_RESULT([yes]) 1133 JPX_DECODER=luratech 1134 SHARE_JPX=0 1135 JPXDIR=luratech/lwf_jp2 1136 if test "$(uname)" = "Darwin"; then 1137 JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DMAC -DMAC_OS_X_BUILD" 1138 else 1139 JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DLINUX" 1140 fi 1141 JPXDEVS='$(PSD)jpx.dev' 1142 else 1143 AC_MSG_RESULT([no]) 1144 fi 1145fi 1146 1147OPENJPEGDIR=openjpeg 1148 1149AC_ARG_ENABLE([openjpeg], AC_HELP_STRING([--disable-openjpeg], 1150 [Do not use OpenJPEG for JPX decoding])) 1151 1152if test "x$JPX_DECODER" = "x"; then 1153 if test "x$enable_openjpeg" != "xno"; then 1154 AC_MSG_CHECKING([for local OpenJPEG library source]) 1155 if test -e $OPENJPEGDIR/libopenjpeg/openjpeg.h; then 1156 AC_MSG_RESULT([yes]) 1157 JPXDIR="$OPENJPEGDIR" 1158 JPX_DECODER=openjpeg 1159 SHARE_JPX=0 1160 JPX_AUTOCONF_CFLAGS="-DUSE_OPENJPEG_JP2" 1161 JPXDEVS='$(PSD)jpx.dev' 1162 else 1163 AC_MSG_RESULT([no]) 1164 fi 1165 fi 1166fi 1167 1168if test "x$JPX_DECODER" = "x"; then 1169 dnl look for the jasper JPEG 2000 library 1170 AC_ARG_WITH([jasper], AC_HELP_STRING([--without-jasper], 1171 [Do not use the JasPer library for JPEG 2000])) 1172 if test x$with_jasper != xno; then 1173 AC_MSG_CHECKING([for local jasper library source]) 1174 for d in jasper jasper-1.7*; do 1175 test -d "$d" && JPXDIR=$d && break 1176 done 1177 if test "x$JPXDIR" != xsrc; then 1178 AC_MSG_RESULT([$JPXDIR]) 1179 AC_MSG_CHECKING([for local jasper configure script]) 1180 if test -x $JPXDIR/configure; then 1181 AC_MSG_RESULT([yes]) 1182 echo 1183 echo "Running jasper configure script..." 1184 olddir=`pwd` 1185 cd $JPXDIR && ./configure $SUBCONFIG_OPTS 1186 status=$? 1187 if test "$status" -ne 0 ; then 1188 AC_MSG_ERROR([jasper configure script failed], $status) 1189 fi 1190 cd $olddir 1191 echo 1192 echo "Continuing with Ghostscript configuration..." 1193 else 1194 AC_MSG_RESULT([no]) 1195 AC_MSG_CHECKING([for local jasper autogen.sh script]) 1196 if test -x $JPXDIR/autogen.sh; then 1197 AC_MSG_RESULT([yes]) 1198 echo 1199 echo "Running jasper autogen script..." 1200 olddir=`pwd` 1201 cd $JPXDIR && ./autogen.sh 1202 status=$? 1203 if test "$status" -ne 0 ; then 1204 AC_MSG_ERROR([jasper autogen script failed], $status) 1205 fi 1206 cd $olddir 1207 echo 1208 echo "Continuing with Ghostscript configuration..." 1209 else 1210 AC_MSG_ERROR([ 1211Unable to find $JPXDIR/src/libjasper/include/jas_config.h, 1212or generate generate such a file for this system. You will 1213have to build one by hand, or configure, build and install 1214the jasper library separately. 1215 1216You can also pass --without-jasper to configure to disable 1217JPEG 2000 PDF image support entirely. 1218]) 1219 fi 1220 fi 1221 else 1222 AC_MSG_RESULT([no]) 1223 AC_CHECK_LIB([jasper], [jas_image_create], [ 1224 SHARE_JPX=1 1225 ], [ 1226 AC_MSG_WARN([disabling support for JPEG 2000 images]) 1227 with_jasper=no 1228 ]) 1229 fi 1230 fi 1231 if test x$with_jasper != xno; then 1232 JPX_DECODER=jasper 1233 JPX_AUTOCONF_CFLAGS="-DJAS_CONFIGURE" 1234 JPXDEVS='$(PSD)jpx.dev' 1235 fi 1236fi 1237 1238 1239AC_SUBST(JPX_DECODER) 1240AC_SUBST(JPX_AUTOCONF_CFLAGS) 1241AC_SUBST(JPXDIR) 1242AC_SUBST(SHARE_JPX) 1243AC_SUBST(JPXDEVS) 1244 1245dnl check if we can/should build the gtk loader 1246AC_ARG_ENABLE([gtk], AC_HELP_STRING([--disable-gtk], 1247 [Do not build the gtk loader])) 1248SOC_CFLAGS="" 1249SOC_LIBS="" 1250SOC_LOADER="dxmainc.c" 1251if test "x$enable_gtk" != "xno"; then 1252 # Try GTK+ 3.x first... 1253 if test "x$PKGCONFIG" != x; then 1254 AC_MSG_CHECKING(for GTK+ 3.x) 1255 if $PKGCONFIG --exists gtk+-3.0; then 1256 SOC_LOADER="dxmain.c" 1257 SOC_CFLAGS="`$PKGCONFIG gtk+-3.0 --cflags`" 1258 SOC_LIBS="`$PKGCONFIG gtk+-3.0 --libs`" 1259 AC_MSG_RESULT([yes]) 1260 else 1261 AC_MSG_RESULT([no]) 1262 fi 1263 1264 # Or resort to GTK+ 2.x 1265 if test "x$SOC_LOADER" = x; then 1266 AC_MSG_CHECKING(for GTK+ 2.x) 1267 if $PKGCONFIG --exists gtk+-2.0; then 1268 SOC_LOADER="dxmain.c" 1269 SOC_CFLAGS="`$PKGCONFIG gtk+-2.0 --cflags`" 1270 SOC_LIBS="`$PKGCONFIG gtk+-2.0 --libs`" 1271 AC_MSG_RESULT([yes]) 1272 else 1273 AC_MSG_RESULT([no]) 1274 fi 1275 fi 1276 fi 1277fi 1278AC_SUBST(SOC_CFLAGS) 1279AC_SUBST(SOC_LIBS) 1280AC_SUBST(SOC_LOADER) 1281 1282dnl look for omni implementation 1283AC_ARG_WITH([omni], AC_HELP_STRING([--with-omni], 1284 [enable the omni driver])) 1285dnl set safe defaults 1286OMNIDEVS='' 1287INCLUDEOMNI=no 1288if ( ! test -z "$CONTRIBINCLUDE" ) && ( test x$with_omni = xyes ); then 1289 INCLUDEOMNI=yes 1290 OMNIDEVS='$(DD)omni.dev' 1291 1292 if test -n "$GCC"; then 1293 LIBS="$LIBS -lstdc++" 1294 fi 1295fi 1296AC_SUBST(OMNIDEVS) 1297 1298dnl optional X11 for display devices 1299AC_PATH_XTRA 1300 1301X_LDFLAGS="" 1302X_CFLAGS="" 1303X_DEVS="" 1304X_LIBS="" 1305 1306if test x$with_x != xno; then 1307 if test "$x_libraries" = "/usr/lib"; then 1308 echo "Ignoring X library directory \"$x_libraries\" requested by configure." 1309 x_libraries="NONE" 1310 fi 1311 if test ! "$x_libraries" = "NONE" -a ! "$x_libraries" = ""; then 1312 X_LDFLAGS="-L$x_libraries" 1313 if test "$uname" = "SunOS"; then 1314 X_LDFLAGS="$X_LDFLAGS -R$x_libraries" 1315 fi 1316 fi 1317 1318 if test "$x_includes" = "/usr/include"; then 1319 echo "Ignoring X include directory \"$x_includes\" requested by configure." 1320 x_includes="NONE" 1321 fi 1322 if test ! "$x_includes" = "NONE" -a ! "$x_includes" = ""; then 1323 X_CFLAGS="-I$x_includes" 1324 fi 1325 1326 SAVELIBS="$LIBS" 1327 SAVELDFLAGS="$LDFLAGS" 1328 LDFLAGS="$LDFLAGS $X_LDFLAGS" 1329 1330 AC_CHECK_LIB(X11,XOpenDisplay) 1331 AC_CHECK_LIB(Xext,XdbeQueryExtension) 1332 AC_CHECK_LIB(Xt,XtAppCreateShell) 1333 1334 LDFLAGS="$SAVELDFLAGS" 1335 LIBS="$SAVELIBS" 1336 1337 if test "$ac_cv_lib_Xt_XtAppCreateShell" = yes; then 1338 X11DEVS="x11 x11alpha x11cmyk x11mono x11_ x11alt_ x11cmyk2 x11cmyk4 x11cmyk8 x11rg16x x11rg32x x11gray2 x11gray4" 1339 X_DEVS=$X11DEVS 1340 # the makefile wants a list of just the library names in X_LIBS 1341 GS_SPLIT_LIBS([X_LIBS], 1342 [-lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS]) 1343 fi 1344fi 1345 1346AC_SUBST(X_LDFLAGS) 1347AC_SUBST(X_CFLAGS) 1348AC_SUBST(X_LIBS) 1349#AC_SUBST(X_DEVS) 1350#AC_SUBST(X11DEVS) 1351AC_SUBST(XLIBS) 1352 1353dnl executible name 1354AC_ARG_WITH([gs], AC_HELP_STRING([--with-gs=NAME], 1355 [name of the Ghostscript executible [[gs]]]), 1356 [GS="$with_gs"],[GS='gs']) 1357AC_SUBST(GS) 1358 1359dnl do we compile the postscript initialization files into Ghostscript? 1360COMPILE_INITS="1" 1361AC_ARG_ENABLE([compile-inits], AC_HELP_STRING([--disable-compile-inits], 1362 [Do not compile in initialization files]),[ 1363 if test "x$enable_compile_inits" = xno; then 1364 COMPILE_INITS="0" 1365 fi]) 1366AC_SUBST(COMPILE_INITS) 1367 1368dnl look for drivers to compile... 1369AC_ARG_WITH(drivers, 1370[ --with-drivers=LIST Drivers to support, separated by commas. 1371 Either list the drivers or use aliases: 1372 ALL = all drivers 1373 FILES = all file format drivers 1374 PRINTERS = all printer drivers 1375 Printers: 1376 APPLE = all Apple printers 1377 BROTHER = all Brother printers 1378 CANON = all Canon printers 1379 EPSON = all Epson printers 1380 HP = all HP printers 1381 IBM = all IBM printers 1382 JAPAN = older japanese printers 1383 LEXMARK = all Lexmark printers 1384 OKI = all OKI printers 1385 PCLXL = all PCL XL/6 printers 1386 File formats: 1387 BMP = Output to bmp files 1388 FAX = Output to fax files 1389 JPEG = Output to JPEG files 1390 PBM = Output to PBM/PNM 1391 PCX = Output to PCX 1392 PNG = Output to PNG 1393 PS = Output to PostScript/PDF 1394 TIFF = Output to TIFF 1395 You can mix both variants, e.g. 1396 --with-drivers=HP,stcolor would build HP drivers and 1397 the Epson stcolor driver. 1398 Aliases must be uppercase (a 3rd party driver might 1399 have the same name). 1400 Default: ALL],drivers="$withval",drivers="ALL") 1401 1402AC_ARG_WITH(driversfile, 1403[ --with-driversfile=FILE Drivers to support from file, separated by newlines.], 1404driversfile="$withval",driversfile="") 1405 1406if test "x$driversfile" != x; then 1407 # Add drivers from file... 1408 drivers="`tr '\n' ',' <$driversfile`" 1409fi 1410 1411dnl Check which drivers we'd like to support. 1412P_DEVS0="" 1413F_DEVS0="" 1414CUPS_DEVS0="" 1415SVG_DEVS0="" 1416JBIG2_DEVS="" 1417IJS_DEVS0="" 1418PNG_DEVS0="" 1419X11_DEVS0="" 1420 1421 1422dnl Known printers 1423HP_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 cdnj500 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' 1424PCLXL_DEVS='pxlmono pxlcolor' 1425EPSON_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 eplcolor eplmono' 1426CANON_DEVS='bj10e bj200 bjc600 bjc800 lbp8 lips3 bjcmono bjcgray bjccmyk bjccolor' 1427LEXMARK_DEVS='lxm5700m lxm3200 lex2050 lex3200 lex5700 lex7000' 1428BROTHER_DEVS='hl7x0 hl1240 hl1250' 1429APPLE_DEVS='appledmp iwhi iwlo iwlq' 1430IBM_DEVS='ibmpro jetp3852' 1431OKI_DEVS='oki182 okiibm oki4w' 1432JAPAN_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' 1433MISC_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' 1434OPVP_DEVS='opvp oprp' 1435 1436ETS_HALFTONING_DEVS='rinkj' 1437 1438dnl Known file formats 1439BMP_DEVS='bmpmono bmpgray bmpsep1 bmpsep8 bmp16 bmp256 bmp16m bmp32b' 1440 1441JPEG_DEVS='jpeg jpeggray jpegcmyk' 1442# PNG_DEVS='png16 png16m png256 pngalpha pnggray pngmono' 1443 1444PCX_DEVS='pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk pcx2up' 1445PBM_DEVS='pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm pksmraw pam pamcmyk4 pamcmyk32 plan plang planm planc plank' 1446PS_DEVS='psdf psdcmyk psdrgb pdfwrite pswrite ps2write epswrite psgray psmono psrgb bbox txtwrite inkcov' 1447MISC_FDEVS='ccr cif inferno mag16 mag256 mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono miff24 plan9bm sgirgb sunhmono bit bitrgb bitrgbtags bitcmyk devicen spotcmyk xcf' 1448SVGDEV='svgwrite' 1449 1450while test -n "$drivers"; do 1451 if echo $drivers |grep "," >/dev/null; then 1452 THIS="`echo $drivers |sed -e 's/,.*//'`" 1453 SEDCMD="s/$THIS,//" 1454 drivers="`echo $drivers |sed -e $SEDCMD`" 1455 else 1456 THIS=$drivers 1457 drivers="" 1458 fi 1459 case "$THIS" in 1460 ALL) 1461 # ALL = PRINTERS + FILES... 1462 if test -z "$drivers"; then 1463 drivers="PRINTERS,FILES,X11" 1464 else 1465 drivers="$drivers,PRINTERS,FILES,X11" 1466 fi 1467 ;; 1468 PRINTERS) 1469 P_DEVS0="$P_DEVS0 $CANON_DEVS $EPSON_DEVS $HP_DEVS $LEXMARK_DEVS $BROTHER_DEVS $APPLE_DEVS $IBM_DEVS $OKI_DEVS $JAPAN_DEVS $MISC_PDEVS $ETS_HALFTONING_DEVS" 1470 IJS_DEVS0="$IJSDEVS" 1471 if test x$ac_cv_lib_dl_dlopen != xno -a x$found_iconv != xno; then 1472 P_DEVS0="$P_DEVS0 $OPVP_DEVS" 1473 else 1474 AC_MSG_WARN(Unable to include opvp/oprp driver due to missing or disabled prerequisites...) 1475 fi 1476 ;; 1477 FILES) 1478 F_DEVS0="$F_DEVS0 $BMP_DEVS $FAX_DEVS $JPEG_DEVS $TIFFDEVS $PCX_DEVS $PBM_DEVS $PS_DEVS $MISC_FDEVS" 1479 CUPS_DEVS0="$CUPSDEV" 1480 JBIG2_DEVS="$JBIG2DEVS" 1481 PNG_DEVS0="$PNGDEVS" 1482 ;; 1483 APPLE) 1484 # All Apple printers 1485 P_DEVS0="$P_DEVS0 $APPLE_DEVS" 1486 ;; 1487 BMP) 1488 # BMP file format 1489 F_DEVS0="$F_DEVS0 $BMP_DEVS" 1490 ;; 1491 CANON) 1492 # All Canon printers 1493 P_DEVS0="$P_DEVS0 $CANON_DEVS" 1494 ;; 1495 EPSON) 1496 # All Epson printers 1497 P_DEVS0="$P_DEVS0 $EPSON_DEVS" 1498 ;; 1499 FAX) 1500 # Fax file formats 1501 F_DEVS0="$F_DEVS0 $FAX_DEVS" 1502 ;; 1503 JPEG) 1504 # Jpeg file formats 1505 F_DEVS0="$F_DEVS0 $JPEG_DEVS" 1506 ;; 1507 JBIG2) 1508 # JBIG file formats 1509 JBIG2_DEVS="$JBIG2DEVS" 1510 ;; 1511 PNG) 1512 # PNG file formats 1513 PNG_DEVS0="$PNGDEVS" 1514 ;; 1515 TIFF) 1516 # TIFF file formats 1517 F_DEVS0="$F_DEVS0 $TIFFDEVS" 1518 ;; 1519 PCLXL) 1520 # PCL XL/PCL 6 drivers 1521 F_DEVS0="$F_DEVS0 $PCLXL_DEVS" 1522 ;; 1523 PCX) 1524 # PCX file formats 1525 F_DEVS0="$F_DEVS0 $PCX_DEVS" 1526 ;; 1527 PBM) 1528 # PBM file formats 1529 F_DEVS0="$F_DEVS0 $PBM_DEVS" 1530 ;; 1531 CUPS) 1532 # CUPS file format 1533 CUPS_DEVS0="$CUPSDEV" 1534 ;; 1535 HP) 1536 # All HP printers 1537 P_DEVS0="$P_DEVS0 $HP_DEVS" 1538 ;; 1539 LEXMARK) 1540 # All Lexmark printers 1541 P_DEVS0="$P_DEVS0 $LEXMARK_DEVS" 1542 ;; 1543 BROTHER) 1544 # All Brother printers 1545 P_DEVS0="$P_DEVS0 $BROTHER_DEVS" 1546 ;; 1547 OKI) 1548 # All OKI printers 1549 P_DEVS0="$P_DEVS0 $OKI_DEVS" 1550 ;; 1551 IBM) 1552 # All IBM printers 1553 P_DEVS0="$P_DEVS0 $IBM_DEVS" 1554 ;; 1555 IJS) 1556 # IJS printers 1557 IJS_DEVS0="$IJSDEVS" 1558 ;; 1559 JAPAN) 1560 # All old japanese printers 1561 P_DEVS0="$P_DEVS0 $JAPAN_DEVS" 1562 ;; 1563 PS) 1564 # PostScript/PDF writing 1565 F_DEVS0="$F_DEVS0 $PS_DEVS" 1566 ;; 1567 SVG) 1568 # PostScript/PDF writing 1569 SVG_DEVS0="$SVGDEV" 1570 ;; 1571 ETS) 1572 # ETS Halftoning devices 1573 F_DEVS0="$F_DEVS0 $ETS_HALFTONING_DEVS" 1574 ;; 1575 X11) 1576 # X11 display devices 1577 X11_DEVS0="$X_DEVS" 1578 ;; 1579 opvp) 1580 # Open Vector Printing driver... 1581 if test x$ac_cv_lib_dl_dlopen != xno -a x$found_iconv != xno; then 1582 P_DEVS0="$P_DEVS0 $OPVP_DEVS" 1583 else 1584 AC_MSG_WARN(Unable to include opvp/oprp driver due to missing or disabled prerequisites...) 1585 fi 1586 ;; 1587 *) 1588 # It's a driver name (or a user messup) 1589 P_DEVS0="$P_DEVS0 `echo $THIS |sed -e 's,\.dev$,,'`" 1590 ;; 1591 esac 1592done 1593 1594noncontribmakefiles=`find . -name '*.mak' -print | grep -v '^\./contrib/'` 1595# No need to include opvp/oprp driver without iconv/libiconv. 1596if test -n "$P_DEVS0"; then 1597 if test x$found_iconv = xno ; then 1598 P_DEVS0=`echo $P_DEVS0 | sed -e 's|opvp||' -e 's|oprp||'` 1599 AC_MSG_WARN(Unable to include opvp/oprp driver due to missing iconv/libiconv...) 1600 fi 1601 1602# Remove contributed drivers if requested and make sure we don't have any 1603# duplicates in there, add $(DD)foo.dev constructs 1604 P_DEVS=`(for i in $P_DEVS0; 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\015' ' '` 1605fi 1606 1607if test -n "$F_DEVS0"; then 1608 F_DEVS=`(for i in $F_DEVS0; 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\015' ' '` 1609fi 1610 1611if test -n "$CUPS_DEVS0"; then 1612 CUPS_DEVS=`(for i in $CUPS_DEVS0; 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\015' ' '` 1613fi 1614 1615if test -n "$SVG_DEVS0"; then 1616 SVG_DEVS=`(for i in $SVG_DEVS0; 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\015' ' '` 1617fi 1618 1619if test -n "$IJS_DEVS0"; then 1620 IJS_DEVS=`(for i in $IJS_DEVS0; 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\015' ' '` 1621fi 1622 1623if test -n "$PNG_DEVS0"; then 1624 PNG_DEVS=`(for i in $PNG_DEVS0; 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\015' ' '` 1625fi 1626 1627if test -n "$X11_DEVS0"; then 1628 X11_DEVS=`(for i in $X11_DEVS0; 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\015' ' '` 1629fi 1630 1631AC_SUBST(P_DEVS) 1632AC_SUBST(F_DEVS) 1633AC_SUBST(CUPS_DEVS) 1634AC_SUBST(SVG_DEVS) 1635AC_SUBST(JBIG2_DEVS) 1636AC_SUBST(IJS_DEVS) 1637AC_SUBST(PNG_DEVS) 1638 1639# This now gets done after handling --enable-dynamic 1640# AC_SUBST(X11_DEVS) 1641 1642dnl Dynamic device support. 1643DYNAMIC_CFLAGS="" 1644DYNAMIC_DEVS="" 1645DYNAMIC_FLAGS="" 1646DYNAMIC_LDFLAGS="" 1647DYNAMIC_LIBS="" 1648INSTALL_SHARED="" 1649DYNANIC_LIB_EXT="so" 1650 1651case `uname` in 1652 Linux*|GNU*) 1653 DYNAMIC_CFLAGS="-fPIC" 1654 DYNAMIC_LDFLAGS="-fPIC -shared" 1655 if test $ac_cv_prog_gcc = yes; then 1656 # GCC high level flag 1657 DYNAMIC_LIBS="-rdynamic -ldl" 1658 else 1659 DYNAMIC_LIBS="" 1660 fi 1661 DYNANIC_LIB_EXT="so" 1662 ;; 1663 *BSD|DragonFly) 1664 DYNAMIC_CFLAGS="-fPIC" 1665 DYNAMIC_LDFLAGS="-fPIC -shared" 1666 DYNAMIC_LIBS="" 1667 DYNANIC_LIB_EXT="so" 1668 ;; 1669 Darwin*) 1670 DYNAMIC_LDFLAGS="-dynamiclib" 1671 DYNAMIC_LIBS="" 1672 DYNANIC_LIB_EXT="dylib" 1673 ;; 1674 SunOS) 1675 if test $ac_cv_prog_gcc = yes; then 1676 DYNAMIC_CFLAGS="-fPIC" 1677 else 1678 DYNAMIC_CFLAGS="-KPIC" 1679 fi 1680 DYNAMIC_LDFLAGS="-G" 1681 DYNAMIC_LIBS="" 1682 DYNANIC_LIB_EXT="so" 1683 ;; 1684esac 1685 1686AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic], 1687 [Enable dynamically loaded drivers]), 1688[ 1689 if test "x$enable_dynamic" != xno; then 1690 case `uname` in 1691 Linux*|GNU*) 1692 INSTALL_SHARED="install-shared" 1693 if test "x$X_DEVS" != x; then 1694 DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so" 1695 else 1696 DYNAMIC_DEVS="" 1697 fi 1698 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 1699 X11_DEVS="" 1700 OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS" 1701 DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS" 1702 ;; 1703 *BSD|DragonFly) 1704 if test "x$X_DEVS" != x; then 1705 INSTALL_SHARED="install-shared" 1706 fi 1707 DYNAMIC_DEVS="" 1708 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 1709 X11_DEVS="" 1710 OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS" 1711 DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS" 1712 ;; 1713 Darwin*) 1714 INSTALL_SHARED="install-shared" 1715 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 1716 X11_DEVS="" 1717 OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS" 1718 DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS" 1719 ;; 1720 SunOS) 1721 DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so" 1722 DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" 1723 OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS" 1724 DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS" 1725 ;; 1726 *) 1727 AC_MSG_ERROR([Sorry, dynamic driver support not available on this platform!]) 1728 ;; 1729 esac 1730 fi 1731]) 1732 1733AC_SUBST(DYNAMIC_CFLAGS) 1734AC_SUBST(DYNAMIC_DEVS) 1735AC_SUBST(DYNAMIC_FLAGS) 1736AC_SUBST(DYNAMIC_LDFLAGS) 1737AC_SUBST(DYNAMIC_LIBS) 1738AC_SUBST(INSTALL_SHARED) 1739AC_SUBST(X11_DEVS) 1740AC_SUBST(DYNANIC_LIB_EXT) 1741 1742dnl look for default font path... 1743AC_ARG_WITH([fontpath], AC_HELP_STRING([--with-fontpath], 1744 [set font search path for gs]), fontpath="$withval", fontpath="") 1745 1746dnl Fix "prefix" variable... 1747if test "x$prefix" = xNONE; then 1748 prefix=/usr/local 1749fi 1750 1751dnl Fix "datadir" variable... 1752if test "x$datadir" = 'x${prefix}/share'; then 1753 datadir="$prefix/share" 1754fi 1755 1756dnl Fix "fontpath" variable... 1757if test "x$fontpath" = "x"; then 1758 # These font directories are used by various Linux distributions... 1759 fontpath="$datadir/fonts/default/ghostscript" 1760 fontpath="${fontpath}:$datadir/fonts/default/Type1" 1761 fontpath="${fontpath}:$datadir/fonts/default/TrueType" 1762 1763 # These font directories are used by IRIX... 1764 # fontpath="${fontpath}:/usr/lib/DPS/outline/base" 1765 1766 # These font directories are used by Solaris... 1767 # fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/Type1" 1768 # fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/TrueType" 1769 1770 # This font directory is used by CUPS... 1771 if test "x$CUPSCONFIG" != x; then 1772 fontpath="${fontpath}:`$CUPSCONFIG --datadir`/fonts" 1773 fi 1774fi 1775 1776AC_SUBST(fontpath) 1777 1778dnl -------------------------------------------------- 1779dnl Check for library functions 1780dnl -------------------------------------------------- 1781 1782AC_CHECK_FUNCS([mkstemp], [HAVE_MKSTEMP=-DHAVE_MKSTEMP]) 1783AC_SUBST(HAVE_MKSTEMP) 1784 1785AC_CHECK_FUNCS([fopen64], [HAVE_FILE64=-DHAVE_FILE64]) 1786AC_SUBST(HAVE_FILE64) 1787 1788AC_CHECK_FUNCS([mkstemp64], [HAVE_MKSTEMP64=-DHAVE_MKSTEMP64]) 1789AC_SUBST(HAVE_MKSTEMP64) 1790 1791AC_CHECK_FUNCS([setlocale], [HAVE_SETLOCALE=-DHAVE_SETLOCALE]) 1792AC_SUBST(HAVE_SETLOCALE) 1793 1794AC_CHECK_FUNCS([strerror], [HAVE_STRERROR=-DHAVE_STRERROR]) 1795AC_SUBST(HAVE_STRERROR) 1796 1797AC_PROG_GCC_TRADITIONAL 1798 1799dnl NB: We don't actually provide autoconf-switched fallbacks for any 1800dnl of these functions, so the checks are purely informational. 1801AC_FUNC_FORK 1802AC_FUNC_MALLOC 1803AC_FUNC_MEMCMP 1804AC_TYPE_SIGNAL 1805AC_FUNC_STAT 1806AC_FUNC_VPRINTF 1807AC_CHECK_FUNCS([bzero dup2 floor gettimeofday memchr memmove memset mkdir mkfifo modf pow putenv rint setenv sqrt strchr strrchr strspn strstr]) 1808 1809dnl -------------------------------------------------- 1810dnl check for big/little endian for LCMS 1811dnl -------------------------------------------------- 1812 1813AC_MSG_CHECKING([for big endian]) 1814 1815AC_RUN_IFELSE( 1816 [AC_LANG_PROGRAM([#include <stdio.h>], [ 1817 static const int one = 1; 1818 return (*(char*)&one == 0 ? 0 : 1); 1819 ])], 1820 [LCMS_BIGENDIAN=1], 1821 [LCMS_BIGENDIAN=0]) 1822 1823if test "x$LCMS_BIGENDIAN" != "x0"; then 1824 LCMS_ENDIAN="-DUSE_BIG_ENDIAN=$LCMS_BIGENDIAN" 1825 LCMS2_ENDIAN="-DCMS_USE_BIG_ENDIAN=$LCMS_BIGENDIAN" 1826 AC_MSG_RESULT(yes) 1827else 1828 LCMS_ENDIAN= 1829 LCMS2_ENDIAN= 1830 AC_MSG_RESULT(no) 1831fi 1832 1833 1834AC_SUBST(LCMS_ENDIAN) 1835AC_SUBST(LCMS2_ENDIAN) 1836 1837dnl -------------------------------------------------- 1838dnl check for sse2 intrinsics 1839dnl -------------------------------------------------- 1840 1841AC_MSG_CHECKING([sse2 support]) 1842save_cflags=$CFLAGS 1843CFLAGS="$CFLAGS $OPT_CFLAGS" 1844 1845HAVE_SSE2="" 1846AC_LINK_IFELSE( 1847 [AC_LANG_PROGRAM([#include <emmintrin.h>], [ 1848 __m128i input1; 1849 unsigned char buf1[[128]]; 1850 input1 = _mm_loadu_si128((const __m128i *)buf1); 1851 return(0); 1852 ])], 1853 [HAVE_SSE2="-DHAVE_SSE2"], [HAVE_SSE2=""]) 1854 1855AC_ARG_ENABLE([sse2], AC_HELP_STRING([--disable-sse2], 1856 [Do not use sse2 instrinsics]), [ 1857 if test "x$enable_sse2" = xno; then 1858 HAVE_SSE2="" 1859 fi]) 1860 1861if test "x$HAVE_SSE2" != x; then 1862 AC_MSG_RESULT(yes) 1863else 1864 AC_MSG_RESULT(no) 1865fi 1866 1867AC_SUBST(HAVE_SSE2) 1868CFLAGS=$save_cflags 1869 1870dnl -------------------------------------------------- 1871dnl check for byte swap intrinsics 1872dnl -------------------------------------------------- 1873AC_MSG_CHECKING([byteswap support]) 1874 1875HAVE_BSWAP32="" 1876AC_LINK_IFELSE( 1877 [AC_LANG_PROGRAM([], [ 1878 int a = 0; 1879 int b = __builtin_bswap32(a); 1880 return(0); 1881 ])], 1882 [HAVE_BSWAP32="-DHAVE_BSWAP32"], [HAVE_BSWAP32=""]) 1883 1884AC_ARG_ENABLE([bswap32], AC_HELP_STRING([--disable-bswap32], 1885 [Do not use bswap32 instrinsic]), [ 1886 if test "x$enable_bswap32" = xno; then 1887 HAVE_BSWAP32="" 1888 fi]) 1889 1890if test "x$HAVE_BSWAP32" != x; then 1891 AC_MSG_RESULT(yes) 1892else 1893 AC_MSG_RESULT(no) 1894fi 1895 1896AC_SUBST(HAVE_BSWAP32) 1897 1898dnl -------------------------------------------------- 1899dnl check for byte swap header 1900dnl -------------------------------------------------- 1901AC_MSG_CHECKING([for byteswap.h]) 1902 1903HAVE_BYTESWAP_H="" 1904AC_COMPILE_IFELSE( 1905 [AC_LANG_PROGRAM([#include "byteswap.h"], [ 1906 int a = 0; 1907 int b = __builtin_bswap32(a); 1908 return(0); 1909 ])], 1910 [HAVE_BYTESWAP_H="-DHAVE_BYTESWAP_H"], [HAVE_BYTESWAP_H=""]) 1911 1912AC_ARG_ENABLE([byteswap-h], AC_HELP_STRING([--disable-byteswap-h], 1913 [Do not use byteswap.h functions]), [ 1914 if test "x$enable_byteswap-h" = xno; then 1915 HAVE_BYTESWAP_H="" 1916 fi]) 1917 1918if test "x$HAVE_BYTESWAP_H" != x; then 1919 AC_MSG_RESULT(yes) 1920else 1921 AC_MSG_RESULT(no) 1922fi 1923 1924AC_SUBST(HAVE_BYTESWAP_H) 1925 1926# -------------------------------------------------- 1927# annoying: Windows doesn't allow "aux" as a 1928# directory nor file name, so if we're building in 1929# mingw, add the same prefix as the VS build uses 1930# -------------------------------------------------- 1931AUXDIRPOSTFIX="" 1932case `uname` in 1933 MINGW*) 1934 AUXDIRPOSTFIX="_" 1935 ;; 1936esac 1937AC_SUBST(AUXDIRPOSTFIX) 1938 1939 1940dnl -------------------------------------------------- 1941dnl Do substitutions 1942dnl -------------------------------------------------- 1943 1944AC_SUBST(OPT_CFLAGS) 1945AC_SUBST(DBG_CFLAGS) 1946AC_SUBST(GCFLAGS) 1947 1948AC_OUTPUT(Makefile) 1949 1950if ( test -d cups ); then 1951AC_OUTPUT(cups/gstopxl) 1952chmod +x cups/gstopxl 1953fi 1954 1955if test "x$JPX_DECODER" = "xjasper"; then 1956 AC_MSG_WARN([Using JasPer for PDF JPXDecode support]) 1957 AC_MSG_WARN([Support for JaSPER is deprecated and will be removed in a future release]) 1958fi 1959 1960if test "x$AFS" = "x1"; then 1961 AC_MSG_WARN([Using "native" font scaler which is now deprecated (rather than freetype),]) 1962 AC_MSG_WARN([Support for this will be removed in a future release]) 1963fi 1964 1965