• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl ADD_COMPILER_FLAG:
2dnl   A macro to add a CFLAG to the EXTRA_CFLAGS variable. This macro will
3dnl   check to be sure the compiler supports the flag. Flags can be made
4dnl   mandatory (configure will fail).
5dnl $1: C compiler flag to add to EXTRA_CFLAGS.
6dnl $2: Set to "required" to cause configure failure if flag not supported.
7AC_DEFUN([ADD_COMPILER_FLAG],[
8    AX_CHECK_COMPILE_FLAG([$1],[
9        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
10        AC_SUBST([EXTRA_CFLAGS])],[
11        AS_IF([test x$2 != xrequired],[
12            AC_MSG_WARN([Optional CFLAG "$1" not supported by your compiler, continuing.])],[
13            AC_MSG_ERROR([Required CFLAG "$1" not supported by your compiler, aborting.])]
14        )],[
15        -Wall -Werror]
16    )]
17)
18dnl ADD_PREPROC_FLAG:
19dnl   Add the provided preprocessor flag to the EXTRA_CFLAGS variable. This
20dnl   macro will check to be sure the preprocessor supports the flag.
21dnl   The flag can be made mandatory by providing the string 'required' as
22dnl   the second parameter.
23dnl $1: Preprocessor flag to add to EXTRA_CFLAGS.
24dnl $2: Set to "required" t ocause configure failure if preprocesor flag
25dnl     is not supported.
26AC_DEFUN([ADD_PREPROC_FLAG],[
27    AX_CHECK_PREPROC_FLAG([$1],[
28        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
29        AC_SUBST([EXTRA_CFLAGS])],[
30        AS_IF([test x$2 != xrequired],[
31            AC_MSG_WARN([Optional preprocessor flag "$1" not supported by your compiler, continuing.])],[
32            AC_MSG_ERROR([Required preprocessor flag "$1" not supported by your compiler, aborting.])]
33        )],[
34        -Wall -Werror]
35    )]
36)
37dnl ADD_LINK_FLAG:
38dnl   A macro to add a LDLAG to the EXTRA_LDFLAGS variable. This macro will
39dnl   check to be sure the linker supports the flag. Flags can be made
40dnl   mandatory (configure will fail).
41dnl $1: linker flag to add to EXTRA_LDFLAGS.
42dnl $2: Set to "required" to cause configure failure if flag not supported.
43AC_DEFUN([ADD_LINK_FLAG],[
44    AX_CHECK_LINK_FLAG([$1],[
45        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $1"
46        AC_SUBST([EXTRA_LDFLAGS])],[
47        AS_IF([test x$2 != xrequired],[
48            AC_MSG_WARN([Optional LDFLAG "$1" not supported by your linker, continuing.])],[
49            AC_MSG_ERROR([Required LDFLAG "$1" not supported by your linker, aborting.])]
50        )]
51    )]
52)
53dnl ADD_FUZZING_FLAG:
54dnl   A macro to add a CFLAG to the EXTRA_CFLAGS variable.
55dnl $1: C++ linker flag to add to FUZZ_LDFLAGS.
56AC_DEFUN([ADD_FUZZING_FLAG],[
57    FUZZ_LDFLAGS="$FUZZ_LDFLAGS $1"
58    AC_SUBST([FUZZ_LDFLAGS])
59])
60