AC_PREREQ([2.69]) AC_INIT([net-tools], [0.0.1], []) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIRS([m4]) AM_INIT_AUTOMAKE([foreign -Wall subdir-objects]) # Compiler: prefer clang AC_PROG_CC if test "x$GCC" = "xyes" && test "x$CC" = "xgcc"; then AC_CHECK_PROG([CLANG], [clang], [clang]) if test -n "$CLANG"; then CC="clang" AC_MSG_NOTICE([Using clang]) fi fi AM_PROG_AR LT_PREREQ([2.2]) LT_INIT # Strict flags — always enabled, not optional STRICT_CFLAGS="-Wall -Wextra -Werror -Wpedantic -Wconversion -Wshadow" AC_SUBST([STRICT_CFLAGS]) # libcli: Autotools submodule — configure automatically AC_CONFIG_SUBDIRS([libcli]) # --enable-tests AC_ARG_ENABLE([tests], [AS_HELP_STRING([--enable-tests], [Build Criterion unit tests (default: no)])], [enable_tests=$enableval], [enable_tests=no]) AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" = "xyes"]) AS_IF([test "x$enable_tests" = "xyes"], [ PKG_CHECK_MODULES([CRITERION], [criterion], [], [ AC_MSG_NOTICE([pkg-config could not find criterion -- trying manual detection]) AC_CHECK_HEADER([criterion/criterion.h], [], [ AC_MSG_ERROR([criterion/criterion.h not found])]) AC_CHECK_LIB([criterion], [main], [CRITERION_LIBS="-lcriterion"], [AC_MSG_ERROR([libcriterion not found])]) ]) ]) # --enable-debug AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Enable debug build: -g -O0 (default: no)])], [enable_debug=$enableval], [enable_debug=no]) AM_CONDITIONAL([ENABLE_DEBUG], [test "x$enable_debug" = "xyes"]) # --enable-sanitizers AC_ARG_ENABLE([sanitizers], [AS_HELP_STRING([--enable-sanitizers], [Enable AddressSanitizer and UndefinedBehaviorSanitizer (default: no)])], [enable_sanitizers=$enableval], [enable_sanitizers=no]) AM_CONDITIONAL([ENABLE_SANITIZERS], [test "x$enable_sanitizers" = "xyes"]) AC_CONFIG_FILES([ Makefile src/Makefile src/ping/Makefile src/traceroute/Makefile tests/Makefile ]) AC_OUTPUT AC_MSG_NOTICE([ net-tools $VERSION ------------------ CC : $CC CFLAGS : $STRICT_CFLAGS tests : $enable_tests debug : $enable_debug sanitizers : $enable_sanitizers ])