Initialize Tizen 2.3
[framework/multimedia/gst-plugins-base0.10.git] / common / m4 / as-scrub-include.m4
1 dnl as-scrub-include.m4 0.0.4
2
3 dnl autostars m4 macro for scrubbing CFLAGS of system include dirs
4 dnl because gcc 3.x complains about including system including dirs
5
6 dnl Thomas Vander Stichele <thomas at apestaart dot org>
7
8 dnl $Id: as-scrub-include.m4,v 1.7 2004/06/12 08:30:20 thomasvs Exp $
9
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
15 dnl  /usr/include
16 dnl End of search list.
17
18 dnl AS_SCRUB_INCLUDE(VAR)
19 dnl example
20 dnl AS_SCRUB_INCLUDE(CFLAGS)
21 dnl will remove all system include dirs from the given CFLAGS
22
23 AC_DEFUN([AS_SCRUB_INCLUDE],
24 [
25   GIVEN_CFLAGS=$[$1]
26   INCLUDE_DIRS=`echo | cpp -v 2>&1`
27
28   dnl remove everything from this output between the "starts here" and "End of"
29   dnl line
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 ##"`
34   done
35   [$1]=$GIVEN_CFLAGS
36 ])