2 dnl "$Id: configure.in,v 1.95 2001/06/22 19:21:47 mike Exp $"
4 dnl Configuration script for the Common UNIX Printing System (CUPS).
6 dnl Copyright 1997-2001 by Easy Software Products, all rights reserved.
8 dnl These coded instructions, statements, and computer programs are the
9 dnl property of Easy Software Products and are protected by Federal
10 dnl copyright law. Distribution and use rights are outlined in the file
11 dnl "LICENSE.txt" which should have been included with this file. If this
12 dnl file is missing or damaged please contact Easy Software Products
15 dnl Attn: CUPS Licensing Information
16 dnl Easy Software Products
17 dnl 44141 Airport View Drive, Suite 204
18 dnl Hollywood, Maryland 20636-3111 USA
20 dnl Voice: (301) 373-9603
21 dnl EMail: cups-info@cups.org
22 dnl WWW: http://www.cups.org
26 AC_CONFIG_HEADER(config.h)
29 dnl Get the operating system and version number...
32 uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
33 if test "$uname" = "IRIX64"; then
37 dnl Clear the debugging and non-shared library options unless the user asks
44 CXXFLAGS="${CXXFLAGS:=}"
45 DSOFLAGS="${DSOFLAGS:=}"
48 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],[if eval "test x$enable_debug = xyes"; then
51 AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=yes]])
52 AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support [default=no]])
53 AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
54 turn on building with libtool (UNSUPPORTED!) [default=no]],[if eval "test x$enable_libtool_unsupported != xno"; then
55 LIBTOOL="$enable_libtool_unsupported"
57 echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
58 echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
59 echo " (even if you have a support contract)"
64 if test "$enable_shared" != "no"; then
67 LIBCUPS="libcups.so.2"
68 LIBCUPSIMAGE="libcupsimage.so.2"
70 DSOFLAGS="$DSOFLAGS -Wl,-h,\$@ -G \$(OPTIM)"
73 LIBCUPS="libcups.sl.2"
74 LIBCUPSIMAGE="libcupsimage.sl.2"
76 DSOFLAGS="$DSOFLAGS -b -z +h \$@"
78 FreeBSD* | NetBSD* | OpenBSD*)
79 LIBCUPS="libcups.so.2"
80 LIBCUPSIMAGE="libcupsimage.so.2"
82 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
85 LIBCUPS="libcups.so.2"
86 LIBCUPSIMAGE="libcupsimage.so.2"
88 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
91 LIBCUPS="libcups.so.2"
92 LIBCUPSIMAGE="libcupsimage.so.2"
94 DSOFLAGS="$DSOFLAGS -soname \$@ -shared \$(OPTIM)"
97 AC_MSG_WARN(Shared library support for AIX not available yet - defaulting to static)
101 LIBCUPSIMAGE="libcupsimage.a"
105 echo "Warning: shared libraries may not be supported. Trying -shared"
106 echo " option with compiler."
107 LIBCUPS="libcups.so.2"
108 LIBCUPSIMAGE="libcupsimage.so.2"
110 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
116 LIBCUPSIMAGE="libcupsimage.a"
120 if test "$LIBTOOL" != ""; then
122 LIBCUPSIMAGE="libcupsimage.la"
123 LINKCUPS="../cups/\$(LIBCUPS)"
124 LINKCUPSIMAGE="../filter/\$(LIBCUPSIMAGE)"
128 LINKCUPS="-L../cups -lcups"
129 LINKCUPSIMAGE="-L../filter -lcupsimage"
131 if test $enable_shared = no; then
132 LINKCUPS="$LINKCUPS \$(SSLLIBS)"
136 AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support [default=yes]])
138 # Don't use PAM with AIX...
139 if test $uname = AIX; then
143 AC_ARG_WITH(fontpath, [ --with-fontpath set font path for pstoraster],fontpath="$withval",fontpath="")
144 AC_ARG_WITH(docdir, [ --with-docdir set path for documentation],docdir="$withval",docdir="")
145 AC_ARG_WITH(logdir, [ --with-logdir set path for log files],logdir="$withval",logdir="")
146 AC_ARG_WITH(rcdir, [ --with-rcdir set path for rc scripts],rcdir="$withval",rcdir="")
148 dnl Checks for programs...
155 AC_PATH_PROG(CHMOD,chmod)
156 AC_PATH_PROG(CHOWN,chown)
159 AC_PATH_PROG(NROFF,nroff)
160 if test "$NROFF" = ""; then
161 AC_PATH_PROG(GROFF,groff)
162 if test "$GROFF" = ""; then
165 NROFF="$GROFF -T ascii"
168 AC_PATH_PROG(HTMLDOC,htmldoc)
169 AC_PATH_PROG(MKDIR,mkdir)
171 AC_PATH_PROG(SED,sed)
173 dnl Architecture checks...
176 dnl Check for libraries...
177 AC_CHECK_LIB(c,crypt,LIBS="$LIBS")
178 if test "$ac_cv_lib_c_crypt" = "no"; then
179 AC_CHECK_LIB(crypt,crypt)
181 AC_CHECK_LIB(sec,getspent)
182 AC_CHECK_LIB(gen,getspent)
185 AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
186 if test "$ac_cv_lib_c_mallinfo" = "no"; then
187 AC_CHECK_LIB(malloc,mallinfo,
190 AC_DEFINE(HAVE_MALLINFO),
195 if test "$enable_pam" != "no"; then
197 AC_CHECK_LIB(dl,dlopen)
198 AC_CHECK_LIB(pam,pam_start)
199 if test "$ac_cv_lib_pam_pam_start" != "no"; then
200 if test -d /etc/pam.d; then
212 AC_CHECK_LIB(socket,socket,
213 if test "$uname" != "IRIX"; then
216 echo "Not using -lsocket since you are running IRIX."
218 AC_CHECK_LIB(nsl,gethostbyaddr,
219 if test "$uname" != "IRIX"; then
220 NETLIBS="$NETLIBS -lnsl"
222 echo "Not using -lnsl since you are running IRIX."
225 dnl Encryption support...
230 if test "$enable_ssl" = "yes"; then
231 dnl Save the current libraries so the crypto stuff isn't always
235 dnl Some ELF systems can't resolve all the symbols in libcrypto
236 dnl if libcrypto was linked against RSAREF, and fail to link the
237 dnl test program correctly, even though a correct installation
238 dnl of OpenSSL exists. So we test the linking three times in
239 dnl case the RSAREF libraries are needed.
243 "-lcrypto -lrsaref" \
244 "-lcrypto -lRSAglue -lrsaref"
246 AC_CHECK_LIB(ssl,SSL_new,
247 [SSLLIBS="-lssl $libcrypto"
248 AC_DEFINE(HAVE_LIBSSL)],,
251 if test "x${SSLLIBS}" != "x"; then
259 dnl Save the current libraries since we don't want the image libraries
260 dnl included with every program...
263 dnl Check for image libraries...
274 AC_CHECK_HEADER(jpeglib.h,
275 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
276 AC_DEFINE(HAVE_LIBJPEG)
278 LIBS="$LIBS -ljpeg"))
280 AC_CHECK_HEADER(zlib.h,
281 AC_CHECK_LIB(z, gzgets,
286 dnl PNG library uses math library functions...
289 AC_CHECK_HEADER(png.h,
290 AC_CHECK_LIB(png, png_set_tRNS_to_alpha,
291 AC_DEFINE(HAVE_LIBPNG)
294 AC_CHECK_HEADER(tiff.h,
295 AC_CHECK_LIB(tiff, TIFFReadScanline,
296 AC_DEFINE(HAVE_LIBTIFF)
299 dnl Restore original LIBS settings...
302 dnl Checks for header files.
305 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
306 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
307 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
308 AC_CHECK_HEADER(stddef.h,AC_DEFINE(HAVE_STDDEF_H))
309 AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
310 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
311 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
312 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
313 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
315 dnl Checks for string functions.
316 AC_CHECK_FUNCS(strdup)
317 AC_CHECK_FUNCS(strcasecmp)
318 AC_CHECK_FUNCS(strncasecmp)
319 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
320 echo Forcing snprintf emulation for HP-UX.
322 AC_CHECK_FUNCS(snprintf)
323 AC_CHECK_FUNCS(vsnprintf)
326 dnl Check OS version and use appropriate format string for strftime...
327 AC_MSG_CHECKING(for correct format string to use with strftime)
333 AC_DEFINE(CUPS_STRFTIME_FORMAT, NULL)
338 AC_DEFINE(CUPS_STRFTIME_FORMAT, "%c")
342 dnl Checks for mkstemp function.
343 AC_CHECK_FUNCS(mkstemp)
345 dnl Checks for vsyslog function.
346 AC_CHECK_FUNCS(vsyslog)
348 dnl Checks for signal functions.
349 if test "$uname" != "Linux"; then
350 AC_CHECK_FUNCS(sigset)
353 AC_CHECK_FUNCS(sigaction)
355 dnl Checks for wait functions.
356 AC_CHECK_FUNCS(waitpid)
357 AC_CHECK_FUNCS(wait3)
359 dnl Update compiler options...
360 if test -n "$GCC"; then
363 if test -z "$OPTIM"; then
366 if test $PICFLAG = 1; then
373 if test -z "$OPTIM"; then
374 OPTIM="-O2 -qmaxmem=6000"
378 if test -z "$OPTIM"; then
382 OPTIM="+DAportable $OPTIM"
383 if test $PICFLAG = 1; then
388 if test -z "$OPTIM"; then
391 if test $uversion -ge 62; then
392 OPTIM="$OPTIM -n32 -mips3"
394 OPTIM="-fullwarn $OPTIM"
398 if test -z "$OPTIM"; then
401 OPTIM="$OPTIM -xarch=generic"
402 if test $PICFLAG = 1; then
408 if test -z "$OPTIM"; then
411 if test $PICFLAG = 1; then
416 # Running some other operating system; inform the user they
417 # should contribute the necessary options to
418 # cups-support@cups.org...
419 echo "Building CUPS with default compiler optimizations; contact"
420 echo "cups-support@cups.org with uname and compiler options needed"
421 echo "for your platform, or set the CFLAGS environment variable"
422 echo "before running configure."
427 if test "$DSO" != ":"; then
428 # When using DSOs the image libraries are linked to libcupsimage.so
429 # rather than to the executables. This makes things smaller if you
430 # are using any static libraries, and it also allows us to distribute
431 # a single DSO rather than a bunch...
432 DSOLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
435 # The *BSD, HP-UX, and Solaris run-time linkers need help when
436 # deciding where to find a DSO. Add linker options to tell them
437 # where to find the DSO (usually in /usr/lib... duh!)
441 DSOFLAGS="+b $libdir +fb $DSOFLAGS"
442 LDFLAGS="$LDFLAGS -Wl,+b,$libdir,+fb"
446 DSOFLAGS="-R$libdir $DSOFLAGS"
447 LDFLAGS="$LDFLAGS -R$libdir"
449 FreeBSD* | NetBSD* | OpenBSD*)
451 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
452 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
457 IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
464 AC_SUBST(LIBCUPSIMAGE)
467 AC_SUBST(LINKCUPSIMAGE)
469 dnl Fix "prefix" variable if it hasn't been specified...
470 if test "$prefix" = "NONE"; then
474 dnl Fix "exec_prefix" variable if it hasn't been specified...
475 if test "$exec_prefix" = "NONE"; then
476 if test "$prefix" = "/"; then
479 exec_prefix="$prefix"
483 dnl Fix "sharedstatedir" variable if it hasn't been specified...
484 if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
485 sharedstatedir="/usr/com"
488 dnl Fix "datadir" variable if it hasn't been specified...
489 if test "$datadir" = "\${prefix}/share"; then
490 if test "$prefix" = "/"; then
493 datadir="$prefix/share"
497 dnl Fix "includedir" variable if it hasn't been specified...
498 if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
499 includedir="/usr/include"
502 dnl Fix "localstatedir" variable if it hasn't been specified...
503 if test "$localstatedir" = "\${prefix}/var"; then
504 if test "$prefix" = "/"; then
507 localstatedir="$prefix/var"
511 dnl Fix "sysconfdir" variable if it hasn't been specified...
512 if test "$sysconfdir" = "\${prefix}/etc"; then
513 if test "$prefix" = "/"; then
516 sysconfdir="$prefix/etc"
520 dnl Fix "libdir" variable for IRIX 6.x...
521 if test "$uname" = "IRIX" -a $uversion -ge 62; then
522 libdir="$exec_prefix/lib32"
525 dnl Fix "mandir" variable...
526 if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
528 FreeBSD* | NetBSD* | OpenBSD* | AIX*)
530 mandir="/usr/share/man"
531 AMANDIR="/usr/share/man"
535 mandir="/usr/share/catman/u_man"
536 AMANDIR="/usr/share/catman/a_man"
550 dnl Fix "fontpath" variable...
551 if test "x$fontpath" = "x"; then
552 fontpath="$datadir/cups/fonts"
555 dnl Setup manpage extensions...
557 FreeBSD* | NetBSD* | OpenBSD*)
592 dnl Setup init.d locations...
593 if test x$rcdir = x; then
596 # FreeBSD and OpenBSD
608 # Linux seems to choose an init.d directory at random...
609 if test -d /sbin/init.d; then
611 INITDIR="/sbin/init.d"
614 if test -d /etc/rc.d; then
650 dnl Setup default locations...
651 CUPS_SERVERROOT='${sysconfdir}/cups'
652 CUPS_REQUESTS='${localstatedir}/spool/cups'
654 AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
655 AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$localstatedir/spool/cups")
657 if test x$logdir = x; then
658 CUPS_LOGDIR='${localstatedir}/log/cups'
659 AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$localstatedir/log/cups")
661 CUPS_LOGDIR="$logdir"
662 AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$logdir")
665 dnl See what directory to put server executables...
667 FreeBSD* | NetBSD* | OpenBSD*)
670 CUPS_SERVERBIN='${exec_prefix}/libexec/cups'
671 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/libexec/cups")
675 INSTALL_SYSV="install-sysv"
676 CUPS_SERVERBIN='${exec_prefix}/lib/cups'
677 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/lib/cups")
681 AC_SUBST(INSTALL_SYSV)
682 AC_SUBST(CUPS_SERVERROOT)
683 AC_SUBST(CUPS_SERVERBIN)
684 AC_SUBST(CUPS_LOGDIR)
685 AC_SUBST(CUPS_REQUESTS)
687 dnl Set the CUPS_LOCALE directory...
689 Linux* | FreeBSD* | NetBSD* | OpenBSD*)
690 CUPS_LOCALEDIR='${datadir}/locale'
691 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$datadir/locale")
695 CUPS_LOCALEDIR='${exec_prefix}/lib/nls/msg'
696 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/nls/msg")
700 # This is the standard System V location...
701 CUPS_LOCALEDIR='${exec_prefix}/lib/locale'
702 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/locale")
706 AC_SUBST(CUPS_LOCALEDIR)
708 dnl Set the CUPS_DATADIR directory...
709 CUPS_DATADIR='${datadir}/cups'
710 AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$datadir/cups")
711 AC_SUBST(CUPS_DATADIR)
713 dnl Set the CUPS_DOCROOT directory...
714 if test x$docdir = x; then
715 CUPS_DOCROOT='${datadir}/doc/cups'
716 docdir="$datadir/doc/cups"
718 CUPS_DOCROOT="$docdir"
721 AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$docdir")
722 AC_SUBST(CUPS_DOCROOT)
724 dnl Set the CUPS_FONTPATH directory...
725 AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
727 AC_OUTPUT(Makedefs cups.sh)
730 dnl End of "$Id: configure.in,v 1.95 2001/06/22 19:21:47 mike Exp $".