File: flags.m4

package info (click to toggle)
miredo 1.2.3-1.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 3,356 kB
  • sloc: sh: 10,934; ansic: 7,773; makefile: 296; sed: 16
file content (64 lines) | stat: -rw-r--r-- 1,633 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Copyright © 2006 Rémi Denis-Courmont
# <remi (at) remlab (dot) net>.
# This file (flags.m4) is free software; unlimited permission to
# copy and/or distribute it, with or without modifications, as long
# as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.

AC_DEFUN([RDC_PROG_CC_FLAGS_IFELSE],
[AC_LANG_ASSERT(C)
  CFLAGS_save="${CFLAGS}"
  as_ac_var=`echo "ac_cv_prog_cc_flags_$1" | $as_tr_sh`
  AC_CACHE_CHECK([if $CC accepts $1], [$as_ac_var], [
    CFLAGS="${CFLAGS} $1"
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [
      eval "$as_ac_var=yes"
    ],[
      eval "$as_ac_var=no"
    ])
  ])

  ac_res=`eval echo '${'$as_ac_var'}'`
  AS_IF([test "${ac_res}" != "no"], [
    CFLAGS="${CFLAGS_save} $1"
    CXXFLAGS="${CXXFLAGS} $1"
    OBJCFLAGS="${OBJCFLAGS} $1"
    $2
  ], [
    CFLAGS="${CFLAGS_save}"
    $3
  ])
])

AC_DEFUN([RDC_PROG_CC_WFLAGS],
[ for a in $1; do
    RDC_PROG_CC_FLAGS_IFELSE([-W$a])
  done
])

AC_DEFUN([RDC_PROG_LINK_FLAGS_IFELSE],
[AC_LANG_ASSERT(C)
  LDFLAGS_save="${LDFLAGS}"
  as_ac_var=`echo "ac_cv_prog_link_flags_$1" | $as_tr_sh`
  AC_CACHE_CHECK([if $LINK accepts $1], [$as_ac_var], [
    LDFLAGS="${LDFLAGS} $1"
    AC_LINK_IFELSE([AC_LANG_PROGRAM()], [
      eval "$as_ac_var=yes"
    ],[
      eval "$as_ac_var=no"
    ])
  ])

  ac_res=`eval echo '${'$as_ac_var'}'`
  AS_IF([test "${ac_res}" != "no"], [
    LDFLAGS="${LDFLAGS} $1"
    $2
  ], [
    LDFLAGS="${LDFLAGS_save}"
    $3
  ])
])