From bea7190070a6418c5ac33d326890dbc6429d8825 Mon Sep 17 00:00:00 2001
From: Mikko Koppanen <mkoppanen@php.net>
Date: Sun, 21 Nov 2010 20:34:40 +0000
Subject: [PATCH 1/4] Make sure that user can override flags if needed

Signed-off-by: Mikko Koppanen <mkoppanen@php.net>
---
 configure.in |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/configure.in b/configure.in
index 27f8bab..14d3255 100644
--- a/configure.in
+++ b/configure.in
@@ -58,15 +58,6 @@ AC_CHECK_LANG_SUN_STUDIO
 # Checks for libraries.
 AC_CHECK_LIB([pthread], [pthread_create])
 
-# Extra CFLAGS are appended at the end of CFLAGS for pgm.
-LIBZMQ_EXTRA_CFLAGS=""
-
-# Extra CXXFLAGS are appended at the end of CXXFLAGS for libzmq.
-LIBZMQ_EXTRA_CXXFLAGS=""
-
-# Extra LDFLAGS are appended at the end of LDFLAGS for libzmq.
-LIBZMQ_EXTRA_LDFLAGS=""
-
 # Set a helper variable to indicate GNU C and C++ are in use
 if test "x$GCC" = "xyes" -a "x$GXX" = "xyes"; then
     gnu_compilers="yes"
@@ -181,7 +172,7 @@ case "${host_os}" in
         ;;
     *hpux*)
         # Define on HP-UX to enable all library features
-        CPPFLAGS="-D_POSIX_C_SOURCE=200112L"
+        CPPFLAGS="-D_POSIX_C_SOURCE=200112L $CPPFLAGS"
         AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS])
         AC_CHECK_LIB(rt, sem_init)
         AC_CHECK_LIB(crypto, RAND_bytes)
@@ -210,7 +201,7 @@ case "${host_os}" in
         AC_DEFINE(ZMQ_HAVE_CYGWIN, 1, [Have Cygwin])
         # Cygwin provides libuuid as part of the e2fsprogs package, and somewhat
         # uselessly installs the library in /usr/lib/e2fsprogs
-        LDFLAGS="${LDFLAGS} -L/usr/lib/e2fsprogs"
+        LDFLAGS="-L/usr/lib/e2fsprogs ${LDFLAGS}"
         AC_CHECK_LIB(uuid, uuid_generate, ,
             [AC_MSG_ERROR([cannot link with -luuid, install the e2fsprogs package.])])
 
@@ -227,7 +218,7 @@ esac
 case "${host_cpu}" in
     *sparc*)
         if test "x$gnu_compilers" = "xyes"; then
-            CPPFLAGS="$CPPFLAGS -mcpu=v9"
+            CPPFLAGS="-mcpu=v9 $CPPFLAGS"
         fi
     ;;
     *)
@@ -299,7 +290,7 @@ if test "x$with_pgm_ext" != "xno"; then
     case "${host_os}" in
         *linux*|*mingw32*|*solaris*|*freebsd*|*darwin*)
             if test "x$gnu_compilers" = "xyes"; then
-                LIBZMQ_EXTRA_CXXFLAGS="${LIBZMQ_EXTRA_CXXFLAGS} -Wno-variadic-macros -Wno-long-long "
+                LIBZMQ_EXTRA_CXXFLAGS="-Wno-variadic-macros -Wno-long-long ${LIBZMQ_EXTRA_CXXFLAGS} "
             elif test "x$ac_cv_c_intel_compiler" = "xyes"; then
                 LIBZMQ_EXTRA_CFLAGS="-strict-ansi -Dasm=__asm__ "
             elif test "x$ac_cv_c_sun_studio_compiler" = "xyes"; then
@@ -335,11 +326,14 @@ if test "x$with_pgm_ext" != "xno"; then
     #  Success!
     AC_DEFINE(ZMQ_HAVE_OPENPGM, 1, [Have OpenPGM extension])
     pgm_ext="yes"
+
+    # these break OpenPGM so don't specify them if we are building with it.
+    pedantic="no"
+    werror="no"
 fi
 
 # -Wall, -Werror and -pedantic are GNU compiler specific.
-# Also, these break OpenPGM so don't specify them if we are building with it.
-if test "x$gnu_compilers" = "xyes" -a "x$pgm_ext" = "xno"; then
+if test "x$gnu_compilers" = "xyes"; then
     CPPFLAGS="-Wall $CPPFLAGS"
 
     if test "x$pedantic" = "xyes"; then
-- 
1.7.1

