summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-05-24 16:13:27 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-05-24 16:13:27 +0000
commit9435d975aba86246789106d739bbd558fdc9e28b (patch)
tree54244a932fc85eed27596056f5a1a7d5b8eea391
parent18af5065502f312901c1b0e17916637fc42d1fa1 (diff)
readd -ko, fix sed
Original commit message from CVS: readd -ko, fix sed
-rw-r--r--m4/as-scrub-include.m436
1 files changed, 36 insertions, 0 deletions
diff --git a/m4/as-scrub-include.m4 b/m4/as-scrub-include.m4
new file mode 100644
index 0000000..9e714c9
--- /dev/null
+++ b/m4/as-scrub-include.m4
@@ -0,0 +1,36 @@
+dnl as-scrub-include.m4 0.0.3
+
+dnl autostars m4 macro for scrubbing CFLAGS of system include dirs
+dnl because gcc 3.x complains about including system including dirs
+
+
+dnl Thomas Vander Stichele <thomas at apestaart dot org>
+
+dnl $Id: as-scrub-include.m4,v 1.6 2004/05/24 16:13:27 thomasvs Exp $
+
+dnl This macro uses output of cpp -v and expects it to contain text that
+dnl looks a little bit like this:
+dnl #include <...> search starts here:
+dnl /usr/local/include
+dnl /usr/lib/gcc-lib/i386-redhat-linux/3.2/include
+dnl /usr/include
+dnl End of search list.
+
+dnl AS_SCRUB_INCLUDE(VAR)
+dnl example
+dnl AS_SCRUB_INCLUDE(CFLAGS)
+dnl will remove all system include dirs from the given CFLAGS
+
+AC_DEFUN([AS_SCRUB_INCLUDE],
+[
+ GIVEN_CFLAGS=$[$1]
+ INCLUDE_DIRS=`echo | cpp -v 2>&1`
+
+ dnl remove everything from this output between the "starts here" and "End of"
+ dnl line
+ INCLUDE_DIRS=`echo $INCLUDE_DIRS | sed -e 's/.*<...> search starts here://' | sed -e 's/End of search list.*//'`
+ for dir in $INCLUDE_DIRS; do
+ GIVEN_CFLAGS=`echo $GIVEN_CFLAGS | sed -e 's#-I$dir ##'`
+ done
+ [$1]=$GIVEN_CFLAGS
+])