2 dnl "$Id: configure.in,v 1.93 2001/05/31 19:33:10 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_LIB(jpeg, jpeg_destroy_decompress,
275 AC_DEFINE(HAVE_LIBJPEG)
279 AC_CHECK_LIB(z, gzgets,
284 dnl PNG library uses math library functions...
287 AC_CHECK_LIB(png, png_set_tRNS_to_alpha,
288 AC_DEFINE(HAVE_LIBPNG)
291 AC_CHECK_LIB(tiff, TIFFReadScanline,
292 AC_DEFINE(HAVE_LIBTIFF)
295 dnl Restore original LIBS settings...
298 dnl Checks for header files.
301 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
302 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
303 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
304 AC_CHECK_HEADER(stddef.h,AC_DEFINE(HAVE_STDDEF_H))
305 AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
306 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
307 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
308 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
309 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
311 dnl Checks for string functions.
312 AC_CHECK_FUNCS(strdup)
313 AC_CHECK_FUNCS(strcasecmp)
314 AC_CHECK_FUNCS(strncasecmp)
315 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
316 echo Forcing snprintf emulation for HP-UX.
318 AC_CHECK_FUNCS(snprintf)
319 AC_CHECK_FUNCS(vsnprintf)
322 dnl Check OS version and use appropriate format string for strftime...
323 AC_MSG_CHECKING(for correct format string to use with strftime)
329 AC_DEFINE(CUPS_STRFTIME_FORMAT, NULL)
334 AC_DEFINE(CUPS_STRFTIME_FORMAT, "%c")
338 dnl Checks for vsyslog function.
339 AC_CHECK_FUNCS(vsyslog)
341 dnl Checks for signal functions.
342 if test "$uname" != "Linux"; then
343 AC_CHECK_FUNCS(sigset)
346 AC_CHECK_FUNCS(sigaction)
348 dnl Checks for wait functions.
349 AC_CHECK_FUNCS(waitpid)
350 AC_CHECK_FUNCS(wait3)
352 dnl Update compiler options...
353 if test -n "$GCC"; then
356 if test -z "$OPTIM"; then
359 if test $PICFLAG = 1; then
366 if test -z "$OPTIM"; then
367 OPTIM="-O2 -qmaxmem=6000"
371 if test -z "$OPTIM"; then
375 OPTIM="+DAportable $OPTIM"
376 if test $PICFLAG = 1; then
381 if test -z "$OPTIM"; then
384 if test $uversion -ge 62; then
385 OPTIM="$OPTIM -n32 -mips3"
387 OPTIM="-fullwarn $OPTIM"
391 if test -z "$OPTIM"; then
394 OPTIM="$OPTIM -xarch=generic"
395 if test $PICFLAG = 1; then
401 if test -z "$OPTIM"; then
404 if test $PICFLAG = 1; then
409 # Running some other operating system; inform the user they
410 # should contribute the necessary options to
411 # cups-support@cups.org...
412 echo "Building CUPS with default compiler optimizations; contact"
413 echo "cups-support@cups.org with uname and compiler options needed"
414 echo "for your platform, or set the CFLAGS environment variable"
415 echo "before running configure."
420 if test "$DSO" != ":"; then
421 # When using DSOs the image libraries are linked to libcupsimage.so
422 # rather than to the executables. This makes things smaller if you
423 # are using any static libraries, and it also allows us to distribute
424 # a single DSO rather than a bunch...
425 DSOLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
428 # The *BSD, HP-UX, and Solaris run-time linkers need help when
429 # deciding where to find a DSO. Add linker options to tell them
430 # where to find the DSO (usually in /usr/lib... duh!)
434 DSOFLAGS="+b $libdir +fb $DSOFLAGS"
435 LDFLAGS="$LDFLAGS -Wl,+b,$libdir,+fb"
439 DSOFLAGS="-R$libdir $DSOFLAGS"
440 LDFLAGS="$LDFLAGS -R$libdir"
442 FreeBSD* | NetBSD* | OpenBSD*)
444 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
445 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
450 IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
457 AC_SUBST(LIBCUPSIMAGE)
460 AC_SUBST(LINKCUPSIMAGE)
462 dnl Fix "prefix" variable if it hasn't been specified...
463 if test "$prefix" = "NONE"; then
467 dnl Fix "exec_prefix" variable if it hasn't been specified...
468 if test "$exec_prefix" = "NONE"; then
469 if test "$prefix" = "/"; then
472 exec_prefix="$prefix"
476 dnl Fix "sharedstatedir" variable if it hasn't been specified...
477 if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
478 sharedstatedir="/usr/com"
481 dnl Fix "datadir" variable if it hasn't been specified...
482 if test "$datadir" = "\${prefix}/share"; then
483 if test "$prefix" = "/"; then
486 datadir="$prefix/share"
490 dnl Fix "includedir" variable if it hasn't been specified...
491 if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
492 includedir="/usr/include"
495 dnl Fix "localstatedir" variable if it hasn't been specified...
496 if test "$localstatedir" = "\${prefix}/var"; then
497 if test "$prefix" = "/"; then
500 localstatedir="$prefix/var"
504 dnl Fix "sysconfdir" variable if it hasn't been specified...
505 if test "$sysconfdir" = "\${prefix}/etc"; then
506 if test "$prefix" = "/"; then
509 sysconfdir="$prefix/etc"
513 dnl Fix "libdir" variable for IRIX 6.x...
514 if test "$uname" = "IRIX" -a $uversion -ge 62; then
515 libdir="$exec_prefix/lib32"
518 dnl Fix "mandir" variable...
519 if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
521 FreeBSD* | NetBSD* | OpenBSD* | AIX*)
523 mandir="/usr/share/man"
524 AMANDIR="/usr/share/man"
528 mandir="/usr/share/catman/u_man"
529 AMANDIR="/usr/share/catman/a_man"
543 dnl Fix "fontpath" variable...
544 if test "x$fontpath" = "x"; then
545 fontpath="$datadir/cups/fonts"
548 dnl Setup manpage extensions...
550 FreeBSD* | NetBSD* | OpenBSD*)
585 dnl Setup init.d locations...
586 if test x$rcdir = x; then
589 # FreeBSD and OpenBSD
601 # Linux seems to choose an init.d directory at random...
602 if test -d /sbin/init.d; then
604 INITDIR="/sbin/init.d"
607 if test -d /etc/rc.d; then
643 dnl Setup default locations...
644 CUPS_SERVERROOT='${sysconfdir}/cups'
645 CUPS_REQUESTS='${localstatedir}/spool/cups'
647 AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
648 AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$localstatedir/spool/cups")
650 if test x$logdir = x; then
651 CUPS_LOGDIR='${localstatedir}/log/cups'
652 AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$localstatedir/log/cups")
654 CUPS_LOGDIR="$logdir"
655 AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$logdir")
658 dnl See what directory to put server executables...
660 FreeBSD* | NetBSD* | OpenBSD*)
663 CUPS_SERVERBIN='${exec_prefix}/libexec/cups'
664 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/libexec/cups")
668 INSTALL_SYSV="install-sysv"
669 CUPS_SERVERBIN='${exec_prefix}/lib/cups'
670 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/lib/cups")
674 AC_SUBST(INSTALL_SYSV)
675 AC_SUBST(CUPS_SERVERROOT)
676 AC_SUBST(CUPS_SERVERBIN)
677 AC_SUBST(CUPS_LOGDIR)
678 AC_SUBST(CUPS_REQUESTS)
680 dnl Set the CUPS_LOCALE directory...
682 Linux* | FreeBSD* | NetBSD* | OpenBSD*)
683 CUPS_LOCALEDIR='${datadir}/locale'
684 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$datadir/locale")
688 CUPS_LOCALEDIR='${exec_prefix}/lib/nls/msg'
689 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/nls/msg")
693 # This is the standard System V location...
694 CUPS_LOCALEDIR='${exec_prefix}/lib/locale'
695 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/locale")
699 AC_SUBST(CUPS_LOCALEDIR)
701 dnl Set the CUPS_DATADIR directory...
702 CUPS_DATADIR='${datadir}/cups'
703 AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$datadir/cups")
704 AC_SUBST(CUPS_DATADIR)
706 dnl Set the CUPS_DOCROOT directory...
707 if test x$docdir = x; then
708 CUPS_DOCROOT='${datadir}/doc/cups'
709 docdir="$datadir/doc/cups"
711 CUPS_DOCROOT="$docdir"
714 AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$docdir")
715 AC_SUBST(CUPS_DOCROOT)
717 dnl Set the CUPS_FONTPATH directory...
718 AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
720 AC_OUTPUT(Makedefs cups.sh)
723 dnl End of "$Id: configure.in,v 1.93 2001/05/31 19:33:10 mike Exp $".