Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 1 | dnl AX_ADD_COMPILER_FLAG: |
| 2 | dnl A macro to add a CFLAG to the EXTRA_CFLAGS variable. This macro will |
dantpm | 4db13b0 | 2018-04-06 14:30:28 -0700 | [diff] [blame] | 3 | dnl check to be sure the compiler supports the flag. Flags can be made |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 4 | dnl mandatory (configure will fail). |
| 5 | dnl $1: C compiler flag to add to EXTRA_CFLAGS. |
dantpm | 4db13b0 | 2018-04-06 14:30:28 -0700 | [diff] [blame] | 6 | dnl $2: Set to "required" to cause configure failure if flag not supported. |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 7 | AC_DEFUN([AX_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.])] |
Philip Tricca | c3a8fdc | 2017-09-21 21:01:42 -0700 | [diff] [blame] | 14 | )],[ |
| 15 | -Wall -Werror] |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 16 | )] |
| 17 | ) |
| 18 | dnl AX_ADD_PREPROC_FLAG: |
| 19 | dnl Add the provided preprocessor flag to the EXTRA_CFLAGS variable. This |
| 20 | dnl macro will check to be sure the preprocessor supports the flag. |
dantpm | 4db13b0 | 2018-04-06 14:30:28 -0700 | [diff] [blame] | 21 | dnl The flag can be made mandatory by providing the string 'required' as |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 22 | dnl the second parameter. |
| 23 | dnl $1: Preprocessor flag to add to EXTRA_CFLAGS. |
| 24 | dnl $2: Set to "required" t ocause configure failure if preprocesor flag |
| 25 | dnl is not supported. |
| 26 | AC_DEFUN([AX_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.])] |
Philip Tricca | 198e897 | 2017-09-26 10:47:04 -0700 | [diff] [blame] | 33 | )],[ |
| 34 | -Wall -Werror] |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 35 | )] |
| 36 | ) |
| 37 | dnl AX_ADD_LINK_FLAG: |
| 38 | dnl A macro to add a LDLAG to the EXTRA_LDFLAGS variable. This macro will |
dantpm | 4db13b0 | 2018-04-06 14:30:28 -0700 | [diff] [blame] | 39 | dnl check to be sure the linker supports the flag. Flags can be made |
Philip Tricca | 2744781 | 2017-03-08 14:29:49 -0800 | [diff] [blame] | 40 | dnl mandatory (configure will fail). |
| 41 | dnl $1: linker flag to add to EXTRA_LDFLAGS. |
| 42 | dnl $2: Set to "required" to cause configure failure if flag not supported. |
| 43 | AC_DEFUN([AX_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 | ) |