]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - config-scripts/cups-compiler.m4
Import changes from CUPS 1.4svn-r8704.
[thirdparty/cups.git] / config-scripts / cups-compiler.m4
index 4b1f83c8c8ec77b4a327cd121502387ce1f10e47..f3aa1b2401fc2ee258eaf6f14c0487e1c3c7562a 100644 (file)
@@ -1,9 +1,9 @@
 dnl
-dnl "$Id: cups-compiler.m4 6975 2007-09-18 20:37:09Z mike $"
+dnl "$Id: cups-compiler.m4 7871 2008-08-27 21:12:43Z mike $"
 dnl
 dnl   Compiler stuff for the Common UNIX Printing System (CUPS).
 dnl
-dnl   Copyright 2007-2008 by Apple Inc.
+dnl   Copyright 2007-2009 by Apple Inc.
 dnl   Copyright 1997-2007 by Easy Software Products, all rights reserved.
 dnl
 dnl   These coded instructions, statements, and computer programs are the
@@ -20,22 +20,43 @@ OPTIM=""
 AC_SUBST(INSTALL_STRIP)
 AC_SUBST(OPTIM)
 
-AC_ARG_WITH(optim, [  --with-optim="flags"    set optimization flags ])
-AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging, default=no])
+AC_ARG_WITH(optim, [  --with-optim            set optimization flags ])
+AC_ARG_ENABLE(debug, [  --enable-debug          build with debugging symbols])
+AC_ARG_ENABLE(debug_guards, [  --enable-debug-guards   build with memory allocation guards])
+AC_ARG_ENABLE(debug_printfs, [  --enable-debug-printfs  build with CUPS_DEBUG_LOG support])
+AC_ARG_ENABLE(unit_tests, [  --enable-unit-tests     build and run unit tests])
 
 dnl For debugging, keep symbols, otherwise strip them...
 if test x$enable_debug = xyes; then
        OPTIM="-g"
-       CFLAGS="$CFLAGS -DDEBUG"
 else
        INSTALL_STRIP="-s"
 fi
 
+dnl Debug printfs can slow things down, so provide a separate option for that
+if test x$enable_debug_printfs = xyes; then
+       CFLAGS="$CFLAGS -DDEBUG"
+       CXXFLAGS="$CXXFLAGS -DDEBUG"
+fi
+
+dnl Debug guards use an extra 4 bytes for some structures like strings in the
+dnl string pool, so provide a separate option for that
+if test x$enable_debug_guards = xyes; then
+       CFLAGS="$CFLAGS -DDEBUG_GUARDS"
+       CXXFLAGS="$CXXFLAGS -DDEBUG_GUARDS"
+fi
+
+dnl Unit tests take up time during a compile...
+if test x$enable_unit_tests = xyes; then
+       UNITTESTS="unittests"
+else
+       UNITTESTS=""
+fi
+AC_SUBST(UNITTESTS)
+
 dnl Setup general architecture flags...
-AC_ARG_WITH(archflags, [  --with-archflags="flags"
-                          set default architecture flags ])
-AC_ARG_WITH(ldarchflags, [  --with-ldarchflags="flags"
-                          set default program architecture flags ])
+AC_ARG_WITH(archflags, [  --with-archflags        set default architecture flags ])
+AC_ARG_WITH(ldarchflags, [  --with-ldarchflags      set program architecture flags ])
 
 if test -z "$with_archflags"; then
        ARCHFLAGS=""
@@ -58,18 +79,16 @@ AC_SUBST(ARCHFLAGS)
 AC_SUBST(LDARCHFLAGS)
 
 dnl Setup support for separate 32/64-bit library generation...
-AC_ARG_WITH(arch32flags, [  --with-arch32flags="flags"
-                          specifies 32-bit architecture flags])
+AC_ARG_WITH(arch32flags, [  --with-arch32flags      set 32-bit architecture flags])
 ARCH32FLAGS=""
 AC_SUBST(ARCH32FLAGS)
 
-AC_ARG_WITH(arch64flags, [  --with-arch64flags="flags"
-                          specifies 64-bit architecture flags])
+AC_ARG_WITH(arch64flags, [  --with-arch64flags      set 64-bit architecture flags])
 ARCH64FLAGS=""
 AC_SUBST(ARCH64FLAGS)
 
 dnl Read-only data/program support on Linux...
-AC_ARG_ENABLE(relro, [  --enable-relro          use GCC relro option, default=no])
+AC_ARG_ENABLE(relro, [  --enable-relro          build with the GCC relro option])
 
 dnl Update compiler options...
 CXXLIBS="${CXXLIBS:=}"
@@ -82,7 +101,7 @@ RELROFLAGS=""
 AC_SUBST(RELROFLAGS)
 
 LIBCUPSORDER="libcups.order"
-AC_ARG_WITH(libcupsorder, [  --with-libcupsorder     libcups secorder file, default=libcups.order],
+AC_ARG_WITH(libcupsorder, [  --with-libcupsorder     set libcups secorder file, default=libcups.order],
        if test -f "$withval"; then
                LIBCUPSORDER="$withval"
        fi)
@@ -90,12 +109,15 @@ AC_SUBST(LIBCUPSORDER)
 
 LIBCUPSIMAGEORDER="libcupsimage.order"
 AC_ARG_WITH(libcupsimageorder, [  --with-libcupsimagesorder
-                          libcupsimage secorder file, default=libcupsimage.order],
+                          set libcupsimage secorder file, default=libcupsimage.order],
        if test -f "$withval"; then
                LIBCUPSIMAGEORDER="$withval"
        fi)
 AC_SUBST(LIBCUPSIMAGEORDER)
 
+PHPOPTIONS=""
+AC_SUBST(PHPOPTIONS)
+
 if test -n "$GCC"; then
        # Add GCC-specific compiler options...
        if test -z "$OPTIM"; then
@@ -118,7 +140,7 @@ if test -n "$GCC"; then
        AC_MSG_CHECKING(if GCC supports -fstack-protector)
        OLDCFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS -fstack-protector"
-       AC_TRY_COMPILE(,,
+       AC_TRY_LINK(,,
                OPTIM="$OPTIM -fstack-protector"
                AC_MSG_RESULT(yes),
                AC_MSG_RESULT(no))
@@ -142,6 +164,8 @@ if test -n "$GCC"; then
                # Additional warning options for development testing...
                if test -d .svn; then
                        OPTIM="-Wshadow -Wunused $OPTIM"
+                       CFLAGS="-Werror-implicit-function-declaration $CFLAGS"
+                       PHPOPTIONS="-Wno-shadow"
                fi
        fi
 
@@ -525,6 +549,12 @@ case $uname in
                OPTIM="$OPTIM -D_HPUX_SOURCE"
                ;;
 
+       Linux*)
+               # glibc 2.8 and higher breaks peer credentials unless you
+               # define _GNU_SOURCE...
+               OPTIM="$OPTIM -D_GNU_SOURCE"
+               ;;
+
        OSF*)
                # Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
                # to be POSIX-compliant...
@@ -533,5 +563,5 @@ case $uname in
 esac
 
 dnl
-dnl End of "$Id: cups-compiler.m4 6975 2007-09-18 20:37:09Z mike $".
+dnl End of "$Id: cups-compiler.m4 7871 2008-08-27 21:12:43Z mike $".
 dnl