]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1412] m4/os_cflags.m4 caches results that depend on $CC.
authorDave Hart <hart@ntp.org>
Sat, 12 Dec 2009 08:31:39 +0000 (08:31 +0000)
committerDave Hart <hart@ntp.org>
Sat, 12 Dec 2009 08:31:39 +0000 (08:31 +0000)
bk: 4b2354ebrEGgYcnVcQQZViyiWAu5Cg

ChangeLog
configure.ac
m4/os_cflags.m4

index 6d7fc017e4d7633757ef1d291c35d89b591dd7e8..55bece3f088beec7c111ca05aa94c86fabd605ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+---
+
+* [Bug 1412] m4/os_cflags.m4 caches results that depend on $CC.
+
 ---
 (4.2.6) 2009/12/09 Released by Harlan Stenn <stenn@ntp.org>
 * Include (4.2.4p8) - [Sec 1331] DoS with mode 7 packets - CVE-2009-3563.
index 636b195b44fd80f96c1ed540658b672785d2bc56..b4b64cd9215cdcd270b93f0a603c91851b7f541f 100644 (file)
@@ -83,17 +83,6 @@ esac
 
 # HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
 case "$host" in
- *-*-amigaos)
-    CFLAGS="$CFLAGS -Dfork=vfork -DSYS_AMIGA"
-    ;;
- *-*-hpux10.*) # at least for hppa2.0-hp-hpux10.20
-    case "$GCC" in
-     yes)
-       ;;
-     *) CFLAGS="$CFLAGS -Wp,-H18816"
-       ;;
-    esac
-    ;;
  *-pc-cygwin*)
     CFLAGS="$CFLAGS -DSYS_CYGWIN32"
     ;;
@@ -119,7 +108,7 @@ case "$host" in
     ;;
 esac
 
-AMU_OS_CFLAGS
+NTP_OS_CFLAGS
 NTP_DIR_SEP
 NTP_VPATH_HACK
 
@@ -274,22 +263,6 @@ case "$host" in
     ;;
 esac
 
-case "$build" in
- $host)
-    ;;
- *) case "$host" in
-     *-*-vxworks*)
-       # Quick and dirty sanity check
-       case "$VX_KERNEL" in
-        '') AC_MSG_ERROR(Please follow the directions in html/build/hints/vxworks.html!)
-           ;;
-       esac
-        CFLAGS="$CFLAGS -DSYS_VXWORKS"
-        ;;
-    esac
-    ;;
-esac
-
 dnl  we need to check for cross compile tools for vxWorks here
 AC_PROG_AWK
 AC_PROG_MAKE_SET
@@ -321,25 +294,6 @@ case "$GCC" in
     # if building with OpenSSL, -Wno-strict-prototypes is added later
 esac
 
-case "$host" in
- *-next-nextstep3)
-    CFLAGS="$CFLAGS -posix"
-    ;;
-dnl This is currently commented out by bor. 
-dnl The new versions of ReliantUNIX round adjtime() interval down
-dnl to 1/100s (system tick). This makes tickadj actually useless.
-dnl So, I'd better not use additional flags.
-dnl I leave it here just in case anybody has better idea
-dnl  mips-sni-sysv4* )
-dnl     #
-dnl     # Add flags for 64 bit file access to enable tickadj to access /dev/kmem
-dnl     #
-dnl     if getconf _LFS_CFLAGS > /dev/null 2>&1 ; then
-dnl       CFLAGS="$CFLAGS `getconf _LFS_CFLAGS`"
-dnl     fi
-dnl     ;;
-esac
-
 ac_busted_vpath_in_make=no
 
 case "$build" in
index c6d40cdd71509c242ca39f8ee666dc4fc4d61ee2..5e9ced12fd61e6523e00fe67cf0f98773ccc2863 100644 (file)
 dnl ######################################################################
 dnl Specify additional compile options based on the OS and the compiler
-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
+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]]*)
                ;;
-# 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]]* )
+            aix4.[[0-2]]*)
                # turn on additional headers
-               ac_cv_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
+               ntp_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
                ;;
-       aix5.3* )
+            aix5.3*)
                # avoid circular dependencies in yp headers, and more
-               ac_cv_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE -D_USE_IRS -D_MSGQSUPPORT"
+               ntp_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
+               ntp_os_cflags="${ntp_os_cflags} -D_USE_IRS -D_MSGQSUPPORT"
                ;;
-       aix* )
+            aix*)
                # avoid circular dependencies in yp headers
-               ac_cv_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE -D_USE_IRS"
+               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"
                ;;
-       OFF-sunos4* )
-               # make sure passing whole structures is handled in gcc
-               case "${CC}" in
-                       gcc )
-                               ac_cv_os_cflags="-fpcc-struct-return"
-                               ;;
+            hpux10.*)          # at least for hppa2.0-hp-hpux10.20
+               case "$GCC" in
+                yes)
+                   ;;
+                *)
+                   # use Ansi compiler on HPUX, and some -Wp magic
+                   ntp_os_cflags="-Ae -Wp,-H18816"
+                   ;;
                esac
                ;;
-       sunos[[34]]* | solaris1* | solaris2.[[0-5]] | sunos5.[[0-5]] | solaris2.5.* | sunos5.5.* )
-               ac_cv_os_cflags="" ;;
-       solaris2* | sunos5* )
-               # turn on 64-bit file offset interface
-               case "${CC}" in
-                       * )
-                               ac_cv_os_cflags="-D_LARGEFILE64_SOURCE"
-                               ;;
+            hpux*)
+               case "$GCC" in
+                yes)
+                   ;;
+                *)
+                   # use Ansi compiler on HPUX
+                   ntp_os_cflags="-Ae"
                esac
                ;;
-       hpux* )
-               # use Ansi compiler on HPUX
-               case "${CC}" in
-                       cc )
-                               ac_cv_os_cflags="-Ae"
-                               ;;
+            irix6*)
+               case "$CC" in
+                cc)
+                   # do not use 64-bit compiler
+                   ntp_os_cflags="-n32 -mips3 -Wl,-woff,84"
                esac
                ;;
-       darwin* | macosx* | rhapsody* )
-               ac_cv_os_cflags="-D_P1003_1B_VISIBLE"
+            nextstep3)
+               ntp_os_cflags="-posix"
+               ;;
+            solaris1*|solaris2.[[0-5]]|solaris2.5.*)
                ;;
-       * )
-               ac_cv_os_cflags=""
+            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)
+                   ;;
+                *)
+                   # 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
-])
-CFLAGS="$CFLAGS $ac_cv_os_cflags"
-])
+           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_flags_msg])
+       AS_UNSET([ntp_os_cflags_msg])
+    ]
+)
 dnl ======================================================================