2 dnl "$Id: configure.in,v 1.74 2001/02/07 01:25:38 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
46 CXXFLAGS="${CXXFLAGS:=}"
47 DSOFLAGS="${DSOFLAGS:=}"
50 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],[if eval "test x$enable_debug = xyes"; then
54 AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=yes]])
55 AC_ARG_ENABLE(ssl, [ --enable-ssl turn on SSL/TLS support [default=no]])
56 AC_ARG_ENABLE(libtool_unsupported, [ --enable-libtool-unsupported=LIBTOOL_PATH
57 turn on building with libtool (UNSUPPORTED!) [default=no]],[if eval "test x$enable_libtool_unsupported != xno"; then
58 LIBTOOL="$enable_libtool_unsupported"
60 echo "WARNING: libtool is not supported or endorsed by Easy Software Products."
61 echo " WE DO NOT PROVIDE TECHNICAL SUPPORT FOR LIBTOOL PROBLEMS."
62 echo " (even if you have a support contract)"
67 if test "$enable_shared" != "no"; then
70 LIBCUPS="libcups.so.2"
71 LIBCUPSIMAGE="libcupsimage.so.2"
73 DSOFLAGS="$DSOFLAGS -Wl,-h,\$@ -G \$(OPTIM)"
76 LIBCUPS="libcups.sl.2"
77 LIBCUPSIMAGE="libcupsimage.sl.2"
79 DSOFLAGS="$DSOFLAGS -b -z +h \$@"
81 FreeBSD* | NetBSD* | OpenBSD*)
82 LIBCUPS="libcups.so.2"
83 LIBCUPSIMAGE="libcupsimage.so.2"
85 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
88 LIBCUPS="libcups.so.2"
89 LIBCUPSIMAGE="libcupsimage.so.2"
91 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
94 LIBCUPS="libcups.so.2"
95 LIBCUPSIMAGE="libcupsimage.so.2"
97 DSOFLAGS="$DSOFLAGS -soname \$@ -shared \$(OPTIM)"
100 echo "Warning: shared libraries may not be supported. Trying -shared"
101 echo " option with compiler."
102 LIBCUPS="libcups.so.2"
103 LIBCUPSIMAGE="libcupsimage.so.2"
105 DSOFLAGS="$DSOFLAGS -Wl,-soname,\$@ -shared \$(OPTIM)"
111 LIBCUPSIMAGE="libcupsimage.a"
115 if test "$LIBTOOL" != ""; then
117 LIBCUPSIMAGE="libcupsimage.la"
118 LINKCUPS="../cups/\$(LIBCUPS)"
119 LINKCUPSIMAGE="../filter/\$(LIBCUPSIMAGE)"
123 LINKCUPS="-L../cups -lcups"
124 LINKCUPSIMAGE="-L../filter -lcupsimage"
127 AC_ARG_ENABLE(pam, [ --enable-pam turn on PAM support [default=yes]])
129 AC_ARG_WITH(fontpath, [ --with-fontpath set font path for pstoraster],fontpath="$withval",fontpath="")
131 dnl Checks for programs...
138 AC_PATH_PROG(CHMOD,chmod)
139 AC_PATH_PROG(CHOWN,chown)
142 AC_PATH_PROG(NROFF,nroff)
143 if test "$NROFF" = ""; then
144 AC_PATH_PROG(GROFF,groff)
145 if test "$GROFF" = ""; then
148 NROFF="$GROFF -T ascii"
151 AC_PATH_PROG(HTMLDOC,htmldoc)
152 AC_PATH_PROG(MKDIR,mkdir)
154 AC_PATH_PROG(SED,sed)
156 dnl Architecture checks...
159 dnl Check for libraries...
160 AC_CHECK_LIB(c,crypt,LIBS="$LIBS")
161 if test "$ac_cv_lib_c_crypt" = "no"; then
162 AC_CHECK_LIB(crypt,crypt)
164 AC_CHECK_LIB(sec,getspent)
167 AC_CHECK_LIB(c,mallinfo,LIBS="$LIBS"; AC_DEFINE(HAVE_MALLINFO),LIBS="$LIBS")
168 if test "$ac_cv_lib_c_mallinfo" = "no"; then
169 AC_CHECK_LIB(malloc,mallinfo,
172 AC_DEFINE(HAVE_MALLINFO),
177 if test "$enable_pam" != "no"; then
179 AC_CHECK_LIB(dl,dlopen)
180 AC_CHECK_LIB(pam,pam_start)
181 if test "$ac_cv_lib_pam_pam_start" != "no"; then
192 AC_CHECK_LIB(socket,socket,
193 if test "$uname" != "IRIX"; then
196 echo "Not using -lsocket since you are running IRIX."
198 AC_CHECK_LIB(nsl,gethostbyaddr,
199 if test "$uname" != "IRIX"; then
200 NETLIBS="$NETLIBS -lnsl"
202 echo "Not using -lnsl since you are running IRIX."
205 dnl Encryption support...
210 if test "$enable_ssl" = "yes"; then
211 dnl Save the current libraries so the crypto stuff isn't always
215 dnl Some ELF systems can't resolve all the symbols in libcrypto
216 dnl if libcrypto was linked against RSAREF, and fail to link the
217 dnl test program correctly, even though a correct installation
218 dnl of OpenSSL exists. So we test the linking three times in
219 dnl case the RSAREF libraries are needed.
223 "-lcrypto -lrsaref" \
224 "-lcrypto -lRSAglue -lrsaref"
226 AC_CHECK_LIB(ssl,SSL_new,
227 [SSLLIBS="-lssl $libcrypto"
228 AC_DEFINE(HAVE_LIBSSL)],,
231 if test "x${SSLLIBS}" != "x"; then
239 dnl Save the current libraries since we don't want the image libraries
240 dnl included with every program...
243 dnl Check for image libraries...
254 AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
255 AC_DEFINE(HAVE_LIBJPEG)
259 AC_CHECK_LIB(z, gzgets,
264 dnl PNG library uses math library functions...
267 AC_CHECK_LIB(png, png_set_tRNS_to_alpha,
268 AC_DEFINE(HAVE_LIBPNG)
271 AC_CHECK_LIB(tiff, TIFFReadScanline,
272 AC_DEFINE(HAVE_LIBTIFF)
275 dnl Restore original LIBS settings...
278 dnl Checks for header files.
281 AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
282 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
283 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
284 AC_CHECK_HEADER(stddef.h,AC_DEFINE(HAVE_STDDEF_H))
285 AC_CHECK_HEADER(stdlib.h,AC_DEFINE(HAVE_STDLIB_H))
286 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
288 dnl Checks for string functions.
289 AC_CHECK_FUNCS(strdup)
290 AC_CHECK_FUNCS(strcasecmp)
291 AC_CHECK_FUNCS(strncasecmp)
292 if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
293 echo Forcing snprintf emulation for HP-UX.
295 AC_CHECK_FUNCS(snprintf)
296 AC_CHECK_FUNCS(vsnprintf)
299 dnl Check OS version and use appropriate format string for strftime...
300 AC_MSG_CHECKING(for correct format string to use with strftime)
306 AC_DEFINE(CUPS_STRFTIME_FORMAT, NULL)
311 AC_DEFINE(CUPS_STRFTIME_FORMAT, "%c")
315 dnl Checks for vsyslog function.
316 AC_CHECK_FUNCS(vsyslog)
318 dnl Checks for signal functions.
319 if test "$uname" != "Linux"; then
320 AC_CHECK_FUNCS(sigset)
323 AC_CHECK_FUNCS(sigaction)
325 dnl Checks for wait functions.
326 AC_CHECK_FUNCS(waitpid)
327 AC_CHECK_FUNCS(wait3)
329 dnl Update compiler options...
330 if test -n "$GCC"; then
333 if test -z "$OPTIM"; then
337 if test $PICFLAG = 1; then
339 GSOPTIM="-fPIC $GSOPTIM"
342 GSOPTIM="-Wall $GSOPTIM"
346 if test -z "$OPTIM"; then
350 if test $uversion -ge 62; then
351 OPTIM="$OPTIM -n32 -mips3"
352 GSOPTIM="$GSOPTIM -n32 -mips3"
354 OPTIM="-fullwarn $OPTIM"
355 GSOPTIM="-fullwarn $GSOPTIM"
358 if test -z "$OPTIM"; then
363 GSOPTIM="-Ae $GSOPTIM"
367 if test -z "$OPTIM"; then
371 if test $PICFLAG = 1; then
373 GSOPTIM="-KPIC $GSOPTIM"
377 # Running some other operating system; inform the user they
378 # should contribute the necessary options to
379 # cups-support@cups.org...
380 echo "Building CUPS with default compiler optimizations; contact"
381 echo "cups-support@cups.org with uname and compiler options needed"
382 echo "for your platform, or set the CFLAGS environment variable"
383 echo "before running configure."
388 if test "$DSO" != ":"; then
389 # When using DSOs the image libraries are linked to libcupsimage.so
390 # rather than to the executables. This makes things smaller if you
391 # are using any static libraries, and it also allows us to distribute
392 # a single DSO rather than a bunch...unless the linker is dumb.
395 # NetBSD's linker won't resolve symbols in a shared
396 # libraries unless their enclosing shared libraries
397 # are explicitly listed.
398 DSOLIBS="\$(LIBJPEG) \$(LIBPNG) \$(LIBTIFF) \$(LIBZ)"
399 IMGLIBS="\$(LIBJPEG) \$(LIBPNG) \$(LIBTIFF) \$(LIBZ)"
402 DSOLIBS="\$(LIBJPEG) \$(LIBPNG) \$(LIBTIFF) \$(LIBZ)"
407 # The *BSD, HP-UX, and Solaris run-time linkers need help when
408 # deciding where to find a DSO. Add linker options to tell them
409 # where to find the DSO (usually in /usr/lib... duh!)
413 DSOFLAGS="+b $libdir +fb $DSOFLAGS"
414 LDFLAGS="$LDFLAGS -Wl,+b,$libdir,+fb"
418 DSOFLAGS="-R$libdir $DSOFLAGS"
419 LDFLAGS="$LDFLAGS -R$libdir"
421 FreeBSD* | NetBSD* | OpenBSD*)
423 DSOFLAGS="-Wl,-R$libdir $DSOFLAGS"
424 LDFLAGS="$LDFLAGS -Wl,-R$libdir"
429 IMGLIBS="\$(LIBJPEG) \$(LIBPNG) \$(LIBTIFF) \$(LIBZ)"
436 AC_SUBST(LIBCUPSIMAGE)
439 AC_SUBST(LINKCUPSIMAGE)
441 dnl Fix "prefix" variable if it hasn't been specified...
442 if test "$prefix" = "NONE"; then
446 dnl Fix "exec_prefix" variable if it hasn't been specified...
447 if test "$exec_prefix" = "NONE"; then
448 if test "$prefix" = "/"; then
451 exec_prefix="$prefix"
455 dnl Fix "sharedstatedir" variable if it hasn't been specified...
456 if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then
457 sharedstatedir="/usr/com"
460 dnl Fix "infodir" variable if it hasn't been specified...
461 if test "$infodir" = "\${prefix}/info" -a "$prefix" = "/"; then
465 dnl Fix "datadir" variable if it hasn't been specified...
466 if test "$datadir" = "\${prefix}/share"; then
467 if test "$prefix" = "/"; then
470 datadir="$prefix/share"
474 dnl Fix "includedir" variable if it hasn't been specified...
475 if test "$includedir" = "\${prefix}/include" -a "$prefix" = "/"; then
476 includedir="/usr/include"
479 dnl Fix "localstatedir" variable if it hasn't been specified...
480 if test "$localstatedir" = "\${prefix}/var"; then
481 if test "$prefix" = "/"; then
484 localstatedir="$prefix/var"
488 dnl Fix "sysconfdir" variable if it hasn't been specified...
489 if test "$sysconfdir" = "\${prefix}/etc"; then
490 if test "$prefix" = "/"; then
493 sysconfdir="$prefix/etc"
497 dnl Fix "libdir" variable for IRIX 6.x...
498 if test "$uname" = "IRIX" -a $uversion -ge 62; then
499 libdir="$exec_prefix/lib32"
502 dnl Fix "mandir" variable...
503 if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/"; then
505 FreeBSD* | NetBSD* | OpenBSD*)
507 mandir="/usr/share/man"
511 mandir="/usr/share/catman"
520 dnl Fix "fontpath" variable...
521 if test "x$fontpath" = "x"; then
522 fontpath="$datadir/cups/fonts"
525 dnl Setup manpage extensions...
527 FreeBSD* | NetBSD* | OpenBSD*)
551 dnl Setup init.d locations...
554 # FreeBSD and OpenBSD
566 # Linux seems to choose an init.d directory at random...
567 if test -d /sbin/init.d; then
569 INITDIR="/sbin/init.d"
572 if test -d /etc/rc.d; then
599 dnl Setup default locations...
600 CUPS_SERVERROOT='${sysconfdir}/cups'
601 CUPS_LOGDIR='${localstatedir}/log/cups'
602 CUPS_REQUESTS='${localstatedir}/spool/cups'
604 AC_DEFINE_UNQUOTED(CUPS_SERVERROOT, "$sysconfdir/cups")
605 AC_DEFINE_UNQUOTED(CUPS_LOGDIR, "$localstatedir/log/cups")
606 AC_DEFINE_UNQUOTED(CUPS_REQUESTS, "$localstatedir/spool/cups")
608 dnl See what directory to put server executables...
610 FreeBSD* | NetBSD* | OpenBSD*)
613 CUPS_SERVERBIN='${exec_prefix}/libexec/cups'
614 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/libexec/cups")
618 INSTALL_SYSV="install-sysv"
619 CUPS_SERVERBIN='${exec_prefix}/lib/cups'
620 AC_DEFINE_UNQUOTED(CUPS_SERVERBIN, "$exec_prefix/lib/cups")
624 AC_SUBST(INSTALL_SYSV)
625 AC_SUBST(CUPS_SERVERROOT)
626 AC_SUBST(CUPS_SERVERBIN)
627 AC_SUBST(CUPS_LOGDIR)
628 AC_SUBST(CUPS_REQUESTS)
630 dnl Set the CUPS_LOCALE directory...
632 Linux* | FreeBSD* | NetBSD* | OpenBSD*)
633 CUPS_LOCALEDIR='${datadir}/locale'
634 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$datadir/locale")
638 CUPS_LOCALEDIR='${exec_prefix}/lib/nls/msg'
639 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/nls/msg")
643 # This is the standard System V location...
644 CUPS_LOCALEDIR='${exec_prefix}/lib/locale'
645 AC_DEFINE_UNQUOTED(CUPS_LOCALEDIR, "$exec_prefix/lib/locale")
649 AC_SUBST(CUPS_LOCALEDIR)
651 dnl Set the CUPS_DATADIR directory...
652 CUPS_DATADIR='${datadir}/cups'
653 AC_DEFINE_UNQUOTED(CUPS_DATADIR, "$datadir/cups")
654 AC_SUBST(CUPS_DATADIR)
656 dnl Set the CUPS_DOCROOT directory...
657 CUPS_DOCROOT='${datadir}/doc/cups'
658 AC_DEFINE_UNQUOTED(CUPS_DOCROOT, "$datadir/doc/cups")
659 AC_SUBST(CUPS_DOCROOT)
661 dnl Set the CUPS_FONTPATH directory...
662 AC_DEFINE_UNQUOTED(CUPS_FONTPATH, "$fontpath")
664 AC_OUTPUT(Makedefs cups.sh)
667 dnl End of "$Id: configure.in,v 1.74 2001/02/07 01:25:38 mike Exp $".