1dnl  Copyright (C) 2001-2007 Artifex Software, Inc.
2dnl  All Rights Reserved.
3
4dnl  This software is provided AS-IS with no warranty, either express or
5dnl  implied.
6
7dnl  This software is distributed under license and may not be copied, modified
8dnl  or distributed except as expressly authorized under the terms of that
9dnl  license.  Refer to licensing information at http://www.artifex.com/
10dnl  or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11dnl  San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
13dnl $Id: configure.ac 10376 2009-11-24 08:36:27Z larsu $
14
15dnl Process this file with autoconf to produce a configure script
16
17dnl ------------------------------------------------
18dnl Initialization and Versioning
19dnl ------------------------------------------------
20
21AC_INIT
22AC_PREREQ(2.52)
23AC_CONFIG_SRCDIR(psi/gs.c)
24
25dnl Inherit compiler flags from the environment...
26CFLAGS="${CFLAGS:=}"
27CPPFLAGS="${CPPFLAGS:=}"
28CXXFLAGS="${CXXFLAGS:=}"
29LDFLAGS="${LDFLAGS:=}"
30
31dnl --------------------------------------------------
32dnl Local utilities
33dnl --------------------------------------------------
34
35dnl GS_SPLIT_LIBS( LIBS, LINKLINE )
36dnl Split a unix-style link line into a list of
37dnl bare library names. For example, the line
38dnl '-L/usr/X11R6/lib -lX11 -lXt' splits into
39dnl LIB='X11 Xt'
40dnl
41AC_DEFUN([GS_SPLIT_LIBS], [
42# the makefile wants a list of just the library names
43for gs_item in $2; do
44  gs_stripped_item=`echo "$gs_item" | sed -e 's/^-l//'`
45  if test "x$gs_stripped_item" != "x$gs_item"; then
46    $1="$[$1] $gs_stripped_item"
47  fi
48done
49])
50
51dnl GS_SPLIT_LIBPATHS( LIBPATHS, LINKLINE )
52dnl Split a unix-style link line into a list of
53dnl bare search path entries. For example,
54dnl '-L/usr/X11R6/lib -lX11 -L/opt/lib -lXt'
55dnl splits to LIBPATHS='/usr/X11R6/lib /opt/lib'
56dnl
57AC_DEFUN([GS_SPLIT_LIBPATHS], [
58for gs_item in $2; do
59  gs_stripped_item=`echo "$gs_item" | sed -e 's/-L//'`
60  if test "x$gs_stripped_item" != "x$gs_item"; then
61    $1="$[$1] $gs_stripped_item"
62  fi
63done
64])
65
66dnl --------------------------------------------------
67dnl Check for programs
68dnl --------------------------------------------------
69
70dnl AC_PROG_CC likes to add '-g -O2' to CFLAGS. however,
71dnl we ignore those flags and construct our own.
72save_cflags=$CFLAGS
73AC_PROG_CC
74AC_PROG_CPP
75CFLAGS=$save_cflags
76
77AC_PROG_RANLIB
78#AC_PROG_INSTALL
79
80dnl --------------------------------------------------
81dnl Allow excluding the contributed drivers
82dnl --------------------------------------------------
83
84AC_ARG_ENABLE([contrib], AC_HELP_STRING([--disable-contrib],
85    [Do not include contributed drivers]))
86CONTRIBINCLUDE="include contrib/contrib.mak"
87INSTALL_CONTRIB="install-contrib-extras"
88if test x$enable_contrib = xno; then
89    CONTRIBINCLUDE=""
90    INSTALL_CONTRIB=""
91    CFLAGS="$CFLAGS -DNOCONTRIB"
92fi
93AC_SUBST(CONTRIBINCLUDE)
94AC_SUBST(INSTALL_CONTRIB)
95
96dnl --------------------------------------------------
97dnl Set build flags based on environment
98dnl --------------------------------------------------
99
100#AC_CANONICAL_HOST
101
102if test $ac_cv_prog_gcc = yes; then
103    cflags_to_try="-Wall -Wstrict-prototypes -Wundef \
104-Wmissing-declarations -Wmissing-prototypes -Wwrite-strings \
105-Wno-strict-aliasing -Wdeclaration-after-statement \
106-fno-builtin -fno-common"
107    optflags_to_try="-O2"
108else
109    cflags_to_try=
110    optflags_to_try="-O"
111fi
112
113AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug],
114    [turn on debugging]))
115if test x$enable_debug = xyes; then
116    optflags_to_try="-g"
117    CFLAGS="-DDEBUG $CFLAGS"
118fi
119
120AC_MSG_CHECKING([supported compiler flags])
121old_cflags=$CFLAGS
122echo
123for flag in $optflags_to_try; do
124    CFLAGS="$CFLAGS $flag"
125    AC_TRY_COMPILE(, [return 0;], [
126	echo "   $flag"
127	OPT_CFLAGS="$OPT_CFLAGS $flag"
128    ])
129    CFLAGS=$old_cflags
130done
131for flag in $cflags_to_try; do
132	CFLAGS="$CFLAGS $flag"
133	AC_TRY_COMPILE(, [return 0;], [
134		echo "   $flag"
135		GCFLAGS="$GCFLAGS $flag"
136	])
137	CFLAGS=$old_cflags
138done
139AC_MSG_RESULT([ ...done.])
140
141dnl --------------------------------------------------
142dnl Check for headers
143dnl --------------------------------------------------
144
145AC_HEADER_DIRENT
146AC_HEADER_STDC
147AC_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])
148
149# for gdev3b1.c (AT&T terminal interface)
150AC_CHECK_HEADER([sys/window.h])
151
152dnl --------------------------------------------------
153dnl Check for typedefs, structures, etc
154dnl --------------------------------------------------
155
156AC_C_CONST
157AC_C_INLINE
158AC_TYPE_MODE_T
159AC_TYPE_OFF_T
160AC_TYPE_SIZE_T
161AC_STRUCT_ST_BLOCKS
162AC_HEADER_TIME
163AC_STRUCT_TM
164
165dnl see if we're on a system that puts the *int*_t types
166dnl from stdint.h in sys/types.h
167if test "x$ac_cv_header_stdint_h" != xyes; then
168    AC_CHECK_TYPES([int8_t, int16_t, int32_t, uint8_t, uint16_t, uint32_t],,,[#include <sys/types.h>])
169    if test "$ac_cv_type_uint8_t" = yes; then
170        AC_DEFINE([SYS_TYPES_HAS_STDINT_TYPES])
171	GCFLAGS="$GCFLAGS -DSYS_TYPES_HAS_STDINT_TYPES"
172    fi
173fi
174
175dnl we aren't interested in all of DEFS, so manually insert
176dnl the flags we care about
177if test "$ac_cv_c_const" != yes; then
178	GCFLAGS="$GCFLAGS -Dconst="
179fi
180if test "x$ac_cv_header_stdint_h" = xyes; then
181	GCFLAGS="$GCFLAGS -DHAVE_STDINT_H"
182fi
183
184dnl try to find a 64 bit type for devicen color index
185uint64_type="none"
186 AC_CHECK_SIZEOF(unsigned long int)
187 if test $ac_cv_sizeof_unsigned_long_int = 8; then
188	uint64_type="unsigned long int"
189 else
190  AC_CHECK_SIZEOF(unsigned long long)
191  if test $ac_cv_sizeof_unsigned_long_long = 8; then
192	uint64_type="unsigned long long"
193  else
194   AC_CHECK_SIZEOF(unsigned __int64)
195   if test $ac_cv_sizeof_unsigned___int64 = 8; then
196	uint64_type="unsigned __int64"
197   else
198    AC_CHECK_SIZEOF(u_int64_t)
199    if test $ac_cv_sizeof_u_int64_t = 8; then
200	uint64_type="u_int64_t"
201    fi
202   fi
203  fi
204 fi
205dnl we don't need to do anything if a 64-bit type wasn't found
206dnl the code falls back to a (probably 32-bit) default
207if test "$uint64_type" != "none"; then
208	GCFLAGS="$GCFLAGS -DGX_COLOR_INDEX_TYPE=\"$uint64_type\""
209fi
210
211dnl pkg-config is used for several tests now...
212AC_PATH_PROG(PKGCONFIG, pkg-config)
213
214dnl Fontconfig support
215HAVE_FONTCONFIG=""
216FONTCONFIG_CFLAGS=""
217FONTCONFIG_LIBS=""
218AC_ARG_ENABLE([fontconfig], AC_HELP_STRING([--disable-fontconfig],
219    [Don't use fontconfig to list system fonts]))
220if test "$enable_fontconfig" != "no"; then
221	# We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard
222	# autoconf macro and b) requires pkg-config on the system, which is
223	# NOT standard on ANY OS, including Linux!
224	if test "x$PKGCONFIG" != x; then
225		AC_MSG_CHECKING(for fontconfig with pkg-config)
226		if $PKGCONFIG --exists fontconfig; then
227			AC_MSG_RESULT(yes)
228			FONTCONFIG_CFLAGS="$CFLAGS `$PKGCONFIG --cflags fontconfig`"
229			FONTCONFIG_LIBS="`$PKGCONFIG --libs fontconfig`"
230			HAVE_FONTCONFIG=-DHAVE_FONTCONFIG
231		else
232			AC_MSG_RESULT(no)
233		fi
234	fi
235	if test -z "$HAVE_FONTCONFIG"; then
236		AC_CHECK_LIB([fontconfig], [FcInitLoadConfigAndFonts], [
237		  AC_CHECK_HEADER([fontconfig/fontconfig.h], [
238		    FONTCONFIG_LIBS="-lfontconfig"
239		    HAVE_FONTCONFIG="-DHAVE_FONTCONFIG"
240		  ])
241		])
242	fi
243fi
244AC_SUBST(HAVE_FONTCONFIG)
245AC_SUBST(FONTCONFIG_CFLAGS)
246AC_SUBST(FONTCONFIG_LIBS)
247
248dnl --------------------------------------------------
249dnl Check for libraries
250dnl --------------------------------------------------
251
252AC_CHECK_LIB(m, cos)
253
254SYNC="nosync"
255PTHREAD_LIBS=""
256AC_CHECK_LIB(pthread, pthread_create, [
257  SYNC=posync;
258  PTHREAD_LIBS="-lpthread"
259])
260AC_SUBST(SYNC)
261AC_SUBST(PTHREAD_LIBS)
262
263dnl Tests for iconv (Needed for OpenPrinting Vector, "opvp" output device)
264AC_ARG_WITH(libiconv,
265            [AC_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@],
266                            [use the libiconv library])],,
267	    [with_libiconv=maybe])
268found_iconv=no
269case $with_libiconv in
270  maybe)
271    # Check in the C library first
272    AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
273    # Check if we have GNU libiconv
274    if test $found_iconv = "no"; then
275      AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
276    fi
277    # Check if we have a iconv in -liconv, possibly from vendor
278    if test $found_iconv = "no"; then
279      AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
280    fi
281    ;;
282  no)
283    AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
284    ;;
285  gnu|yes)
286    AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
287    ;;
288  native)
289    AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
290    ;;
291esac
292if test x$found_iconv != xno -a x$with_libiconv != xno ; then
293  LIBS="$LIBS -liconv"
294fi
295
296case $with_libiconv in
297  gnu)
298    AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv])
299    CFLAGS="$CFLAGS -DUSE_LIBICONV_GNU"
300    ;;
301  native)
302    AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library])
303    ;;
304esac
305
306dnl Tests for libpaper (to determine system default paper size)
307AC_ARG_WITH([libpaper],
308            AC_HELP_STRING([--without-libpaper],
309                           [disable libpaper support]))
310if test x$with_libpaper != xno; then
311    AC_CHECK_LIB(paper, systempapername, [with_libpaper=yes],
312    [
313	AC_MSG_WARN([disabling support for libpaper])
314        with_libpaper=no
315    ])
316fi
317if test x$with_libpaper != xno; then
318    LIBS="$LIBS -lpaper"
319    AC_DEFINE(USE_LIBPAPER, 1, [Using libpaper])
320    CFLAGS="$CFLAGS -DUSE_LIBPAPER"
321fi
322
323AC_CHECK_LIB(dl, dlopen)
324
325AC_MSG_CHECKING([for local jpeg library source])
326dnl At present, we give the local source priority over the shared
327dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied.
328dnl A more sophisticated approach would be to test the shared lib
329dnl to see whether it has already been patched.
330LIBJPEGDIR=src
331if test -f jpeg/jpeglib.h; then
332	AC_MSG_RESULT([jpeg])
333	SHARE_LIBJPEG=0
334	LIBJPEGDIR=jpeg
335elif test -f jpeg-6b/jpeglib.h; then
336	AC_MSG_RESULT([jpeg-6b])
337	SHARE_LIBJPEG=0
338	LIBJPEGDIR=jpeg-6b
339else
340	AC_MSG_RESULT([no])
341	AC_CHECK_LIB(jpeg, jpeg_set_defaults, [
342	  AC_CHECK_HEADERS([jpeglib.h], [SHARE_LIBJPEG=1])
343	])
344fi
345if test -z "$SHARE_LIBJPEG"; then
346  AC_MSG_ERROR([I wasn't able to find a copy
347  of the jpeg library. This is required for compiling
348  ghostscript. Please download a copy of the source,
349  e.g. from http://www.ijg.org/, unpack it at the
350  top level of the gs source tree, and rename
351  the directory to 'jpeg'.
352  ])
353fi
354AC_SUBST(SHARE_LIBJPEG)
355AC_SUBST(LIBJPEGDIR)
356dnl check for the internal jpeg memory header
357AC_MSG_CHECKING([for jmemsys.h])
358if test -r $LIBJPEGDIR/jmemsys.h; then
359  AC_MSG_RESULT([yes])
360else
361  AC_MSG_RESULT([no])
362  AC_DEFINE([DONT_HAVE_JMEMSYS_H], 1,
363    [define if the libjpeg memory system prototypes aren't available])
364fi
365
366dnl these are technically optional
367
368AC_MSG_CHECKING([for local zlib source])
369dnl zlib is needed for language level 3, and libpng
370# we must define ZLIBDIR regardless because libpng.mak does a -I$(ZLIBDIR)
371# this seems a harmless default
372ZLIBDIR=src
373if test -d zlib; then
374	AC_MSG_RESULT([yes])
375	SHARE_ZLIB=0
376	ZLIBDIR=zlib
377else
378	AC_MSG_RESULT([no])
379	AC_CHECK_LIB(z, deflate, [
380	  AC_CHECK_HEADERS(zlib.h, [SHARE_ZLIB=1])
381	])
382fi
383if 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  ])
389fi
390AC_SUBST(SHARE_ZLIB)
391AC_SUBST(ZLIBDIR)
392
393dnl png for the png output device; it also requires zlib
394LIBPNGDIR=src
395PNGDEVS=''
396PNGDEVS_ALL='$(DD)png48.dev $(DD)png16m.dev $(DD)pnggray.dev $(DD)pngmono.dev $(DD)png256.dev $(DD)png16.dev $(DD)pngalpha.dev'
397AC_MSG_CHECKING([for local png library source])
398if test -f libpng/pngread.c; then
399	AC_MSG_RESULT([yes])
400	SHARE_LIBPNG=0
401	LIBPNGDIR=libpng
402	PNGDEVS="$PNGDEVS_ALL"
403else
404	AC_MSG_RESULT([no])
405	AC_CHECK_LIB(png, png_sig_cmp, [
406	  AC_CHECK_HEADERS(png.h, [
407		SHARE_LIBPNG=1
408		PNGDEVS="$PNGDEVS_ALL"
409	  ], [SHARE_LIBPNG=0])
410	], [SHARE_LIBPNG=0], [-lz])
411fi
412if test -z "$PNGDEVS"; then
413  AC_MSG_NOTICE([disabling png output devices])
414fi
415AC_SUBST(SHARE_LIBPNG)
416AC_SUBST(LIBPNGDIR)
417AC_SUBST(PNGDEVS)
418
419
420dnl look for libtiff, it also requires lib
421dnl png for the png output device; it also requires zlib
422AC_ARG_WITH([system-libtiff], AC_HELP_STRING([--with-system-libtiff],
423					     [Force using the systems libtiff]),
424	    [], [with_system_libtiff=check])
425TIFFDEVS=''
426TIFFDEVS_ALL='$(DD)tiffs $(DD)tiff12nc $(DD)tiff24nc $(DD)tiff48nc $(DD)tiff32nc $(DD)tiff64nc $(DD)tiffcrle $(DD)tifflzw $(DD)tiffpack $(DD)tiffgray $(DD)tiffsep'
427case "x$with_system_libtiff" in
428    xcheck)
429	if test -d tiff; then
430	    LIBTIFFDIR=tiff
431	    LOCAL_LIBTIFF_VERSION=`sed -n 's/^#define\s\+TIFFLIB_VERSION\s\+\([0-9]\+\)\s*.*$/\1/p' $LIBTIFFDIR/libtiff/tiffvers.h`
432	    SHARE_LIBTIFF=0
433	fi
434	AC_CHECK_LIB(tiff, TIFFOpen,
435		     [AC_CHECK_HEADERS(tiff.h, [HAVE_SYSTEM_LIBTIFF=1;SHARE_LIBTIFF=1])],
436		     [], [-ljpeg])
437	if test -z $LOCAL_LIBTIFF_VERSION && test "x$HAVE_SYSTEM_LIBTIFF" = x; then
438	    AC_MSG_NOTICE([Could not find a copy of libtiff on your system.
439Disabling tiff output devices.])
440	else
441	    TIFFDEVS="$TIFFDEVS_ALL"
442	fi
443	if test ! -z $LOCAL_LIBTIFF_VERSION && test "x$HAVE_SYSTEM_LIBTIFF" != x; then
444	    AC_TRY_COMPILE([#include <tiffvers.h>
445			    #if TIFFLIB_VERSION < $LOCAL_LIBTIFF_VERSION
446			    #error system libtiff is older
447			    #endif], [],
448			    [SHARE_LIBTIFF=1], [SHARE_LIBTIFF=0])
449	fi
450	;;
451    xyes)
452	AC_CHECK_LIB(tiff, TIFFOpen,
453		     [AC_CHECK_HEADERS(tiff.h, [HAVE_SYSTEM_LIBTIFF=1;SHARE_LIBTIFF=1])],
454		     [], [-ljpeg])
455	if test "x$HAVE_SYSTEM_LIBTIFF" != x; then
456	    SHARE_LIBTIFF=1
457	    TIFFDEVS="$TIFFDEVS_ALL"
458	else
459	    AC_MSG_NOTICE([Could not find a copy of libtiff on your system.
460Disabling tiff output devices.])
461	fi
462	;;
463    xno)
464	AC_MSG_CHECKING([for local libtiff source])
465        if test -d tiff; then
466	    AC_MSG_RESULT([yes])
467	    LIBTIFFDIR=tiff
468	    SHARE_LIBTIFF=0
469	    TIFFDEVS="$TIFFDEVS_ALL"
470	else
471	    AC_MSG_RESULT([no])
472	    AC_MSG_NOTICE([Could not find local copy of libtiff.
473Disabling tiff output devices.])
474	fi
475	;;
476esac
477
478if test $SHARE_LIBTIFF -eq 0; then
479      echo
480      echo "Running libtiff configure script..."
481      olddir=`pwd`
482      cd $LIBTIFFDIR && ./configure
483      status=$?
484      if test "$status" -ne 0 ; then
485        AC_MSG_ERROR([libtiff configure script failed], $status)
486      fi
487      cd $olddir
488      echo
489      echo "Continuing with Ghostscript configuration..."
490fi
491
492AC_SUBST(SHARE_LIBTIFF)
493AC_SUBST(TIFFDEVS)
494AC_SUBST(LIBTIFFDIR)
495
496
497dnl look for CUPS...
498AC_ARG_ENABLE([cups], AC_HELP_STRING([--disable-cups],
499    [Don't include CUPS support]))
500
501AC_ARG_WITH([pdftoraster], AC_HELP_STRING([--without-pdftoraster],
502    [Don't include CUPS' pdftoraster filter]))
503
504CUPSDEV=""
505CUPSINCLUDE=""
506CUPSCFLAGS=""
507CUPSLIBS=""
508CUPSLIBDIRS=""
509CUPSCONFIG="${CUPSCONFIG:=}"
510CUPSSERVERBIN=""
511CUPSSERVERROOT=""
512CUPSDATA=""
513CUPSVERSION="0"
514CUPSPDFTORASTER="0"
515
516if ( test -d cups ); then
517    if test x$enable_cups != xno; then
518	AC_PATH_PROG(CUPSCONFIG,cups-config)
519	dnl AC_CHECK_HEADER([cups/raster.h],[],[CUPSCONFIG=""])
520	if test "x$CUPSCONFIG" != x; then
521	    dnl Use values from CUPS config...
522	    CUPSCFLAGS="`$CUPSCONFIG --cflags` $CFLAGS"
523#	    CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --static --image --libs | sed -e '1,$s/-lssl//'` $LIBS"
524	    CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --image --libs`"
525	    GS_SPLIT_LIBS([CUPSLIBS], [$CUPSLINK])
526	    GS_SPLIT_LIBPATHS([CUPSLIBDIRS],[$CUPSLINK])
527	    CUPSSERVERROOT="`$CUPSCONFIG --serverroot`"
528	    CUPSSERVERBIN="`$CUPSCONFIG --serverbin`"
529	    CUPSDATA="`$CUPSCONFIG --datadir`"
530	    CUPSINCLUDE="include cups/cups.mak"
531	    CUPSDEV="\$(DD)cups.dev"
532	    CUPSVERSION="`$CUPSCONFIG --version`"
533	    if ( test x$with_pdftoraster != xno ); then
534	        if test "$CUPSVERSION" ">" "1.2"; then
535		    CUPSPDFTORASTER="1"
536		fi
537	    fi
538	fi
539    fi
540fi
541
542AC_SUBST(CUPSDEV)
543AC_SUBST(CUPSCFLAGS)
544AC_SUBST(CUPSLIBS)
545AC_SUBST(CUPSLIBDIRS)
546AC_SUBST(CUPSINCLUDE)
547AC_SUBST(CUPSSERVERBIN)
548AC_SUBST(CUPSSERVERROOT)
549AC_SUBST(CUPSDATA)
550AC_SUBST(CUPSPDFTORASTER)
551
552
553dnl look for IJS implementation
554AC_ARG_WITH([ijs], AC_HELP_STRING([--without-ijs],
555    [disable IJS driver support]))
556dnl set safe defaults
557    IJSDIR=src
558    IJSDEVS=''
559if test x$with_ijs != xno; then
560    AC_MSG_CHECKING([for local ijs library source])
561    if test -d ijs; then
562        AC_MSG_RESULT([yes])
563        IJSDIR=ijs
564        IJSDEVS='$(DD)ijs.dev'
565    else
566        AC_MSG_RESULT([no])
567    fi
568fi
569AC_SUBST(IJSDIR)
570AC_SUBST(IJSDEVS)
571
572dnl look for jbig2dec
573AC_ARG_WITH([jbig2dec], AC_HELP_STRING([--without-jbig2dec],
574    [disable JBIG2 decode support]))
575JBIG2DIR=src
576SHARE_JBIG2=0
577JBIG2DEVS=''
578if test x$with_jbig2dec != xno; then
579  AC_MSG_CHECKING([for local jbig2dec library source])
580  for d in jbig2dec jbig2dec-0.2 jbig2dec-0.3; do
581    test -d "$d" && JBIG2DIR=$d && break
582  done
583  if test "x$JBIG2DIR" != xsrc; then
584    AC_MSG_RESULT([$JBIG2DIR])
585  else
586    AC_MSG_RESULT([no])
587    AC_CHECK_LIB([jbig2dec], [jbig2_page_out], [
588	SHARE_JBIG2=1
589    ], [
590	AC_MSG_WARN([disabling support for JBIG2 files])
591        with_jbig2dec=no
592    ])
593  fi
594fi
595if test x$with_jbig2dec != xno; then
596  if test x$ac_cv_header_stdint_h != xyes; then
597    AC_MSG_WARN([JBIG2 support requires stdint types which do not seem to be available.])
598  else
599    JBIG2DEVS='$(PSD)jbig2.dev'
600  fi
601fi
602
603AC_SUBST(JBIG2DIR)
604AC_SUBST(SHARE_JBIG2)
605AC_SUBST(JBIG2DEVS)
606
607dnl look for the jasper JPEG 2000 library
608AC_ARG_WITH([jasper], AC_HELP_STRING([--without-jasper],
609  [don't use the JasPer library for JPEG 2000]))
610JASPERDIR=src
611SHARE_JASPER=0
612JPXDEVS=''
613if test x$with_jasper != xno; then
614  AC_MSG_CHECKING([for local jasper library source])
615  for d in jasper jasper-1.7*; do
616    test -d "$d" && JASPERDIR=$d && break
617  done
618  if test "x$JASPERDIR" != xsrc; then
619    AC_MSG_RESULT([$JASPERDIR])
620    AC_MSG_CHECKING([for local jasper configure script])
621    if test -x $JASPERDIR/configure; then
622      AC_MSG_RESULT([yes])
623      echo
624      echo "Running jasper configure script..."
625      olddir=`pwd`
626      cd $JASPERDIR && ./configure
627      status=$?
628      if test "$status" -ne 0 ; then
629        AC_MSG_ERROR([jasper configure script failed], $status)
630      fi
631      cd $olddir
632      echo
633      echo "Continuing with Ghostscript configuration..."
634    else
635      AC_MSG_RESULT([no])
636      AC_MSG_CHECKING([for local jasper autogen.sh script])
637      if test -x $JASPERDIR/autogen.sh; then
638        AC_MSG_RESULT([yes])
639        echo
640        echo "Running jasper autogen script..."
641        olddir=`pwd`
642        cd $JASPERDIR && ./autogen.sh
643        status=$?
644        if test "$status" -ne 0 ; then
645          AC_MSG_ERROR([jasper autogen script failed], $status)
646        fi
647        cd $olddir
648        echo
649        echo "Continuing with Ghostscript configuration..."
650      else
651        AC_MSG_ERROR([
652Unable to find $JASPERDIR/src/libjasper/include/jas_config.h,
653or generate generate such a file for this system. You will
654have to build one by hand, or configure, build and install
655the jasper library separately.
656
657You can also pass --without-jasper to configure to disable
658JPEG 2000 PDF image support entirely.
659])
660      fi
661    fi
662  else
663    AC_MSG_RESULT([no])
664    AC_CHECK_LIB([jasper], [jas_image_create], [
665	SHARE_JASPER=1
666    ], [
667	AC_MSG_WARN([disabling support for JPEG 2000 images])
668        with_jasper=no
669    ])
670  fi
671fi
672if test x$with_jasper != xno; then
673  JPXDEVS='$(PSD)jpx.dev'
674fi
675
676AC_SUBST(JASPERDIR)
677AC_SUBST(SHARE_JASPER)
678AC_SUBST(JPXDEVS)
679
680dnl check if we can/should build the gtk loader
681AC_ARG_ENABLE([gtk], AC_HELP_STRING([--disable-gtk],
682    [Don't build the gtk loader]))
683SOC_CFLAGS=""
684SOC_LIBS=""
685SOC_LOADER="dxmainc.c"
686if test "x$enable_gtk" != "xno"; then
687    # Try GTK+ 2.x first...
688    if test "x$PKGCONFIG" != x; then
689	AC_MSG_CHECKING(for GTK+ 2.x)
690	if $PKGCONFIG --exists gtk+-2.0; then
691	    SOC_LOADER="dxmain.c"
692	    SOC_CFLAGS="`$PKGCONFIG gtk+-2.0 --cflags`"
693	    SOC_LIBS="`$PKGCONFIG gtk+-2.0 --libs`"
694	    AC_MSG_RESULT([yes])
695	else
696	    AC_MSG_RESULT([no])
697	fi
698    fi
699
700    # Then fall back on GTK+ 1.x...
701    if test "x$SOC_LOADER" = x; then
702	AC_PATH_PROG(GTKCONFIG, gtk-config)
703	if test "x$GTKCONFIG" != x; then
704	    SOC_LOADER="dxmain.c"
705	    SOC_CFLAGS="`$GTKCONFIG --cflags`"
706	    SOC_LIBS="`$GTKCONFIG --libs`"
707	fi
708    fi
709fi
710AC_SUBST(SOC_CFLAGS)
711AC_SUBST(SOC_LIBS)
712AC_SUBST(SOC_LOADER)
713
714dnl enable the cairo device if the library is available
715AC_ARG_ENABLE([cairo], AC_HELP_STRING([--disable-cairo],
716    [Don't include the cairo output device]))
717CAIRO_DEVS=""
718CAIRO_CFLAGS=""
719CAIRO_LIBS=""
720if test "x$enable_cairo" != xno; then
721  AC_PATH_PROG(PKGCONFIG, pkg-config)
722  if test "x$PKGCONFIG" != x; then
723    AC_MSG_CHECKING([for cairo])
724    if $PKGCONFIG --exists 'cairo >= 1.2.0'; then
725      CAIRO_CFLAGS=`$PKGCONFIG --cflags cairo`
726      CAIRO_LIBS=`$PKGCONFIG --libs cairo`
727      CAIRO_DEVS="cairo"
728      AC_MSG_RESULT([yes])
729    else
730      AC_MSG_RESULT([no])
731    fi
732  fi
733fi
734
735AC_SUBST(CAIRO_CFLAGS)
736AC_SUBST(CAIRO_LIBS)
737
738dnl look for omni implementation
739AC_ARG_WITH([omni], AC_HELP_STRING([--without-omni],
740	[disable the omni driver]))
741dnl set safe defaults
742OMNIDEVS=''
743INCLUDEOMNI=yes
744if ( ! test -z "$CONTRIBINCLUDE" ) && ( test x$with_omni != xno ); then
745	OMNIDEVS='$(DD)omni.dev'
746
747	if test -n "$GCC"; then
748		LIBS="$LIBS -lstdc++"
749	fi
750fi
751AC_SUBST(OMNIDEVS)
752
753dnl optional X11 for display devices
754AC_PATH_XTRA
755
756X_LDFLAGS=""
757X_CFLAGS=""
758X_DEVS=""
759X_LIBS=""
760
761if test x$with_x != xno; then
762	if test "$x_libraries" = "/usr/lib"; then
763		echo "Ignoring X library directory \"$x_libraries\" requested by configure."
764		x_libraries="NONE"
765	fi
766	if test ! "$x_libraries" = "NONE" -a ! "$x_libraries" = ""; then
767		X_LDFLAGS="-L$x_libraries"
768		if test "$uname" = "SunOS"; then
769			X_LDFLAGS="$X_LDFLAGS -R$x_libraries"
770		fi
771	fi
772
773	if test "$x_includes" = "/usr/include"; then
774		echo "Ignoring X include directory \"$x_includes\" requested by configure."
775		x_includes="NONE"
776	fi
777	if test ! "$x_includes" = "NONE" -a ! "$x_includes" = ""; then
778		X_CFLAGS="-I$x_includes"
779	fi
780
781	SAVELIBS="$LIBS"
782	SAVELDFLAGS="$LDFLAGS"
783	LDFLAGS="$LDFLAGS $X_LDFLAGS"
784
785	AC_CHECK_LIB(X11,XOpenDisplay)
786	AC_CHECK_LIB(Xext,XdbeQueryExtension)
787	AC_CHECK_LIB(Xt,XtAppCreateShell)
788
789	LDFLAGS="$SAVELDFLAGS"
790	LIBS="$SAVELIBS"
791
792	if test "$ac_cv_lib_Xt_XtAppCreateShell" = yes; then
793		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"
794		X_DEVS=$X11DEVS
795		# the makefile wants a list of just the library names in X_LIBS
796		GS_SPLIT_LIBS([X_LIBS],
797			[-lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
798	fi
799fi
800
801AC_SUBST(X_LDFLAGS)
802AC_SUBST(X_CFLAGS)
803AC_SUBST(X_LIBS)
804AC_SUBST(X_DEVS)
805AC_SUBST(X11DEVS)
806AC_SUBST(XLIBS)
807
808dnl executible name
809AC_ARG_WITH([gs], AC_HELP_STRING([--with-gs=NAME],
810	[name of the Ghostscript executible [[gs]]]),
811	[GS="$with_gs"],[GS='gs'])
812AC_SUBST(GS)
813
814dnl do we compile the postscript initialization files into Ghostscript?
815COMPILE_INITS="1"
816AC_ARG_ENABLE([compile-inits], AC_HELP_STRING([--disable-compile-inits],
817       [Don't compile in initialization files]),[
818               if test "x$enable_compile_inits" = xno; then
819                       COMPILE_INITS="0"
820               fi])
821AC_SUBST(COMPILE_INITS)
822
823dnl look for drivers to compile...
824AC_ARG_WITH(drivers,
825[  --with-drivers=LIST     Drivers to support, separated by commas.
826                          Either list the drivers or use aliases:
827                          ALL      = all drivers
828                          FILES    = all file format drivers
829                          PRINTERS = all printer drivers
830                          Printers:
831                          APPLE    = all Apple printers
832                          BROTHER  = all Brother printers
833                          CANON    = all Canon printers
834                          EPSON    = all Epson printers
835                          HP       = all HP printers
836                          IBM      = all IBM printers
837                          JAPAN    = older japanese printers
838                          LEXMARK  = all Lexmark printers
839                          OKI      = all OKI printers
840			  PCLXL    = all PCL XL/6 printers
841                          File formats:
842                          BMP      = Output to bmp files
843                          FAX      = Output to fax files
844                          JPEG     = Output to JPEG files
845                          PBM      = Output to PBM/PNM
846                          PCX      = Output to PCX
847			  PNG      = Output to PNG
848                          PS       = Output to PostScript/PDF
849                          TIFF     = Output to TIFF
850                          CAIRO    = Output using libcairo
851			  WTS      = WTS Halftoning devices
852			  ETS      = ETS Halftoning devices
853                          You can mix both variants, e.g.
854                          --with-drivers=HP,stcolor would build HP drivers and
855                          the Epson stcolor driver.
856                          Aliases must be uppercase (a 3rd party driver might
857                          have the same name).
858                          Default: ALL],drivers="$withval",drivers="ALL")
859
860AC_ARG_WITH(driversfile,
861[  --with-driversfile=FILE Drivers to support from file, separated by newlines.],
862driversfile="$withval",driversfile="")
863
864if test "x$driversfile" != x; then
865	# Add drivers from file...
866	drivers="`tr '\n' ',' <$driversfile`"
867fi
868
869dnl Check which drivers we'd like to support.
870P_DEVS=""
871F_DEVS=""
872
873dnl Known printers
874HP_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"
875PCLXL_DEVS="pxlmono pxlcolor"
876EPSON_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"
877CANON_DEVS="bj10e bj200 bjc600 bjc800 lbp8 lips3 bjcmono bjcgray bjccmyk bjccolor"
878LEXMARK_DEVS="lxm5700m lx5000 lxm3200 lex2050 lex3200 lex5700 lex7000"
879BROTHER_DEVS="hl7x0 hl1240 hl1250"
880APPLE_DEVS="appledmp iwhi iwlo iwlq"
881IBM_DEVS="ibmpro jetp3852"
882OKI_DEVS="oki182 okiibm oki4w"
883JAPAN_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"
884MISC_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"
885OPVP_DEVS="opvp oprp"
886ETS_HALFTONING_DEVS="rinkj"
887
888dnl Known file formats
889BMP_DEVS="bmpmono bmpgray bmpsep1 bmpsep8 bmp16 bmp256 bmp16m bmp32b"
890FAX_DEVS="cfax dfaxlow dfaxhigh fax tfax tiffg3 tiffg32d tiffg4 faxg3 faxg32d faxg4"
891JPEG_DEVS="jpeg jpeggray jpegcmyk"
892PNG_DEVS="png16 png16m png256 pngalpha pnggray pngmono"
893TIFF_DEVS="tiffs tiff12nc tiff24nc tiff48nc tiff32nc tiff64nc tiffcrle tifflzw tiffpack tiffgray tiffsep tiffsep1"
894PCX_DEVS="pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk pcx2up"
895PBM_DEVS="pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm pksmraw pam"
896PS_DEVS="psdf psdcmyk psdrgb pdfwrite pswrite ps2write epswrite psgray psmono psrgb bbox"
897# CAIRO_DEVS is defined conditionally above
898WTS_HALFTONING_DEVS="imdi simdi wtsimdi wtscmyk"
899MISC_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"
900
901while test -n "$drivers"; do
902	if echo $drivers |grep "," >/dev/null; then
903		THIS="`echo $drivers |sed -e 's/,.*//'`"
904		drivers="`echo $drivers |sed -e \"s/$THIS,//\"`"
905	else
906		THIS=$drivers
907		drivers=""
908	fi
909	case "$THIS" in
910	ALL)
911		# ALL = PRINTERS + FILES...
912		if test -z "$drivers"; then
913			drivers="PRINTERS,FILES"
914		else
915			drivers="$drivers,PRINTERS,FILES"
916		fi
917		;;
918	PRINTERS)
919		P_DEVS="$P_DEVS $CANON_DEVS $EPSON_DEVS $HP_DEVS $LEXMARK_DEVS $BROTHER_DEVS $APPLE_DEVS $IBM_DEVS $OKI_DEVS $JAPAN_DEVS $MISC_PDEVS $ETS_HALFTONING_DEVS $OPVP_DEVS"
920		;;
921	FILES)
922		F_DEVS="$F_DEVS $BMP_DEVS $FAX_DEVS $JPEG_DEVS $PNG_DEVS $TIFF_DEVS $PCX_DEVS $PBM_DEVS $PS_DEVS $CAIRO_DEVS $WTS_HALFTONING_DEVS $MISC_FDEVS"
923		;;
924	APPLE)
925		# All Apple printers
926		P_DEVS="$P_DEVS $APPLE_DEVS"
927		;;
928	BMP)
929		# BMP file format
930		F_DEVS="$F_DEVS $BMP_DEVS"
931		;;
932	CANON)
933		# All Canon printers
934		P_DEVS="$P_DEVS $CANON_DEVS"
935		;;
936	EPSON)
937		# All Epson printers
938		P_DEVS="$P_DEVS $EPSON_DEVS"
939		;;
940	FAX)
941		# Fax file formats
942		F_DEVS="$F_DEVS $FAX_DEVS"
943		;;
944	JPEG)
945		# Jpeg file formats
946		F_DEVS="$F_DEVS $JPEG_DEVS"
947		;;
948	PNG)
949		# PNG file formats
950		F_DEVS="$F_DEVS $PNG_DEVS"
951		;;
952	TIFF)
953		# TIFF file formats
954		F_DEVS="$F_DEVS $TIFF_DEVS"
955		;;
956	PCLXL)
957		# PCL XL/PCL 6 drivers
958		F_DEVS="$F_DEVS $PCLXL_DEVS"
959		;;
960	PCX)
961		# PCX file formats
962		F_DEVS="$F_DEVS $PCX_DEVS"
963		;;
964	PBM)
965		# PBM file formats
966		F_DEVS="$F_DEVS $PBM_DEVS"
967		;;
968	HP)
969		# All HP printers
970		P_DEVS="$P_DEVS $HP_DEVS"
971		;;
972	LEXMARK)
973		# All Lexmark printers
974		P_DEVS="$P_DEVS $LEXMARK_DEVS"
975		;;
976	BROTHER)
977		# All Brother printers
978		P_DEVS="$P_DEVS $BROTHER_DEVS"
979		;;
980	OKI)
981		# All OKI printers
982		P_DEVS="$P_DEVS $OKI_DEVS"
983		;;
984	IBM)
985		# All IBM printers
986		P_DEVS="$P_DEVS $IBM_DEVS"
987		;;
988	JAPAN)
989		# All old japanese printers
990		P_DEVS="$P_DEVS $JAPAN_DEVS"
991		;;
992	PS)
993		# PostScript/PDF writing
994		F_DEVS="$F_DEVS $PS_DEVS"
995		;;
996	CAIRO)
997		$ cairo output device
998		F_DEVS="$F_DEVS $CAIRO_DEVS"
999		;;
1000	WTS)
1001		# WTS Halftoning devices
1002		F_DEVS="$F_DEVS $WTS_HALFTONING_DEVS"
1003		;;
1004	ETS)
1005		# ETS Halftoning devices
1006		F_DEVS="$F_DEVS $ETS_HALFTONING_DEVS"
1007		;;
1008        opvp)
1009		# Open Vector Printing driver...
1010		if test x$ac_cv_lib_dl_dlopen != xno -a x$found_iconv != xno; then
1011			P_DEVS="$P_DEVS $OPVP_DEVS"
1012		else
1013			AC_MSG_WARN(Unable to include opvp/oprp driver due to missing prerequisites...)
1014		fi
1015		;;
1016	*)
1017		# It's a driver name (or a user messup)
1018		P_DEVS="$P_DEVS `echo $THIS |sed -e 's,\.dev$,,'`"
1019		;;
1020	esac
1021done
1022# No need to include opvp/oprp driver without iconv/libiconv.
1023if test -n "$P_DEVS"; then
1024	if test x$found_iconv = xno ; then
1025		P_DEVS=`echo $P_DEVS | sed -e 's|opvp||' -e 's|oprp||'`
1026		AC_MSG_WARN(Unable to include opvp/oprp driver due to missing iconv/libiconv...)
1027	fi
1028
1029# Remove contributed drivers if requested and make sure we don't have any
1030# duplicates in there, add $(DD)foo.dev constructs
1031	noncontribmakefiles=`find . -name '*.mak' -print | grep -v '^\./contrib/'`
1032	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' ' '`
1033fi
1034if test -n "$F_DEVS"; then
1035	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' ' '`
1036fi
1037AC_SUBST(PRINTERS)
1038AC_SUBST(FILES)
1039
1040dnl Dynamic device support.
1041DYNAMIC_CFLAGS=""
1042DYNAMIC_DEVS=""
1043DYNAMIC_FLAGS=""
1044DYNAMIC_LDFLAGS=""
1045DYNAMIC_LIBS=""
1046INSTALL_SHARED=""
1047
1048AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic],
1049    [Enable dynamically loaded drivers]),
1050[	case `uname` in
1051		Linux*|GNU*)
1052		INSTALL_SHARED="install-shared"
1053		DYNAMIC_CFLAGS="-fPIC"
1054		if test "x$X_DEVS" != x; then
1055			DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
1056		else
1057			DYNAMIC_DEVS=""
1058		fi
1059		DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
1060		DYNAMIC_LDFLAGS="-fPIC -shared"
1061		DYNAMIC_LIBS="-rdynamic -ldl"
1062		X_DEVS=""
1063		;;
1064		*BSD|DragonFly)
1065		DYNAMIC_CFLAGS="-fPIC"
1066		if test "x$X_DEVS" != x; then
1067			INSTALL_SHARED="install-shared"
1068		else
1069			DYNAMIC_DEVS=""
1070		fi
1071		DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
1072		DYNAMIC_LDFLAGS="-fPIC -shared"
1073		DYNAMIC_LIBS=""
1074		X_DEVS=""
1075		;;
1076		Darwin*)
1077		INSTALL_SHARED="install-shared"
1078		DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
1079		DYNAMIC_LDFLAGS="-dynamiclib"
1080		DYNAMIC_LIBS=""
1081		X_DEVS=""
1082		;;
1083		SunOS)
1084		DYNAMIC_CFLAGS="-KPIC"
1085		DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
1086		DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
1087		DYNAMIC_LDFLAGS="-G"
1088		DYNAMIC_LIBS=""
1089		X_DEVS=""
1090		;;
1091		*)
1092		AC_MSG_ERROR([Sorry, dynamic driver support not available on this platform!])
1093		;;
1094	esac
1095])
1096
1097AC_SUBST(DYNAMIC_CFLAGS)
1098AC_SUBST(DYNAMIC_DEVS)
1099AC_SUBST(DYNAMIC_FLAGS)
1100AC_SUBST(DYNAMIC_LDFLAGS)
1101AC_SUBST(DYNAMIC_LIBS)
1102AC_SUBST(INSTALL_SHARED)
1103
1104dnl look for default font path...
1105AC_ARG_WITH([fontpath],  AC_HELP_STRING([--with-fontpath],
1106    [set font search path for gs]), fontpath="$withval", fontpath="")
1107
1108dnl Fix "prefix" variable...
1109if test "x$prefix" = xNONE; then
1110	prefix=/usr/local
1111fi
1112
1113dnl Fix "datadir" variable...
1114if test "x$datadir" = 'x${prefix}/share'; then
1115	datadir="$prefix/share"
1116fi
1117
1118dnl Fix "fontpath" variable...
1119if test "x$fontpath" = "x"; then
1120	# These font directories are used by various Linux distributions...
1121	fontpath="$datadir/fonts/default/ghostscript"
1122	fontpath="${fontpath}:$datadir/fonts/default/Type1"
1123	fontpath="${fontpath}:$datadir/fonts/default/TrueType"
1124
1125	# These font directories are used by IRIX...
1126	# fontpath="${fontpath}:/usr/lib/DPS/outline/base"
1127
1128	# These font directories are used by Solaris...
1129	# fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/Type1"
1130	# fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/TrueType"
1131
1132	# This font directory is used by CUPS...
1133	if test "x$CUPSCONFIG" != x; then
1134	  fontpath="${fontpath}:`$CUPSCONFIG --datadir`/fonts"
1135	fi
1136fi
1137
1138AC_SUBST(fontpath)
1139
1140dnl --------------------------------------------------
1141dnl Check for library functions
1142dnl --------------------------------------------------
1143
1144AC_CHECK_FUNCS([mkstemp], [HAVE_MKSTEMP=-DHAVE_MKSTEMP])
1145AC_SUBST(HAVE_MKSTEMP)
1146
1147AC_CHECK_FUNCS([hypot], [HAVE_HYPOT=-DHAVE_HYPOT])
1148AC_SUBST(HAVE_HYPOT)
1149
1150AC_CHECK_FUNCS([fopen64], [HAVE_FILE64=-DHAVE_FILE64])
1151AC_SUBST(HAVE_FILE64)
1152
1153AC_CHECK_FUNCS([mkstemp64], [HAVE_MKSTEMP64=-DHAVE_MKSTEMP64])
1154AC_SUBST(HAVE_MKSTEMP64)
1155
1156AC_PROG_GCC_TRADITIONAL
1157
1158dnl NB: We don't actually provide autoconf-switched fallbacks for any
1159dnl     of these functions, so the checks are purely informational.
1160AC_FUNC_FORK
1161AC_FUNC_MALLOC
1162AC_FUNC_MEMCMP
1163AC_TYPE_SIGNAL
1164AC_FUNC_STAT
1165AC_FUNC_VPRINTF
1166AC_CHECK_FUNCS([bzero dup2 floor gettimeofday memchr memmove memset mkdir mkfifo modf pow putenv rint setenv sqrt strchr strerror strrchr strspn strstr])
1167
1168dnl --------------------------------------------------
1169dnl Do substitutions
1170dnl --------------------------------------------------
1171
1172AC_SUBST(OPT_CFLAGS)
1173AC_SUBST(GCFLAGS)
1174AC_OUTPUT(Makefile cups/pstopxl cups/pstoraster)
1175
1176chmod +x cups/pstopxl cups/pstoraster
1177