summaryrefslogtreecommitdiff
path: root/m4/os_cflags.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/os_cflags.m4')
-rw-r--r--m4/os_cflags.m4168
1 files changed, 90 insertions, 78 deletions
diff --git a/m4/os_cflags.m4 b/m4/os_cflags.m4
index 35efa44b388d8..7fac93bd1e8c6 100644
--- a/m4/os_cflags.m4
+++ b/m4/os_cflags.m4
@@ -1,87 +1,99 @@
dnl ######################################################################
dnl Specify additional compile options based on the OS and the compiler
-dnl From Erez Zadok <ezk@cs.sunysb.edu>, http://www.am-utils.org
-AC_DEFUN([AMU_OS_CFLAGS],
-[
-AC_CACHE_CHECK(additional compiler flags,
-ac_cv_os_cflags,
-[
-case "${host_os}" in
- irix6* )
- case "${CC}" in
- cc )
- # do not use 64-bit compiler
- ac_cv_os_cflags="-n32 -mips3 -Wl,-woff,84"
- ;;
- esac
- ;;
-# HMS: am-utils needed this but we don't (apparently)
-# osf[[1-3]]* )
-# # get the right version of struct sockaddr
-# case "${CC}" in
-# cc )
-# ac_cv_os_cflags="-std -D_SOCKADDR_LEN -D_NO_PROTO"
-# ;;
-# * )
-# ac_cv_os_cflags="-D_SOCKADDR_LEN -D_NO_PROTO"
-# ;;
-# esac
-# ;;
-# osf* )
-# # get the right version of struct sockaddr
-# case "${CC}" in
-# cc )
-# ac_cv_os_cflags="-std -D_SOCKADDR_LEN"
-# ;;
-# * )
-# ac_cv_os_cflags="-D_SOCKADDR_LEN"
-# ;;
-# esac
-# ;;
- aix[[1-3]]* )
- ac_cv_os_cflags="" ;;
- aix4.[[0-2]]* )
- # turn on additional headers
- ac_cv_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
+AC_DEFUN([NTP_OS_CFLAGS], [
+ AC_MSG_CHECKING([additional compiler flags])
+ # allow ntp_os_flags to be preset to skip this stuff
+ case "${ntp_os_cflags+set}" in
+ set)
+ ;;
+ *)
+ ntp_os_cflags=""
+ case "$host_os" in
+ aix[[1-3]]*)
+ ;;
+ aix4.[[0-2]]*)
+ # turn on additional headers
+ ntp_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
+ ;;
+ aix5.3*)
+ # avoid circular dependencies in yp headers, and more
+ ntp_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
+ ntp_os_cflags="${ntp_os_cflags} -D_USE_IRS -D_MSGQSUPPORT"
+ ;;
+ aix*)
+ # avoid circular dependencies in yp headers
+ ntp_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
+ ntp_os_cflags="${ntp_os_cflags} -D_USE_IRS"
+ ;;
+ amigaos)
+ ntp_os_cflags="-DSYS_AMIGA"
+ ;;
+ darwin*|macosx*|rhapsody*)
+ ntp_os_cflags="-D_P1003_1B_VISIBLE"
+ ;;
+ hpux10.*) # at least for hppa2.0-hp-hpux10.20
+ case "$GCC" in
+ yes)
;;
- aix* )
- # avoid circular dependencies in yp headers
- ac_cv_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
+ *)
+ # use Ansi compiler on HPUX, and some -Wp magic
+ ntp_os_cflags="-Ae -Wp,-H18816"
;;
- OFF-sunos4* )
- # make sure passing whole structures is handled in gcc
- case "${CC}" in
- gcc )
- ac_cv_os_cflags="-fpcc-struct-return"
- ;;
- esac
- ;;
- sunos[[34]]* | solaris1* | solaris2.[[0-5]]* | sunos5.[[0-5]]* )
- ac_cv_os_cflags="" ;;
- solaris* | sunos* )
- # turn on 64-bit file offset interface
- case "${CC}" in
- * )
- ac_cv_os_cflags="-D_LARGEFILE64_SOURCE"
- ;;
- esac
+ esac
+ ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE"
+ ;;
+ hpux*)
+ case "$GCC" in
+ yes)
;;
- hpux* )
+ *)
# use Ansi compiler on HPUX
- case "${CC}" in
- cc )
- ac_cv_os_cflags="-Ae"
- ;;
- esac
- ;;
- darwin* | rhapsody* )
- ac_cv_os_cflags="-D_P1003_1B_VISIBLE"
- ;;
- * )
- ac_cv_os_cflags=""
+ ntp_os_cflags="-Ae"
+ esac
+ ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE"
+ ;;
+ irix6*)
+ case "$CC" in
+ cc)
+ # do not use 64-bit compiler
+ ntp_os_cflags="-n32 -mips3 -Wl,-woff,84"
+ esac
+ ;;
+ nextstep3)
+ ntp_os_cflags="-posix"
+ ;;
+ solaris1*|solaris2.[[0-5]]|solaris2.5.*)
+ ;;
+ sunos[[34]]*|sunos5.[[0-5]]|sunos5.5.*)
+ ;;
+ solaris2*|sunos5*)
+ # turn on 64-bit file offset interface
+ ntp_os_cflags="-D_LARGEFILE64_SOURCE"
+ ;;
+ vxworks*)
+ case "$build" in
+ $host)
;;
-esac
-])
-CFLAGS="$CFLAGS $ac_cv_os_cflags"
+ *)
+ # Quick and dirty sanity check
+ case "$VX_KERNEL" in
+ '')
+ AC_MSG_ERROR([See html/build/hints/vxworks.html])
+ esac
+ ntp_os_cflags="-DSYS_VXWORKS"
+ esac
+ ;;
+ esac
+ esac
+ case "$ntp_os_flags" in
+ '')
+ ntp_os_cflags_msg="none needed"
+ ;;
+ *)
+ ntp_os_cflags_msg="$ntp_os_cflags"
+ CFLAGS="$CFLAGS $ntp_os_cflags"
+ esac
+ AC_MSG_RESULT([$ntp_os_cflags_msg])
+ AS_UNSET([ntp_os_cflags_msg])
])
dnl ======================================================================