1
dnl as-scrub-include.m4 0.0.4
3
dnl autostars m4 macro for scrubbing CFLAGS of system include dirs
4
dnl because gcc 3.x complains about including system including dirs
6
dnl Thomas Vander Stichele <thomas at apestaart dot org>
8
dnl $Id: as-scrub-include.m4,v 1.5 2004/06/12 08:19:09 thomasvs Exp $
10
dnl This macro uses output of cpp -v and expects it to contain text that
11
dnl looks a little bit like this:
12
dnl #include <...> search starts here:
13
dnl /usr/local/include
14
dnl /usr/lib/gcc-lib/i386-redhat-linux/3.2/include
16
dnl End of search list.
18
dnl AS_SCRUB_INCLUDE(VAR)
20
dnl AS_SCRUB_INCLUDE(CFLAGS)
21
dnl will remove all system include dirs from the given CFLAGS
23
AC_DEFUN([AS_SCRUB_INCLUDE],
26
INCLUDE_DIRS=`echo | cpp -v 2>&1`
28
dnl remove everything from this output between the "starts here" and "End of"
30
INCLUDE_DIRS=`echo $INCLUDE_DIRS | sed -e 's/.*<...> search starts here://' | sed -e 's/End of search list.*//'`
31
for dir in $INCLUDE_DIRS; do
32
dnl use "" as the sed script so $dir gets expanded
33
GIVEN_CFLAGS=`echo $GIVEN_CFLAGS | sed -e "s#-I$dir ##"`