From 8c90be2a29053ac613dfe0c11a423da16c7c4520 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 13 Sep 2015 11:56:41 -0500 Subject: allow nc to build on linux and os x --- m4/check-libc.m4 | 6 +++++- m4/check-os-options.m4 | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'm4') diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index f1ba611..c189ac9 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 @@ -1,11 +1,15 @@ AC_DEFUN([CHECK_LIBC_COMPAT], [ +# Check for libc headers +AC_CHECK_HEADERS([err.h readpassphrase.h]) # Check for general libc functions -AC_CHECK_FUNCS([asprintf inet_pton memmem poll reallocarray]) +AC_CHECK_FUNCS([accept4 asprintf inet_pton memmem poll readpassphrase reallocarray]) AC_CHECK_FUNCS([strlcat strlcpy strndup strnlen strsep strtonum]) +AM_CONDITIONAL([HAVE_ACCEPT4], [test "x$ac_cv_func_accept4" = xyes]) AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) AM_CONDITIONAL([HAVE_INET_PTON], [test "x$ac_cv_func_inet_pton" = xyes]) AM_CONDITIONAL([HAVE_MEMMEM], [test "x$ac_cv_func_memmem" = xyes]) AM_CONDITIONAL([HAVE_POLL], [test "x$ac_cv_func_poll" = xyes]) +AM_CONDITIONAL([HAVE_READPASSPHRASE], [test "x$ac_cv_func_readpassphrase" = xyes]) AM_CONDITIONAL([HAVE_REALLOCARRAY], [test "x$ac_cv_func_reallocarray" = xyes]) AM_CONDITIONAL([HAVE_STRLCAT], [test "x$ac_cv_func_strlcat" = xyes]) AM_CONDITIONAL([HAVE_STRLCPY], [test "x$ac_cv_func_strlcpy" = xyes]) diff --git a/m4/check-os-options.m4 b/m4/check-os-options.m4 index 895d22b..9835cd8 100644 --- a/m4/check-os-options.m4 +++ b/m4/check-os-options.m4 @@ -15,8 +15,10 @@ case $host_os in HOST_OS=cygwin ;; *darwin*) + BUILD_NC=yes HOST_OS=darwin HOST_ABI=macosx + AC_SUBST([PROG_LDADD], ['-lresolv']) ;; *freebsd*) HOST_OS=freebsd @@ -34,15 +36,18 @@ case $host_os in AC_SUBST([PLATFORM_LDADD], ['-lpthread']) ;; *linux*) + BUILD_NC=yes HOST_OS=linux HOST_ABI=elf CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE" + AC_SUBST([PROG_LDADD], ['-lresolv']) ;; *netbsd*) HOST_OS=netbsd CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE" ;; *openbsd* | *bitrig*) + BUILD_NC=yes HOST_OS=openbsd HOST_ABI=elf AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded]) @@ -66,6 +71,7 @@ case $host_os in *) ;; esac +AM_CONDITIONAL([BUILD_NC], [test x$BUILD_NC = xyes]) AM_CONDITIONAL([HOST_AIX], [test x$HOST_OS = xaix]) AM_CONDITIONAL([HOST_CYGWIN], [test x$HOST_OS = xcygwin]) AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin]) -- cgit v1.2.3-55-g6feb