2 dnl "$Id: configure.in,v 1.83.2.2 2001/05/13 18:37:58 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=yes]])
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.3"
68 LIBCUPSIMAGE="libcupsimage.so.2"
70 DSOFLAGS="$DSOFLAGS -Wl,-h,\$@ -G \$(OPTIM)"
73 LIBCUPS="libcups.sl.3"
74 LIBCUPSIMAGE="libcupsimage.sl.2"
76 DSOFLAGS="$DSOFLAGS -b -z +h \$@"
78 FreeBSD* | NetBSD* | OpenBSD*)
79 LIBCUPS="libcups.so.3"
80 LIBCUPSIMAGE="libcupsimage.so.2"
82 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
85 LIBCUPS="libcups.so.3"
86 LIBCUPSIMAGE="libcupsimage.so.2"
88 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
91 LIBCUPS="libcups.so.3"
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.3"
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"
132 AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support [default=yes]])
134 # Don't use PAM with AIX...
135 if test $uname = AIX; then
139 AC_ARG_WITH(fontpath, [ --with-fontpath set font path for pstoraster],fontpath="$withval",fontpath="")
140 AC_ARG_WITH(docdir, [ --with-docdir set path for documentation],docdir="$withval",docdir="")
141 AC_ARG_WITH(logdir, [ --with-logdir set path for log files],logdir="$withval",logdir="")
143 dnl Checks for programs...
150 AC_PATH_PROG(CHMOD,chmod)
151 AC_PATH_PROG(CHOWN,chown)
154 AC_PATH_PROG(NROFF,nroff)
155 if test "$NROFF" = ""; then
156 AC_PATH_PROG(GROFF,groff)
157 if test "$GROFF" = ""; then
160 NROFF="$GROFF -T ascii"
163 AC_PATH_PROG(HTMLDOC,htmldoc)
164 AC_PATH_PROG(MKDIR,mkdir)
166 AC_PATH_PROG(SED,sed)
168 dnl Architecture checks...
171 dnl Check for libraries...
172 AC_CHECK_LIB(c,crypt,LIBS="$LIBS")
173 if test "$ac_cv_lib_c_crypt" = "no"; then
174 AC_CHECK_LIB(crypt,crypt)
176 AC_CHECK_LIB(sec,getspent)
179 AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
180 if test "$ac_cv_lib_c_mallinfo" = "no"; then
181 AC_CHECK_LIB(malloc,mallinfo,
184 AC_DEFINE(HAVE_MALLINFO),
189 if test "$enable_pam" != "no"; then
191 AC_CHECK_LIB(dl,dlopen)
192 AC_CHECK_LIB(pam,pam_start)
193 if test "$ac_cv_lib_pam_pam_start" != "no"; then
204 AC_CHECK_LIB(socket,socket,
205 if test "$uname" != "IRIX"; then
208 echo "Not using -lsocket since you are running IRIX."
210 AC_CHECK_LIB(nsl,gethostbyaddr,
211 if test "$uname" != "IRIX"; then
212 NETLIBS="$NETLIBS -lnsl"
214 echo "Not using -lnsl since you are running IRIX."
217 dnl Encryption support...
222 if test "$enable_ssl" != "no"; then
223 dnl Save the current libraries so the crypto stuff isn't always
227 dnl Some ELF systems can't resolve all the symbols in libcrypto
228 dnl if libcrypto was linked against RSAREF, and fail to link the
229 dnl test program correctly, even though a correct installation
230 dnl of OpenSSL exists. So we test the linking three times in
231 dnl case the RSAREF libraries are needed.
235 "-lcrypto -lrsaref" \
236 "-lcrypto -lRSAglue -lrsaref"
238 AC_CHECK_LIB(ssl,SSL_new,
239 [SSLLIBS="-lssl $libcrypto"
240 AC_DEFINE(HAVE_LIBSSL)],,
243 if test "x${SSLLIBS}" != "x"; then
251 dnl Save the current libraries since we don't want the image libraries
252 dnl included with every program...
255 dnl Check for image libraries...
266 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
267 AC_DEFINE(HAVE_LIBJPEG)
271 AC_CHECK_LIB(z, gzgets,
276 dnl PNG library uses math library functions...
279 AC_CHECK_LIB(png, png_set_tRNS_to_alpha,
280 AC_DEFINE(HAVE_LIBPNG)
283 AC_CHECK_LIB(tiff, TIFFReadScanline,
284 AC_DEFINE(HAVE_LIBTIFF)
287 dnl Restore original LIBS settings...
290 dnl Checks for header files.
293 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
294 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
295 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
296 AC_CHECK_HEADER(stddef.h,AC_DEFINE(HAVE_STDDEF_H))
297 AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
298 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
299 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
300 AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
301 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
303 dnl Checks for string functions.
304 AC_CHECK_FUNCS(strdup)
305 AC_CHECK_FUNCS(strcasecmp)
306 AC_CHECK_FUNCS(strncasecmp)
307 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
308 echo Forcing snprintf emulation for HP-UX.
310 AC_CHECK_FUNCS(snprintf)
311 AC_CHECK_FUNCS(vsnprintf)
314 dnl Check OS version and use appropriate format string for strftime...
315 AC_MSG_CHECKING(for correct format string to use with strftime)
321 AC_DEFINE(CUPS_STRFTIME_FORMAT, NULL)
326 AC_DEFINE(CUPS_STRFTIME_FORMAT, "%c")
330 dnl Checks for vsyslog function.
331 AC_CHECK_FUNCS(vsyslog)
333 dnl Checks for signal functions.
334 if test "$uname" != "Linux"; then
335 AC_CHECK_FUNCS(sigset)
338 AC_CHECK_FUNCS(sigaction)
340 dnl Checks for wait functions.
341 AC_CHECK_FUNCS(waitpid)
342 AC_CHECK_FUNCS(wait3)
344 dnl Update compiler options...
345 if test -n "$GCC"; then
348 if test -z "$OPTIM"; then
351 if test $PICFLAG = 1; then
358 if test -z "$OPTIM"; then
359 OPTIM="-O2 -qmaxmem=6000"
363 if test -z "$OPTIM"; then
367 OPTIM="+DAportable $OPTIM"
368 if test $PICFLAG = 1; then
373 if test -z "$OPTIM"; then
376 if test $uversion -ge 62; then
377 OPTIM="$OPTIM -n32 -mips3"
379 OPTIM="-fullwarn $OPTIM"
383 if test -z "$OPTIM"; then
386 OPTIM="$OPTIM -xarch=generic"
387 if test $PICFLAG = 1; then
392 # Running some other operating system; inform the user they
393 # should contribute the necessary options to
394 # cups-support@cups.org...
395 echo "Building CUPS with default compiler optimizations; contact"
396 echo "cups-support@cups.org with uname and compiler options needed"
397 echo "for your platform, or set the CFLAGS environment variable"
398 echo "before running configure."
403 if test "$DSO" != ":"; then
404 # When using DSOs the image libraries are linked to libcupsimage.so
405 # rather than to the executables. This makes things smaller if you
406 # are using any static libraries, and it also allows us to distribute
407 # a single DSO rather than a bunch...
408 DSOLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
411 # The *BSD, HP-UX, and Solaris run-time linkers need help when
412 # deciding where to find a DSO. Add linker options to tell them
413 # where to find the DSO (usually in /usr/lib... duh!)
417 DSOFLAGS="+b $libdir +fb $DSOFLAGS"
418 LDFLAGS="$LDFLAGS -Wl,+b,$libdir,+fb"
422 DSOFLAGS="-R$libdir $DSOFLAGS"
423 LDFLAGS="$LDFLAGS -R$libdir"
425 FreeBSD* | NetBSD* | OpenBSD*)
427 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
428 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
433 IMGLIBS="\$(LIBPNG) \$(LIBTIFF) \$(LIBJPEG) \$(LIBZ)"
440 AC_SUBST(LIBCUPSIMAGE)
443 AC_SUBST(LINKCUPSIMAGE)
445 dnl Fix "prefix" variable if it hasn't been specified...
446 if test "$prefix" = "NONE"; then
450 dnl Fix "exec_prefix" variable if it hasn't been specified...
451 if test "$exec_prefix" = "NONE"; then
452 if test "$prefix" = "/"; then
455 exec_prefix="$prefix"
459 dnl Fix "sharedstatedir" variable if it hasn't been specified...
460 if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
461 sharedstatedir="/usr/com"
464 dnl Fix "datadir" variable if it hasn't been specified...
465 if test "$datadir" = "\${prefix}/share"; then
466 if test "$prefix" = "/"; then
469 datadir="$prefix/share"
473 dnl Fix "includedir" variable if it hasn't been specified...
474 if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
475 includedir="/usr/include"
478 dnl Fix "localstatedir" variable if it hasn't been specified...
479 if test "$localstatedir" = "\${prefix}/var"; then
480 if test "$prefix" = "/"; then
483 localstatedir="$prefix/var"
487 dnl Fix "sysconfdir" variable if it hasn't been specified...
488 if test "$sysconfdir" = "\${prefix}/etc"; then
489 if test "$prefix" = "/"; then
492 sysconfdir="$prefix/etc"
496 dnl Fix "libdir" variable for IRIX 6.x...
497 if test "$uname" = "IRIX" -a $uversion -ge 62; then
498 libdir="$exec_prefix/lib32"
501 dnl Fix "mandir" variable...
502 if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
504 FreeBSD* | NetBSD* | OpenBSD* | AIX*)
506 mandir="/usr/share/man"
507 AMANDIR="/usr/share/man"
511 mandir="/usr/share/catman/u_man"
512 AMANDIR="/usr/share/catman/a_man"
526 dnl Fix "fontpath" variable...
527 if test "x$fontpath" = "x"; then
528 fontpath="$datadir/cups/fonts"
531 dnl Setup manpage extensions...
533 FreeBSD* | NetBSD* | OpenBSD*)
568 dnl Setup init.d locations...
571 # FreeBSD and OpenBSD
583 # Linux seems to choose an init.d directory at random...
584 if test -d /sbin/init.d; then
586 INITDIR="/sbin/init.d"
589 if test -d /etc/rc.d; then
621 dnl Setup default locations...
622 CUPS_SERVERROOT='${sysconfdir}/cups'
623 CUPS_REQUESTS='${localstatedir}/spool/cups'
625 AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
626 AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$localstatedir/spool/cups")
628 if test x$logdir = x; then
629 CUPS_LOGDIR='${localstatedir}/log/cups'
630 AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$localstatedir/log/cups")
632 CUPS_LOGDIR="$logdir"
633 AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$logdir")
636 dnl See what directory to put server executables...
638 FreeBSD* | NetBSD* | OpenBSD*)
641 CUPS_SERVERBIN='${exec_prefix}/libexec/cups'
642 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/libexec/cups")
646 INSTALL_SYSV="install-sysv"
647 CUPS_SERVERBIN='${exec_prefix}/lib/cups'
648 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/lib/cups")
652 AC_SUBST(INSTALL_SYSV)
653 AC_SUBST(CUPS_SERVERROOT)
654 AC_SUBST(CUPS_SERVERBIN)
655 AC_SUBST(CUPS_LOGDIR)
656 AC_SUBST(CUPS_REQUESTS)
658 dnl Set the CUPS_LOCALE directory...
660 Linux* | FreeBSD* | NetBSD* | OpenBSD*)
661 CUPS_LOCALEDIR='${datadir}/locale'
662 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$datadir/locale")
666 CUPS_LOCALEDIR='${exec_prefix}/lib/nls/msg'
667 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/nls/msg")
671 # This is the standard System V location...
672 CUPS_LOCALEDIR='${exec_prefix}/lib/locale'
673 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/locale")
677 AC_SUBST(CUPS_LOCALEDIR)
679 dnl Set the CUPS_DATADIR directory...
680 CUPS_DATADIR='${datadir}/cups'
681 AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$datadir/cups")
682 AC_SUBST(CUPS_DATADIR)
684 dnl Set the CUPS_DOCROOT directory...
685 if test x$docdir = x; then
686 CUPS_DOCROOT='${datadir}/doc/cups'
687 docdir="$datadir/doc/cups"
689 CUPS_DOCROOT="$docdir"
692 AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$docdir")
693 AC_SUBST(CUPS_DOCROOT)
695 dnl Set the CUPS_FONTPATH directory...
696 AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
698 AC_OUTPUT(Makedefs cups.sh)
701 dnl End of "$Id: configure.in,v 1.83.2.2 2001/05/13 18:37:58 mike Exp $".