add things to minimize diffs with OpenNTPD-portable

This commit is contained in:
Brent Cook 2016-02-15 13:39:06 -06:00
parent 9df51efab0
commit d4d040c171
2 changed files with 17 additions and 19 deletions

View File

@ -46,9 +46,12 @@ AM_CONDITIONAL([HAVE_B64_NTOP], [test "x$ac_cv_func_b64_ntop_arg" = xyes])
AC_DEFUN([CHECK_CRYPTO_COMPAT], [ AC_DEFUN([CHECK_CRYPTO_COMPAT], [
# Check crypto-related libc functions and syscalls # Check crypto-related libc functions and syscalls
AC_CHECK_FUNCS([arc4random_buf explicit_bzero getauxval getentropy]) AC_CHECK_FUNCS([arc4random arc4random_buf arc4random_uniform])
AC_CHECK_FUNCS([explicit_bzero getauxval getentropy])
AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp]) AC_CHECK_FUNCS([timingsafe_bcmp timingsafe_memcmp])
AM_CONDITIONAL([HAVE_ARC4RANDOM], [test "x$ac_cv_func_arc4random" = xyes])
AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes]) AM_CONDITIONAL([HAVE_ARC4RANDOM_BUF], [test "x$ac_cv_func_arc4random_buf" = xyes])
AM_CONDITIONAL([HAVE_ARC4RANDOM_UNIFORM], [test "x$ac_cv_func_arc4random_uniform" = xyes])
AM_CONDITIONAL([HAVE_EXPLICIT_BZERO], [test "x$ac_cv_func_explicit_bzero" = xyes]) AM_CONDITIONAL([HAVE_EXPLICIT_BZERO], [test "x$ac_cv_func_explicit_bzero" = xyes])
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = xyes]) AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = xyes])
AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes]) AM_CONDITIONAL([HAVE_TIMINGSAFE_BCMP], [test "x$ac_cv_func_timingsafe_bcmp" = xyes])

View File

@ -1,10 +1,10 @@
AC_DEFUN([CHECK_OS_OPTIONS], [ AC_DEFUN([CHECK_OS_OPTIONS], [
CFLAGS="$CFLAGS -Wall -std=gnu99 -fno-strict-aliasing" CFLAGS="$CFLAGS -Wall -std=gnu99 -fno-strict-aliasing"
BUILD_NC=yes
case $host_os in case $host_os in
*aix*) *aix*)
BUILD_NC=yes
HOST_OS=aix HOST_OS=aix
if test "`echo $CC | cut -d ' ' -f 1`" != "gcc" ; then if test "`echo $CC | cut -d ' ' -f 1`" != "gcc" ; then
CFLAGS="-qnoansialias $USER_CFLAGS" CFLAGS="-qnoansialias $USER_CFLAGS"
@ -12,24 +12,22 @@ case $host_os in
AC_SUBST([PLATFORM_LDADD], ['-lperfstat -lpthread']) AC_SUBST([PLATFORM_LDADD], ['-lperfstat -lpthread'])
;; ;;
*cygwin*) *cygwin*)
BUILD_NC=yes
HOST_OS=cygwin HOST_OS=cygwin
;; ;;
*darwin*) *darwin*)
BUILD_NC=yes
# weak seed on failure to open /dev/random, based on latest public source
# http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c
USE_BUILTIN_ARC4RANDOM=yes
HOST_OS=darwin HOST_OS=darwin
HOST_ABI=macosx HOST_ABI=macosx
# weak seed on failure to open /dev/random, based on latest
# public source:
# http://www.opensource.apple.com/source/Libc/Libc-997.90.3/gen/FreeBSD/arc4random.c
USE_BUILTIN_ARC4RANDOM=yes
;; ;;
*freebsd*) *freebsd*)
BUILD_NC=yes
# fork detection missing, weak seed on failure
# https://svnweb.freebsd.org/base/head/lib/libc/gen/arc4random.c?revision=268642&view=markup
USE_BUILTIN_ARC4RANDOM=yes
HOST_OS=freebsd HOST_OS=freebsd
HOST_ABI=elf HOST_ABI=elf
# fork detection missing, weak seed on failure
# https://svnweb.freebsd.org/base/head/lib/libc/gen/arc4random.c?revision=268642&view=markup
USE_BUILTIN_ARC4RANDOM=yes
AC_SUBST([PROG_LDADD], ['-lthr']) AC_SUBST([PROG_LDADD], ['-lthr'])
;; ;;
*hpux*) *hpux*)
@ -43,14 +41,14 @@ case $host_os in
AC_SUBST([PLATFORM_LDADD], ['-lpthread']) AC_SUBST([PLATFORM_LDADD], ['-lpthread'])
;; ;;
*linux*) *linux*)
BUILD_NC=yes
HOST_OS=linux HOST_OS=linux
HOST_ABI=elf HOST_ABI=elf
CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE" CPPFLAGS="$CPPFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE"
;; ;;
*netbsd*) *netbsd*)
BUILD_NC=yes HOST_OS=netbsd
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ HOST_ABI=elf
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/param.h> #include <sys/param.h>
#if __NetBSD_Version__ < 700000001 #if __NetBSD_Version__ < 700000001
undefined undefined
@ -58,19 +56,17 @@ case $host_os in
]], [[]])], ]], [[]])],
[ USE_BUILTIN_ARC4RANDOM=no ], [ USE_BUILTIN_ARC4RANDOM=no ],
[ USE_BUILTIN_ARC4RANDOM=yes ] [ USE_BUILTIN_ARC4RANDOM=yes ]
) )
HOST_OS=netbsd
CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE" CPPFLAGS="$CPPFLAGS -D_OPENBSD_SOURCE"
;; ;;
*openbsd* | *bitrig*) *openbsd* | *bitrig*)
BUILD_NC=yes
HOST_OS=openbsd HOST_OS=openbsd
HOST_ABI=elf HOST_ABI=elf
AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded]) AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded])
;; ;;
*mingw*) *mingw*)
HOST_OS=win HOST_OS=win
BUILD_NC=no
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D__USE_MINGW_ANSI_STDIO" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D__USE_MINGW_ANSI_STDIO"
CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS" CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS"
CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501" CPPFLAGS="$CPPFLAGS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0501"
@ -80,7 +76,6 @@ case $host_os in
AC_SUBST([PLATFORM_LDADD], ['-lws2_32']) AC_SUBST([PLATFORM_LDADD], ['-lws2_32'])
;; ;;
*solaris*) *solaris*)
BUILD_NC=yes
HOST_OS=solaris HOST_OS=solaris
HOST_ABI=elf HOST_ABI=elf
CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 -DBSD_COMP" CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 -DBSD_COMP"