Add config option to use dlmalloc instead of mheap
[vpp.git] / src / examples / sample-plugin / configure.ac
1 AC_INIT(vpp_plugins, 1.0)
2 LT_INIT
3 AM_INIT_AUTOMAKE
4 AM_SILENT_RULES([yes])
5 AC_PREFIX_DEFAULT([/usr])
6
7 AC_PROG_CC
8
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
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
35 ENABLE_ARG(dlmalloc,    [Enable dlmalloc])
36 AC_SUBST(DLMALLOC,              [-DUSE_DLMALLOC=${n_enable_dlmalloc}])
37
38 CC_CHECK_FLAG("-Wno-address-of-packed-member")
39 AS_IF([test "$cc_flag_check" = yes],
40         [CFLAGS="${CFLAGS} -Wno-address-of-packed-member"], [])
41
42 AC_OUTPUT([Makefile])
43
44 AC_CONFIG_MACRO_DIR([m4])