From 7ce50b2174ce6fa97ee91136495aa81b507a08b9 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Thu, 8 Dec 2016 19:14:33 +0100
Subject: [PATCH] [configure] Clean up CPPFLAGS after preprocessing flags tests

Otherwise, plug-ins compiled in internal mode that do some additional
C-related checks are not :dizzy_face:
---
 configure.in | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/configure.in b/configure.in
index 5b1ec3eca26..87317160f6d 100644
--- a/configure.in
+++ b/configure.in
@@ -533,8 +533,11 @@ AC_MSG_RESULT(Default preprocessor is '$FRAMAC_DEFAULT_CPP'.)
 
 DEFAULT_CPP_SUPPORTED_ARCH_OPTS=
 
+# Store original value of CPPFLAGS before doing tests
+OLD_CPPFLAGS=$CPPFLAGS
+
 rm -f conftest.i
-CPPFLAGS="-m32"
+CPPFLAGS="$OLD_CPPFLAGS -m32"
 AC_PREPROC_IFELSE(
   [AC_LANG_SOURCE([/* Check if preprocessor supports option -m32 */])],
   [if test -e conftest.i; then
@@ -542,7 +545,7 @@ AC_PREPROC_IFELSE(
   fi], [])
 
 rm -f conftest.i
-CPPFLAGS="-m64"
+CPPFLAGS="$OLD_CPPFLAGS -m64"
 AC_PREPROC_IFELSE(
   [AC_LANG_SOURCE([/* Check if preprocessor supports option -m64 */])],
   [if test -e conftest.i; then
@@ -550,13 +553,16 @@ AC_PREPROC_IFELSE(
   fi], [])
 
 rm -f conftest.i
-CPPFLAGS="-m16"
+CPPFLAGS="$OLD_CPPFLAGS -m16"
 AC_PREPROC_IFELSE(
   [AC_LANG_SOURCE([/* Check if preprocessor supports option -m16 */])],
   [if test -e conftest.i; then
     DEFAULT_CPP_SUPPORTED_ARCH_OPTS+='\"-m16\"; ';
   fi], [])
 
+# revert CPPFLAGS to original value
+CPPFLAGS=$OLD_CPPFLAGS
+
 AC_MSG_RESULT(Default preprocessor supported architecture-related options: $DEFAULT_CPP_SUPPORTED_ARCH_OPTS)
 
 
-- 
GitLab