summaryrefslogtreecommitdiff
path: root/m4/mpd_check_cflag.m4
blob: 421123355875bf3e6488a259be4f52301b848d20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
AC_DEFUN([MPD_CHECK_FLAG],[
  var=`echo "$1" | tr "=-" "__"`
  AC_CACHE_CHECK([whether the C compiler accepts $1],
    [mpd_check_cflag_$var],[
    save_CFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS $1"
    AC_COMPILE_IFELSE([
     int main(void) { return 0; }
     ], [ eval "mpd_check_cflag_$var=yes"
     ], [ eval "mpd_check_cflag_$var=no" ])
    CFLAGS="$save_CFLAGS"
  ])
  if eval "test x`echo '$mpd_check_cflag_'$var` = xyes"
  then
    MPD_CFLAGS="$MPD_CFLAGS $1"
  fi
  ])
])