Anlu Yan | 04f8d3f | 2017-02-22 09:18:11 -0800 | [diff] [blame] | 1 | AC_INIT(vpp_plugins, 1.0) |
Dave Barach | 2126b35 | 2016-02-10 08:42:59 -0500 | [diff] [blame] | 2 | LT_INIT |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 3 | AM_INIT_AUTOMAKE |
Dave Barach | dbacf85 | 2016-07-02 10:34:55 -0400 | [diff] [blame] | 4 | AM_SILENT_RULES([yes]) |
Damjan Marion | 905a7f5 | 2016-07-07 20:27:49 +0200 | [diff] [blame] | 5 | AC_PREFIX_DEFAULT([/usr]) |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 6 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 7 | AC_PROG_CC |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 8 | |
Damjan Marion | de02414 | 2018-04-25 00:56:08 +0200 | [diff] [blame] | 9 | # Check if compiler supports specific flag |
| 10 | AC_DEFUN([CC_CHECK_FLAG], |
| 11 | [ |
| 12 | AC_MSG_CHECKING([if $CC supports $1]) |
| 13 | AC_LANG_PUSH([C]) |
| 14 | ac_saved_cflags="$CFLAGS" |
| 15 | CFLAGS="-Werror $1" |
| 16 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], |
| 17 | [cc_flag_check=yes], |
| 18 | [cc_flag_check=no] |
| 19 | ) |
| 20 | AC_MSG_RESULT([$cc_flag_check]) |
| 21 | CFLAGS="$ac_saved_cflags" |
| 22 | AC_LANG_POP([C]) |
| 23 | ]) |
| 24 | |
Dave Barach | 6a5adc3 | 2018-07-04 10:56:23 -0400 | [diff] [blame] | 25 | AC_DEFUN([ENABLE_ARG], |
| 26 | [ |
| 27 | AC_ARG_ENABLE($1, |
| 28 | AC_HELP_STRING(patsubst([--enable-$1],[_],[-]), $2), |
| 29 | [enable_$1=yes n_enable_$1=1], |
| 30 | [enable_$1=no n_enable_$1=0]) |
| 31 | AM_CONDITIONAL(m4_toupper(ENABLE_$1), test "$enable_$1" = "yes") |
| 32 | m4_append([list_of_enabled], [$1], [, ]) |
| 33 | ]) |
| 34 | |
Damjan Marion | de02414 | 2018-04-25 00:56:08 +0200 | [diff] [blame] | 35 | CC_CHECK_FLAG("-Wno-address-of-packed-member") |
| 36 | AS_IF([test "$cc_flag_check" = yes], |
| 37 | [CFLAGS="${CFLAGS} -Wno-address-of-packed-member"], []) |
| 38 | |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 39 | AC_OUTPUT([Makefile]) |
Anlu Yan | 04f8d3f | 2017-02-22 09:18:11 -0800 | [diff] [blame] | 40 | |
| 41 | AC_CONFIG_MACRO_DIR([m4]) |