]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - config-scripts/cups-common.m4
Add libcups component name, localization bundle support for iOS.
[thirdparty/cups.git] / config-scripts / cups-common.m4
index 9b8ac80aa03804f14880e0e033a9dc3c09645584..df1b1549a907e1f8a89b29898181a13e94325875 100644 (file)
@@ -1,30 +1,19 @@
 dnl
-dnl "$Id: cups-common.m4 8781 2009-08-28 17:34:54Z mike $"
+dnl Common configuration stuff for CUPS.
 dnl
-dnl   Common configuration stuff for CUPS.
+dnl Copyright © 2007-2018 by Apple Inc.
+dnl Copyright © 1997-2007 by Easy Software Products, all rights reserved.
 dnl
-dnl   Copyright 2007-2011 by Apple Inc.
-dnl   Copyright 1997-2007 by Easy Software Products, all rights reserved.
+dnl Licensed under Apache License v2.0.  See the file "LICENSE" for more
+dnl information.
 dnl
-dnl   These coded instructions, statements, and computer programs are the
-dnl   property of Apple Inc. and are protected by Federal copyright
-dnl   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
-dnl   which should have been included with this file.  If this file is
-dnl   file is missing or damaged, see the license at "http://www.cups.org/".
-dnl
-
-dnl We need at least autoconf 2.60...
-AC_PREREQ(2.60)
 
 dnl Set the name of the config header file...
 AC_CONFIG_HEADER(config.h)
 
 dnl Version number information...
-CUPS_VERSION="1.6svn"
+CUPS_VERSION="AC_PACKAGE_VERSION"
 CUPS_REVISION=""
-if test -z "$CUPS_REVISION" -a -d .svn; then
-       CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
-fi
 CUPS_BUILD="cups-$CUPS_VERSION"
 
 AC_ARG_WITH(cups_build, [  --with-cups-build       set "cups-config --build" string ],
@@ -33,8 +22,8 @@ AC_ARG_WITH(cups_build, [  --with-cups-build       set "cups-config --build" str
 AC_SUBST(CUPS_VERSION)
 AC_SUBST(CUPS_REVISION)
 AC_SUBST(CUPS_BUILD)
-AC_DEFINE_UNQUOTED(CUPS_SVERSION, "CUPS v$CUPS_VERSION$CUPS_REVISION")
-AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "CUPS/$CUPS_VERSION$CUPS_REVISION")
+AC_DEFINE_UNQUOTED(CUPS_SVERSION, "AC_PACKAGE_NAME v$CUPS_VERSION$CUPS_REVISION")
+AC_DEFINE_UNQUOTED(CUPS_MINIMAL, "AC_PACKAGE_NAME/$CUPS_VERSION$CUPS_REVISION")
 
 dnl Default compiler flags...
 CFLAGS="${CFLAGS:=}"
@@ -44,15 +33,16 @@ LDFLAGS="${LDFLAGS:=}"
 
 dnl Checks for programs...
 AC_PROG_AWK
-AC_PROG_CC
+AC_PROG_CC(clang cc gcc)
 AC_PROG_CPP
-AC_PROG_CXX
+AC_PROG_CXX(clang++ c++ g++)
 AC_PROG_RANLIB
 AC_PATH_PROG(AR,ar)
 AC_PATH_PROG(CHMOD,chmod)
-AC_PATH_PROG(HTMLDOC,htmldoc)
+AC_PATH_PROG(GZIP,gzip)
 AC_PATH_PROG(LD,ld)
 AC_PATH_PROG(LN,ln)
+AC_PATH_PROG(MKDIR,mkdir)
 AC_PATH_PROG(MV,mv)
 AC_PATH_PROG(RM,rm)
 AC_PATH_PROG(RMDIR,rmdir)
@@ -89,11 +79,12 @@ fi
 AC_SUBST(INSTALLSTATIC)
 
 dnl Check for pkg-config, which is used for some other tests later on...
-AC_PATH_PROG(PKGCONFIG, pkg-config)
+AC_PATH_TOOL(PKGCONFIG, pkg-config)
 
 dnl Check for libraries...
-AC_SEARCH_LIBS(fmod, m)
+AC_SEARCH_LIBS(abs, m, AC_DEFINE(HAVE_ABS))
 AC_SEARCH_LIBS(crypt, crypt)
+AC_SEARCH_LIBS(fmod, m)
 AC_SEARCH_LIBS(getspent, sec gen)
 
 LIBMALLOC=""
@@ -129,14 +120,13 @@ AC_CHECK_HEADER(crypt.h,AC_DEFINE(HAVE_CRYPT_H))
 AC_CHECK_HEADER(langinfo.h,AC_DEFINE(HAVE_LANGINFO_H))
 AC_CHECK_HEADER(malloc.h,AC_DEFINE(HAVE_MALLOC_H))
 AC_CHECK_HEADER(shadow.h,AC_DEFINE(HAVE_SHADOW_H))
+AC_CHECK_HEADER(stdint.h,AC_DEFINE(HAVE_STDINT_H))
 AC_CHECK_HEADER(string.h,AC_DEFINE(HAVE_STRING_H))
 AC_CHECK_HEADER(strings.h,AC_DEFINE(HAVE_STRINGS_H))
 AC_CHECK_HEADER(bstring.h,AC_DEFINE(HAVE_BSTRING_H))
-AC_CHECK_HEADER(usersec.h,AC_DEFINE(HAVE_USERSEC_H))
 AC_CHECK_HEADER(sys/ioctl.h,AC_DEFINE(HAVE_SYS_IOCTL_H))
 AC_CHECK_HEADER(sys/param.h,AC_DEFINE(HAVE_SYS_PARAM_H))
 AC_CHECK_HEADER(sys/ucred.h,AC_DEFINE(HAVE_SYS_UCRED_H))
-AC_CHECK_HEADER(scsi/sg.h,AC_DEFINE(HAVE_SCSI_SG_H))
 
 dnl Checks for iconv.h and iconv_open
 AC_CHECK_HEADER(iconv.h,
@@ -145,6 +135,9 @@ AC_CHECK_HEADER(iconv.h,
        AC_SEARCH_LIBS(iconv_open,iconv,
                AC_DEFINE(HAVE_ICONV_H)
                SAVELIBS="$SAVELIBS $LIBS")
+       AC_SEARCH_LIBS(libiconv_open,iconv,
+               AC_DEFINE(HAVE_ICONV_H)
+               SAVELIBS="$SAVELIBS $LIBS")
        LIBS="$SAVELIBS")
 
 dnl Checks for Mini-XML (www.minixml.org)...
@@ -166,7 +159,7 @@ AC_CHECK_FUNCS(statfs statvfs)
 
 dnl Checks for string functions.
 AC_CHECK_FUNCS(strdup strlcat strlcpy)
-if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
+if test "$host_os_name" = "hp-ux" -a "$host_os_version" = "1020"; then
        echo Forcing snprintf emulation for HP-UX.
 else
        AC_CHECK_FUNCS(snprintf vsnprintf)
@@ -185,8 +178,8 @@ dnl Check for vsyslog function.
 AC_CHECK_FUNCS(vsyslog)
 
 dnl Checks for signal functions.
-case "$uname" in
-       Linux | GNU)
+case "$host_os_name" in
+       linux* | gnu*)
                # Do not use sigset on Linux or GNU HURD
                ;;
        *)
@@ -200,6 +193,12 @@ AC_CHECK_FUNCS(sigaction)
 dnl Checks for wait functions.
 AC_CHECK_FUNCS(waitpid wait3)
 
+dnl Check for posix_spawn
+AC_CHECK_FUNCS(posix_spawn)
+
+dnl Check for getgrouplist
+AC_CHECK_FUNCS(getgrouplist)
+
 dnl See if the tm structure has the tm_gmtoff member...
 AC_MSG_CHECKING(for tm_gmtoff member in tm structure)
 AC_TRY_COMPILE([#include <time.h>],[struct tm t;
@@ -223,21 +222,27 @@ dnl See if we have libusb...
 AC_ARG_ENABLE(libusb, [  --enable-libusb         use libusb for USB printing])
 
 LIBUSB=""
+USBQUIRKS=""
 AC_SUBST(LIBUSB)
+AC_SUBST(USBQUIRKS)
 
 if test "x$PKGCONFIG" != x; then
-       if test x$enable_libusb = xyes -o $uname != Darwin; then
+       if test x$enable_libusb != xno -a $host_os_name != darwin; then
                AC_MSG_CHECKING(for libusb-1.0)
                if $PKGCONFIG --exists libusb-1.0; then
                        AC_MSG_RESULT(yes)
                        AC_DEFINE(HAVE_LIBUSB)
                        CFLAGS="$CFLAGS `$PKGCONFIG --cflags libusb-1.0`"
                        LIBUSB="`$PKGCONFIG --libs libusb-1.0`"
+                       USBQUIRKS="\$(DATADIR)/usb"
                else
                        AC_MSG_RESULT(no)
+                       if test x$enable_libusb = xyes; then
+                               AC_MSG_ERROR(libusb required for --enable-libusb.)
+                       fi
                fi
        fi
-elif x$enable_libusb = xyes; then
+elif test x$enable_libusb = xyes; then
        AC_MSG_ERROR(Need pkg-config to enable libusb support.)
 fi
 
@@ -255,17 +260,23 @@ if test x$enable_tcp_wrappers = xyes; then
 fi
 
 dnl ZLIB
+INSTALL_GZIP=""
 LIBZ=""
 AC_CHECK_HEADER(zlib.h,
     AC_CHECK_LIB(z, gzgets,
        AC_DEFINE(HAVE_LIBZ)
        LIBZ="-lz"
-       LIBS="$LIBS -lz"))
+       LIBS="$LIBS -lz"
+       AC_CHECK_LIB(z, inflateCopy, AC_DEFINE(HAVE_INFLATECOPY))
+       if test "x$GZIP" != z; then
+               INSTALL_GZIP="-z"
+       fi))
+AC_SUBST(INSTALL_GZIP)
 AC_SUBST(LIBZ)
 
 dnl Flags for "ar" command...
-case $uname in
-        Darwin* | *BSD*)
+case $host_os_name in
+        darwin* | *bsd*)
                 ARFLAGS="-rcv"
                 ;;
         *)
@@ -292,20 +303,15 @@ fi
 LIBS="$SAVELIBS"
 
 dnl Check for DBUS support
-if test -d /etc/dbus-1; then
-       DBUSDIR="/etc/dbus-1"
-else
-       DBUSDIR=""
-fi
-
-AC_ARG_ENABLE(dbus, [  --enable-dbus           build with DBUS support])
+AC_ARG_ENABLE(dbus, [  --disable-dbus          build without DBUS support])
 AC_ARG_WITH(dbusdir, [  --with-dbusdir          set DBUS configuration directory ],
        DBUSDIR="$withval")
 
+DBUSDIR=""
 DBUS_NOTIFIER=""
 DBUS_NOTIFIERLIBS=""
 
-if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x; then
+if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x -a "x$host_os_name" != xdarwin; then
        AC_MSG_CHECKING(for DBUS)
        if $PKGCONFIG --exists dbus-1; then
                AC_MSG_RESULT(yes)
@@ -318,7 +324,12 @@ if test "x$enable_dbus" != xno -a "x$PKGCONFIG" != x; then
                LIBS="$LIBS $DBUS_NOTIFIERLIBS"
                AC_CHECK_FUNC(dbus_message_iter_init_append,
                              AC_DEFINE(HAVE_DBUS_MESSAGE_ITER_INIT_APPEND))
+               AC_CHECK_FUNC(dbus_threads_init,
+                             AC_DEFINE(HAVE_DBUS_THREADS_INIT))
                LIBS="$SAVELIBS"
+               if test -d /etc/dbus-1; then
+                       DBUSDIR="/etc/dbus-1"
+               fi
        else
                AC_MSG_RESULT(no)
        fi
@@ -330,11 +341,12 @@ AC_SUBST(DBUS_NOTIFIERLIBS)
 
 dnl Extra platform-specific libraries...
 CUPS_DEFAULT_PRINTOPERATOR_AUTH="@SYSTEM"
+CUPS_DEFAULT_SYSTEM_AUTHKEY=""
 CUPS_SYSTEM_AUTHKEY=""
 INSTALLXPC=""
 
-case $uname in
-        Darwin*)
+case $host_os_name in
+        darwin*)
                 BACKLIBS="$BACKLIBS -framework IOKit"
                 SERVERLIBS="$SERVERLIBS -framework IOKit -weak_framework ApplicationServices"
                 LIBS="-framework SystemConfiguration -framework CoreFoundation -framework Security $LIBS"
@@ -344,7 +356,6 @@ case $uname in
                AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H))
                AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H))
                AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H))
-               AC_CHECK_HEADER(IOKit/pwr_mgt/IOPMLibPrivate.h,AC_DEFINE(HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H))
 
                dnl Check for dynamic store function...
                AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
@@ -354,9 +365,6 @@ case $uname in
                AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
                AC_CHECK_FUNCS(mbr_uid_to_uuid)
 
-                dnl Check for the vproc_transaction_begin/end stuff...
-               AC_CHECK_FUNCS(vproc_transaction_begin)
-
                dnl Need <dlfcn.h> header...
                AC_CHECK_HEADER(dlfcn.h,AC_DEFINE(HAVE_DLFCN_H))
 
@@ -377,27 +385,25 @@ case $uname in
 
                        if test "x$default_adminkey" != xdefault; then
                                CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey $default_adminkey"
-                       elif grep -q system.print.operator /etc/authorization; then
-                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
+                               CUPS_DEFAULT_SYSTEM_AUTHKEY="$default_adminkey"
                        else
-                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.preferences"
+                               CUPS_SYSTEM_AUTHKEY="SystemGroupAuthKey system.print.admin"
+                               CUPS_DEFAULT_SYSTEM_AUTHKEY="system.print.admin"
                        fi
 
                        if test "x$default_operkey" != xdefault; then
                                CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY($default_operkey) @admin @lpadmin"
-                       elif grep -q system.print.operator /etc/authorization; then
-                               CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
                        else
-                               CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.admin) @admin @lpadmin"
+                               CUPS_DEFAULT_PRINTOPERATOR_AUTH="@AUTHKEY(system.print.operator) @admin @lpadmin"
                        fi])
                AC_CHECK_HEADER(Security/SecBasePriv.h,AC_DEFINE(HAVE_SECBASEPRIV_H))
 
                dnl Check for sandbox/Seatbelt support
-               if test $uversion -ge 100; then
+               if test $host_os_version -ge 100; then
                        AC_CHECK_HEADER(sandbox.h,AC_DEFINE(HAVE_SANDBOX_H))
                fi
-               if test $uversion -ge 110; then
-                       # Broken public headers in 10.7...
+               if test $host_os_version -ge 110 -a $host_os_version -lt 120; then
+                       # Broken public headers in 10.7.x...
                        AC_MSG_CHECKING(for sandbox/private.h presence)
                        if test -f /usr/local/include/sandbox/private.h; then
                                AC_MSG_RESULT(yes)
@@ -411,11 +417,14 @@ case $uname in
                AC_CHECK_HEADER(xpc/xpc.h,
                        AC_DEFINE(HAVE_XPC)
                        INSTALLXPC="install-xpc")
+               AC_CHECK_HEADER(xpc/private.h,
+                       AC_DEFINE(HAVE_XPC_PRIVATE_H))
                 ;;
 esac
 
 AC_SUBST(CUPS_DEFAULT_PRINTOPERATOR_AUTH)
 AC_DEFINE_UNQUOTED(CUPS_DEFAULT_PRINTOPERATOR_AUTH, "$CUPS_DEFAULT_PRINTOPERATOR_AUTH")
+AC_DEFINE_UNQUOTED(CUPS_DEFAULT_SYSTEM_AUTHKEY, "$CUPS_DEFAULT_SYSTEM_AUTHKEY")
 AC_SUBST(CUPS_SYSTEM_AUTHKEY)
 AC_SUBST(INSTALLXPC)
 
@@ -424,16 +433,21 @@ COMPONENTS="all"
 
 AC_ARG_WITH(components, [  --with-components       set components to build:
                            - "all" (default) builds everything
-                           - "core" builds libcups and ipptool],
+                           - "core" builds libcups and ipptool
+                           - "libcups" builds just libcups],
        COMPONENTS="$withval")
 
 case "$COMPONENTS" in
        all)
-               BUILDDIRS="filter backend berkeley cgi-bin monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
+               BUILDDIRS="test filter backend berkeley cgi-bin monitor notifier ppdc scheduler systemv conf data desktop locale man doc examples templates"
                ;;
 
        core)
-               BUILDDIRS="data locale"
+               BUILDDIRS="test locale"
+               ;;
+
+       libcups)
+               BUILDDIRS="locale"
                ;;
 
        *)
@@ -442,7 +456,3 @@ case "$COMPONENTS" in
 esac
 
 AC_SUBST(BUILDDIRS)
-
-dnl
-dnl End of "$Id: cups-common.m4 8781 2009-08-28 17:34:54Z mike $".
-dnl