Skip to content

Commit

Permalink
Fix #44: Invert logic for disabled autoconf check
Browse files Browse the repository at this point in the history
This patch not only fixes issue #44, it also refactores the --enable-xx
and --disable-yy logic by splitting the check and action into separate
blocks.  Slightly more readable.

Signed-off-by: Joachim Nilsson <[email protected]>
  • Loading branch information
troglobit committed Aug 19, 2016
1 parent 0a3d116 commit b954ebd
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,11 @@ AC_PROG_INSTALL
# The pidfile() code needs asprintf(), which relies on -D_GNU_SOURCE
AC_GNU_SOURCE

# Check if user even wants IPv6 support
AC_ARG_ENABLE([ipv6],[AS_HELP_STRING([--disable-ipv6],
[disable IPv6 support, default: enabled])
],[
[ac_enable_ipv6="$enableval"],
[ac_enable_ipv6="yes"]
])

# Check if user wants to have build number encoded in binary
AC_ARG_ENABLE([build-id],[AS_HELP_STRING([--enable-build-id@<:@=ID@:>@],
[enable build ID in 'smcroute -v', default: disabled])
],[
AS_IF([test "x$enableval" = "xyes" ], [build_id=`date +%y%m%d`], [build_id=$enableval])
AC_DEFINE_UNQUOTED([BUILD], "$build_id", [Build number, abbreviated date.])
])
# Check user options
AC_ARG_ENABLE([build-id],
AS_HELP_STRING([--enable-build-id@<:@=ID@:>@], [enable build ID in 'smcroute -v', default: disabled]))
AC_ARG_ENABLE([ipv6],
AS_HELP_STRING([--disable-ipv6], [disable IPv6 support, default: enabled]))

# Checks for header files.
AC_HEADER_STDC
Expand Down Expand Up @@ -64,8 +54,12 @@ AC_CHECK_SUN_LEN()
AC_CHECK_MROUTE()

# If IPv6 is enabled we must probe the system some more
if test "x$ac_enable_ipv6" = "xyes"; then
AC_CHECK_MROUTE6()
fi
AS_IF([test "x$enable_ipv6" != "xno"],
AC_CHECK_MROUTE6())

# Define BUILD in config.h, if enabled
AS_IF([test "x$enable_build_id" = "xyes" ], [build_id=`date +%y%m%d`], [build_id=$enable_build_id],
AS_IF([test "x$build_id" != "xno" ],
AC_DEFINE_UNQUOTED([BUILD], "$build_id", [Build number, abbreviated date.])))

AC_OUTPUT

0 comments on commit b954ebd

Please sign in to comment.