File muparser-fix-ac.diff of Package muparser

Unbreak `./configure CFLAGS=-ggdb3`.

N.B.: Do NOT set CFLAGS/CXXFLAGS/CPPFLAGS from project files at all,
these are reserved for the user. (Section 3.6 of automake.info).

`./configure && make CFLAGS=-ggdb3` still removes the project-provided flags.
And parallel building is still broken. I hate you, bakefile.

---
 build/autoconf/bakefile-presets.m4 |   13 +++++++++----
 build/autoconf/configure.ac        |   12 +++++++-----
 2 files changed, 16 insertions(+), 9 deletions(-)

Index: muparser-2.2.2/build/autoconf/bakefile-presets.m4
===================================================================
--- muparser-2.2.2.orig/build/autoconf/bakefile-presets.m4
+++ muparser-2.2.2/build/autoconf/bakefile-presets.m4
@@ -74,12 +74,17 @@ AC_DEFUN([AC_BAKEFILE_DEBUGOPT],
         dnl        and thus we must be careful to add it only to CXXFLAGS and not to CFLAGS
         dnl        (remember that CPPFLAGS is reserved for both C and C++ compilers while
         dnl         CFLAGS is intended as flags for C compiler only and CXXFLAGS for C++ only)
-        CXXFLAGS="$CXXFLAGS -g -O0 -Wall -Wundef -Wno-ctor-dtor-privacy"
-        CFLAGS="$CFLAGS -g -O0 -Wall -Wundef"
+        my_CXXFLAGS="$my_CXXFLAGS -g -O0 -Wall -Wundef -Wno-ctor-dtor-privacy"
+        my_CFLAGS="$my_CFLAGS -g -O0 -Wall -Wundef"
     else
-        CXXFLAGS="$CXXFLAGS -O2"
-        CFLAGS="$CFLAGS -O2"
+        my_CXXFLAGS="$my_CXXFLAGS -O2"
+        my_CFLAGS="$my_CFLAGS -O2"
     fi
+    # User-supplied CXXFLAGS must always take precedence.
+    # This still sucks because using `make CFLAGS=-foobar` kills
+    # the project-supplied flags again.
+    CXXFLAGS="$my_CXXFLAGS $CXXFLAGS"
+    CFLAGS="$my_CFLAGS $CFLAGS"
 ])
 
 dnl ---------------------------------------------------------------------------
Index: muparser-2.2.2/build/autoconf/configure.ac
===================================================================
--- muparser-2.2.2.orig/build/autoconf/configure.ac
+++ muparser-2.2.2/build/autoconf/configure.ac
@@ -25,11 +25,13 @@ dnl (and sets the AC_CANONICAL_BUILD, AC
 dnl AC_CANONICAL_TARGET variables)
 AC_CANONICAL_SYSTEM
 
-dnl we set these vars to avoid that the AC_PROG_C* macros add the "-g -O2" flags;
-dnl we will add them later, if needed
-CFLAGS=
-CXXFLAGS=
-CPPFLAGS=
+# We want to inhibit AC_PROG_C* macros adding the default "-g -O2" flags.
+# To do so, make sure that the variables are not unset - it is ok if they are
+# empty. However, their value MUST be retained, since one may have
+# called ./configure CFLAGS=-foobar.
+CFLAGS="$CFLAGS"
+CPPFLAGS="$CPPFLAGS"
+CXXFLAGS="$CXXFLAGS"
 
 dnl Checks for basic programs used to compile/install.
 AC_PROG_AWK
openSUSE Build Service is sponsored by