]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - config-scripts/cups-compiler.m4
Load cups into easysw/current.
[thirdparty/cups.git] / config-scripts / cups-compiler.m4
index 5619374f216eb8f6fa534463ec0e2e2eea66068f..1af623a1634e0aaed535f9b030d4c34195185253 100644 (file)
@@ -1,9 +1,9 @@
 dnl
-dnl "$Id: cups-compiler.m4 5566 2006-05-22 01:10:11Z mike $"
+dnl "$Id: cups-compiler.m4 6264 2007-02-11 17:11:15Z mike $"
 dnl
 dnl   Compiler stuff for the Common UNIX Printing System (CUPS).
 dnl
-dnl   Copyright 1997-2006 by Easy Software Products, all rights reserved.
+dnl   Copyright 1997-2007 by Easy Software Products, all rights reserved.
 dnl
 dnl   These coded instructions, statements, and computer programs are the
 dnl   property of Easy Software Products and are protected by Federal
@@ -24,57 +24,44 @@ dnl
 
 dnl Clear the debugging and non-shared library options unless the user asks
 dnl for them...
-ARCHFLAGS=""
 OPTIM=""
-AC_SUBST(ARCHFLAGS)
 AC_SUBST(OPTIM)
 
 AC_ARG_WITH(optim, [  --with-optim="flags"    set optimization flags ])
-AC_ARG_WITH(archflags, [  --with-arch="flags"     set default architecture flags ])
-
 AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging, default=no],
        [if test x$enable_debug = xyes; then
                OPTIM="-g"
        fi])
 
-dnl Setup support for separate 32/64-bit library generation...
-AC_ARG_ENABLE(32bit, [  --enable-32bit          generate 32-bit libraries on 32/64-bit systems, default=no])
-AC_ARG_WITH(arch32flags, [  --with-arch32="flags"   specifies 32-bit architecture flags])
+dnl Setup general architecture flags...
+AC_ARG_WITH(archflags, [  --with-archflags="flags"
+                          set default architecture flags ])
 
-ARCH32FLAGS=""
-INSTALL32=""
-LIB32CUPS=""
-LIB32CUPSIMAGE=""
-LIB32DIR=""
-UNINSTALL32=""
+if test -z "$with_archflags"; then
+       ARCHFLAGS=""
+else
+       ARCHFLAGS="$with_archflags"
+fi
 
-AC_SUBST(ARCH32FLAGS)
-AC_SUBST(INSTALL32)
-AC_SUBST(LIB32CUPS)
-AC_SUBST(LIB32CUPSIMAGE)
-AC_SUBST(LIB32DIR)
-AC_SUBST(UNINSTALL32)
+AC_SUBST(ARCHFLAGS)
 
-AC_ARG_ENABLE(64bit, [  --enable-64bit          generate 64-bit libraries on 32/64-bit systems, default=no])
-AC_ARG_WITH(arch64flags, [  --with-arch64="flags"   specifies 64-bit architecture flags])
+dnl Setup support for separate 32/64-bit library generation...
+AC_ARG_WITH(arch32flags, [  --with-arch32flags="flags"
+                          specifies 32-bit architecture flags])
+ARCH32FLAGS=""
+AC_SUBST(ARCH32FLAGS)
 
+AC_ARG_WITH(arch64flags, [  --with-arch64flags="flags"
+                          specifies 64-bit architecture flags])
 ARCH64FLAGS=""
-INSTALL64=""
-LIB64CUPS=""
-LIB64CUPSIMAGE=""
-LIB64DIR=""
-UNINSTALL64=""
-
 AC_SUBST(ARCH64FLAGS)
-AC_SUBST(INSTALL64)
-AC_SUBST(LIB64CUPS)
-AC_SUBST(LIB64CUPSIMAGE)
-AC_SUBST(LIB64DIR)
-AC_SUBST(UNINSTALL64)
 
-dnl Position-Independent Executable support on Linux and *BSD...
+dnl Position-Independent Executable support on Linux...
 AC_ARG_ENABLE(pie, [  --enable-pie            use GCC -fPIE option, default=no])
 
+dnl Read-only data/program support on Linux...
+AC_ARG_ENABLE(relro, [  --enable-relro          use GCC relro option, default=no])
+
 dnl Update compiler options...
 CXXLIBS=""
 AC_SUBST(CXXLIBS)
@@ -82,7 +69,11 @@ AC_SUBST(CXXLIBS)
 PIEFLAGS=""
 AC_SUBST(PIEFLAGS)
 
+RELROFLAGS=""
+AC_SUBST(RELROFLAGS)
+
 if test -n "$GCC"; then
+       # Add GCC-specific compiler options...
        if test -z "$OPTIM"; then
                if test "x$with_optim" = x; then
                        # Default to optimize-for-size and debug
@@ -101,6 +92,10 @@ if test -n "$GCC"; then
                        if test x$enable_pie = xyes; then
                                PIEFLAGS="-pie -fPIE"
                        fi
+
+                       if test x$enable_relro = xyes; then
+                               RELROFLAGS="-Wl,-z,relro"
+                       fi
                        ;;
 
                *)
@@ -118,14 +113,39 @@ if test -n "$GCC"; then
        fi
 
        case "$uname" in
-               Darwin*)
-                       if test -z "$with_archflags"; then
-                               if test "x`uname -m`" = xi386; then
-                                       # Build universal binaries for OSX on Intel...
-                                       ARCHFLAGS="-arch i386 -arch ppc"
+               HP-UX*)
+                       if test "x$enable_32bit" = xyes; then
+                               # Build 32-bit libraries, 64-bit base...
+                               if test -z "$with_arch32flags"; then
+                                       ARCH32FLAGS="-milp32"
+                               else
+                                       ARCH32FLAGS="$with_arch32flags"
+                               fi
+
+                               if test -z "$with_archflags"; then
+                                       if test -z "$with_arch64flags"; then
+                                               ARCHFLAGS="-mlp64"
+                                       else
+                                               ARCHFLAGS="$with_arch64flags"
+                                       fi
+                               fi
+                       fi
+
+                       if test "x$enable_64bit" = xyes; then
+                               # Build 64-bit libraries, 32-bit base...
+                               if test -z "$with_arch64flags"; then
+                                       ARCH64FLAGS="-mlp64"
+                               else
+                                       ARCH64FLAGS="$with_arch64flags"
+                               fi
+
+                               if test -z "$with_archflags"; then
+                                       if test -z "$with_arch32flags"; then
+                                               ARCHFLAGS="-milp32"
+                                       else
+                                               ARCHFLAGS="$with_arch32flags"
+                                       fi
                                fi
-                       else
-                               ARCHFLAGS="$with_archflags"
                        fi
                        ;;
 
@@ -137,11 +157,6 @@ if test -n "$GCC"; then
                                else
                                        ARCH32FLAGS="$with_arch32flags"
                                fi
-                               INSTALL32="install32bit"
-                               LIB32CUPS="32bit/libcups.so.2"
-                               LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
-                               LIB32DIR="$prefix/lib32"
-                               UNINSTALL32="uninstall32bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch64flags"; then
@@ -149,8 +164,6 @@ if test -n "$GCC"; then
                                        else
                                                ARCHFLAGS="$with_arch64flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
 
@@ -161,11 +174,6 @@ if test -n "$GCC"; then
                                else
                                        ARCH64FLAGS="$with_arch64flags"
                                fi
-                               INSTALL64="install64bit"
-                               LIB64CUPS="64bit/libcups.so.2"
-                               LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
-                               LIB64DIR="$prefix/lib64"
-                               UNINSTALL64="uninstall64bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch32flags"; then
@@ -173,8 +181,6 @@ if test -n "$GCC"; then
                                        else
                                                ARCHFLAGS="$with_arch32flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
                        ;;
@@ -187,14 +193,6 @@ if test -n "$GCC"; then
                                else
                                        ARCH32FLAGS="$with_arch32flags"
                                fi
-                               INSTALL32="install32bit"
-                               LIB32CUPS="32bit/libcups.so.2"
-                               LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
-                               LIB32DIR="$exec_prefix/lib"
-                               if test -d /usr/lib32; then
-                                       LIB32DIR="${LIB32DIR}32"
-                               fi
-                               UNINSTALL32="uninstall32bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch64flags"; then
@@ -202,8 +200,6 @@ if test -n "$GCC"; then
                                        else
                                                ARCHFLAGS="$with_arch64flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
 
@@ -214,14 +210,6 @@ if test -n "$GCC"; then
                                else
                                        ARCH64FLAGS="$with_arch64flags"
                                fi
-                               INSTALL64="install64bit"
-                               LIB64CUPS="64bit/libcups.so.2"
-                               LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
-                               LIB64DIR="$exec_prefix/lib"
-                               if test -d /usr/lib64; then
-                                       LIB64DIR="${LIB64DIR}64"
-                               fi
-                               UNINSTALL64="uninstall64bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch32flags"; then
@@ -229,8 +217,6 @@ if test -n "$GCC"; then
                                        else
                                                ARCHFLAGS="$with_arch32flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
                        ;;
@@ -243,11 +229,6 @@ if test -n "$GCC"; then
                                else
                                        ARCH32FLAGS="$with_arch32flags"
                                fi
-                               INSTALL32="install32bit"
-                               LIB32CUPS="32bit/libcups.so.2"
-                               LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
-                               LIB32DIR="$exec_prefix/lib/32"
-                               UNINSTALL32="uninstall32bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch64flags"; then
@@ -255,8 +236,6 @@ if test -n "$GCC"; then
                                        else
                                                ARCHFLAGS="$with_arch64flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
 
@@ -267,11 +246,6 @@ if test -n "$GCC"; then
                                else
                                        ARCH64FLAGS="$with_arch64flags"
                                fi
-                               INSTALL64="install64bit"
-                               LIB64CUPS="64bit/libcups.so.2"
-                               LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
-                               LIB64DIR="$exec_prefix/lib/64"
-                               UNINSTALL64="uninstall64bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch32flags"; then
@@ -279,13 +253,12 @@ if test -n "$GCC"; then
                                        else
                                                ARCHFLAGS="$with_arch32flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
                        ;;
        esac
 else
+       # Add vendor-specific compiler options...
        case $uname in
                AIX*)
                        if test -z "$OPTIM"; then
@@ -310,13 +283,6 @@ else
                        # Warning 829 is passing constant string as char *
                        CXXFLAGS="+W336,829 $CXXFLAGS"
 
-                       if test -z "$with_archflags"; then
-                               # Build portable binaries for all HP systems...
-                               ARCHFLAGS="+DAportable"
-                       else
-                               ARCHFLAGS="$with_archflags"
-                       fi
-
                        if test $PICFLAG = 1; then
                                OPTIM="+z $OPTIM"
                        fi
@@ -341,11 +307,6 @@ else
                                else
                                        ARCH32FLAGS="$with_arch32flags"
                                fi
-                               INSTALL32="install32bit"
-                               LIB32CUPS="32bit/libcups.so.2"
-                               LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
-                               LIB32DIR="$prefix/lib32"
-                               UNINSTALL32="uninstall32bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch64flags"; then
@@ -353,8 +314,6 @@ else
                                        else
                                                ARCHFLAGS="$with_arch64flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
 
@@ -365,11 +324,6 @@ else
                                else
                                        ARCH64FLAGS="$with_arch64flags"
                                fi
-                               INSTALL64="install64bit"
-                               LIB64CUPS="64bit/libcups.so.2"
-                               LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
-                               LIB64DIR="$prefix/lib64"
-                               UNINSTALL64="uninstall64bit"
 
                                if test -z "$with_archflags"; then
                                        if test -z "$with_arch32flags"; then
@@ -377,8 +331,16 @@ else
                                        else
                                                ARCHFLAGS="$with_arch32flags"
                                        fi
+                               fi
+                       fi
+                       ;;
+               OSF*)
+                       # Tru64 UNIX aka Digital UNIX aka OSF/1
+                       if test -z "$OPTIM"; then
+                               if test "x$with_optim" = x; then
+                                       OPTIM="-O"
                                else
-                                       ARCHFLAGS="$with_archflags"
+                                       OPTIM="$with_optim"
                                fi
                        fi
                        ;;
@@ -386,7 +348,7 @@ else
                        # Solaris
                        if test -z "$OPTIM"; then
                                if test "x$with_optim" = x; then
-                                       OPTIM="-xO4"
+                                       OPTIM="-xO2"
                                else
                                        OPTIM="$with_optim $OPTIM"
                                fi
@@ -400,11 +362,6 @@ else
                                # Compiling on a Solaris system, build 64-bit
                                # binaries with separate 32-bit libraries...
                                ARCH32FLAGS="-xarch=generic"
-                               INSTALL32="install32bit"
-                               LIB32CUPS="32bit/libcups.so.2"
-                               LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
-                               LIB32DIR="$exec_prefix/lib/32"
-                               UNINSTALL32="uninstall32bit"
 
                                if test "x$with_optim" = x; then
                                        # Suppress all of Sun's questionable
@@ -419,18 +376,11 @@ else
                                        else
                                                ARCHFLAGS="$with_arch64flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        else
                                if test "x$enable_64bit" = xyes; then
                                        # Build 64-bit libraries...
                                        ARCH64FLAGS="-xarch=generic64"
-                                       INSTALL64="install64bit"
-                                       LIB64CUPS="64bit/libcups.so.2"
-                                       LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
-                                       LIB64DIR="$exec_prefix/lib/64"
-                                       UNINSTALL64="uninstall64bit"
                                fi
 
                                if test "x$with_optim" = x; then
@@ -446,8 +396,6 @@ else
                                        else
                                                ARCHFLAGS="$with_arch32flags"
                                        fi
-                               else
-                                       ARCHFLAGS="$with_archflags"
                                fi
                        fi
                        ;;
@@ -477,16 +425,25 @@ else
        esac
 fi
 
-if test $uname = HP-UX; then
-       # HP-UX 10.20 (at least) needs this definition to get the
-       # h_errno global...
-       OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
-
-       # HP-UX 11.00 (at least) needs this definition to get the
-       # u_short type used by the IP headers...
-       OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
-fi
+# Add general compiler options per platform...
+case $uname in
+       HP-UX*)
+               # HP-UX 10.20 (at least) needs this definition to get the
+               # h_errno global...
+               OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
+
+               # HP-UX 11.00 (at least) needs this definition to get the
+               # u_short type used by the IP headers...
+               OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
+               ;;
+
+       OSF*)
+               # Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
+               # to be POSIX-compliant...
+               OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
+               ;;
+esac
 
 dnl
-dnl End of "$Id: cups-compiler.m4 5566 2006-05-22 01:10:11Z mike $".
+dnl End of "$Id: cups-compiler.m4 6264 2007-02-11 17:11:15Z mike $".
 dnl