mirror of
git://git.code.sf.net/p/dhcpd-pools/code
synced 2025-12-15 23:36:59 +00:00
build-sys: omit mustach compilation when it cannot work
For example mac does not have open_memstream(3), and strndupa(3) can also be missing. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
b96f8cd8ad
commit
39b2811aa7
6 changed files with 31 additions and 4 deletions
10
configure.ac
10
configure.ac
|
|
@ -69,8 +69,18 @@ AC_TYPE_UINT32_T
|
|||
AC_FUNC_ERROR_AT_LINE
|
||||
AC_CHECK_FUNCS([\
|
||||
__fpending \
|
||||
open_memstream \
|
||||
posix_fadvise \
|
||||
])
|
||||
AC_CHECK_DECL([strndupa])
|
||||
|
||||
AS_IF([test "x$ac_cv_func_open_memstream" = "xyes" && test "x$ac_cv_have_decl_strndupa" == "xyes"], [
|
||||
build_mustach=yes
|
||||
AC_DEFINE([BUILD_MUSTACH], [1], [build mustach support])
|
||||
], [
|
||||
build_mustach=no
|
||||
])
|
||||
AM_CONDITIONAL([ENABLE_MUSTACH], [test "x$build_mustach" = xyes])
|
||||
|
||||
AC_MSG_CHECKING([if the compiler supports __builtin_expect])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||
|
|
|
|||
|
|
@ -13,9 +13,13 @@ dhcpd_pools_SOURCES = \
|
|||
src/dhcpd-pools.h \
|
||||
src/getdata.c \
|
||||
src/hash.c \
|
||||
src/mustach-dhcpd-pools.c \
|
||||
src/mustach.c \
|
||||
src/mustach.h \
|
||||
src/other.c \
|
||||
src/output.c \
|
||||
src/sort.c
|
||||
|
||||
if ENABLE_MUSTACH
|
||||
dhcpd_pools_SOURCES += \
|
||||
src/mustach-dhcpd-pools.c \
|
||||
src/mustach.c \
|
||||
src/mustach.h
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -127,7 +127,9 @@ int main(int argc, char **argv)
|
|||
{"reverse", no_argument, NULL, 'r'},
|
||||
{"output", required_argument, NULL, 'o'},
|
||||
{"limit", required_argument, NULL, 'L'},
|
||||
#ifdef BUILD_MUSTACH
|
||||
{"mustach", required_argument, NULL, OPT_MUSTACH},
|
||||
#endif
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"snet-alarms", no_argument, NULL, OPT_SNET_ALARMS},
|
||||
|
|
@ -227,10 +229,12 @@ int main(int argc, char **argv)
|
|||
config.header_limit = return_limit(optarg[0]);
|
||||
config.number_limit = return_limit(optarg[1]);
|
||||
break;
|
||||
#ifdef BUILD_MUSTACH
|
||||
case OPT_MUSTACH:
|
||||
config.mustach_template = optarg;
|
||||
output_format = 'm';
|
||||
break;
|
||||
#endif
|
||||
case OPT_COLOR:
|
||||
config.color_mode = parse_color_mode(optarg);
|
||||
if (config.color_mode == color_unknown)
|
||||
|
|
|
|||
|
|
@ -567,6 +567,9 @@ void __attribute__ ((__noreturn__)) usage(int status)
|
|||
fputs( " j for json\n", out);
|
||||
fputs( " J for json with active lease details\n", out);
|
||||
fputs( " c for comma separated values\n", out);
|
||||
#ifdef BUILD_MUSTACH
|
||||
fputs( " --mustach=tmpl output using mustach template file\n", out);
|
||||
#endif
|
||||
fputs( " -s, --sort=[nimcptTe] sort ranges by\n", out);
|
||||
fputs( " n name\n", out);
|
||||
fputs( " i IP\n", out);
|
||||
|
|
|
|||
|
|
@ -1267,9 +1267,11 @@ int output_analysis(const char c)
|
|||
case 'c':
|
||||
ret = output_csv();
|
||||
break;
|
||||
#ifdef BUILD_MUSTACH
|
||||
case 'm':
|
||||
ret = mustach_dhcpd_pools();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
error(EXIT_FAILURE, 0, "unknown output format: '%c'", c);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ TESTS = \
|
|||
tests/full-json \
|
||||
tests/full-xml \
|
||||
tests/leading0 \
|
||||
tests/mustach \
|
||||
tests/one-ip \
|
||||
tests/one-line \
|
||||
tests/range4 \
|
||||
|
|
@ -29,6 +28,11 @@ TESTS = \
|
|||
tests/v6 \
|
||||
tests/v6-perfdata
|
||||
|
||||
if ENABLE_MUSTACH
|
||||
TESTS += \
|
||||
tests/mustach
|
||||
endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
tests/confs \
|
||||
tests/expected \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue