1275970Scydnl ######################################################################
2275970Scydnl Specify additional compile options based on the OS and the compiler
3275970ScyAC_DEFUN([NTP_OS_CFLAGS], [
4275970Scy    AC_MSG_CHECKING([additional compiler flags])
5289764Sglebius    # allow ntp_os_cflags to be preset to skip this stuff
6275970Scy    case "${ntp_os_cflags+set}" in
7275970Scy     set)
8275970Scy	;;
9275970Scy     *)
10275970Scy	ntp_os_cflags=
11275970Scy	case "$host_os" in
12275970Scy	 aix[[1-3]]*)
13275970Scy	    ;;
14275970Scy	 aix4.[[0-2]]*)
15275970Scy	    # turn on additional headers
16275970Scy	    ntp_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
17275970Scy	    ;;
18275970Scy	 aix5.3*)
19275970Scy	    # avoid circular dependencies in yp headers, and more
20275970Scy	    ntp_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
21275970Scy	    ntp_os_cflags="${ntp_os_cflags} -D_USE_IRS -D_MSGQSUPPORT"
22275970Scy	    ;;
23275970Scy	 aix*)
24275970Scy	    # XXX Only verified thru AIX6.
25275970Scy	    # aix7 seems to need a different XOPEN_SOURCE_EXTENDED thing.
26275970Scy	    # avoid circular dependencies in yp headers
27275970Scy	    # _XOPEN_SOURCE=500 = X/Open 5: POSIX 1995
28275970Scy	    # _XOPEN_SOURCE=600 = X/Open 6: POSIX 2004
29275970Scy	    # _XOPEN_SOURCE=700 = X/Open 7: POSIX 2008
30275970Scy	    ntp_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_SOURCE=600"
31275970Scy	    ntp_os_cflags="${ntp_os_cflags} -D_USE_IRS"
32275970Scy	    ;;
33275970Scy	 amigaos)
34275970Scy	    ntp_os_cflags="-DSYS_AMIGA"
35275970Scy	    ;;
36275970Scy	 darwin*|macosx*|rhapsody*)
37275970Scy	    ntp_os_cflags="-D_P1003_1B_VISIBLE"
38275970Scy	    ;;
39275970Scy	 hpux10.*)		# at least for hppa2.0-hp-hpux10.20
40275970Scy	    case "$GCC" in
41275970Scy	     yes)
42275970Scy		;;
43275970Scy	     *)
44275970Scy		# use Ansi compiler on HPUX, and some -Wp magic
45275970Scy		ntp_os_cflags="-Ae -Wp,-H18816"
46275970Scy		;;
47275970Scy	    esac
48285169Scy	    ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE -D__STDC_VERSION__=199901L"
49275970Scy	    ;;
50275970Scy	 hpux*)
51275970Scy	    case "$GCC" in
52275970Scy	     yes)
53275970Scy		;;
54275970Scy	     *)
55275970Scy		# use Ansi compiler on HPUX
56275970Scy		ntp_os_cflags="-Ae"
57275970Scy	    esac
58285169Scy	    ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE -D__STDC_VERSION__=199901L"
59275970Scy	    ;;
60275970Scy	 irix6*)
61275970Scy	    case "$CC" in
62275970Scy	     cc)
63275970Scy		# do not use 64-bit compiler
64275970Scy		ntp_os_cflags="-n32 -mips3 -Wl,-woff,84"
65275970Scy	    esac
66275970Scy	    ;;
67275970Scy	 nextstep3)
68275970Scy	    ntp_os_cflags="-posix"
69275970Scy	    ;;
70275970Scy	 solaris1*|solaris2.[[0-5]]|solaris2.5.*)
71275970Scy	    ;;
72275970Scy	 sunos[[34]]*|sunos5.[[0-5]]|sunos5.5.*)
73275970Scy	    ;;
74275970Scy	 solaris2*|sunos5*)
75275970Scy	    # turn on 64-bit file offset interface
76275970Scy	    ntp_os_cflags="-D_LARGEFILE64_SOURCE"
77275970Scy	    ;;
78275970Scy	 vxworks*)
79275970Scy	    case "$build" in
80275970Scy	     $host)
81275970Scy		;;
82275970Scy	     *)
83275970Scy		# Quick and dirty sanity check
84275970Scy		case "$VX_KERNEL" in
85275970Scy		 '')
86275970Scy		    AC_MSG_ERROR([See html/build/hints/vxworks.html])
87275970Scy		esac
88275970Scy		ntp_os_cflags="-DSYS_VXWORKS"
89275970Scy	    esac
90275970Scy	    ;;
91275970Scy	esac
92275970Scy    esac
93289764Sglebius    case "$ntp_os_cflags" in
94275970Scy     '')
95275970Scy	ntp_os_cflags_msg="none needed"
96275970Scy	;;
97275970Scy     *)
98275970Scy	ntp_os_cflags_msg="$ntp_os_cflags"
99275970Scy    esac
100275970Scy    CFLAGS_NTP="$CFLAGS_NTP $ntp_os_cflags"
101275970Scy    AC_MSG_RESULT([$ntp_os_cflags_msg])
102275970Scy    AS_UNSET([ntp_os_cflags_msg])
103289764Sglebius    ###
104289764Sglebius    AC_MSG_CHECKING([additional linker flags])
105289764Sglebius    # HMS: The following might still need tweaking
106289764Sglebius    # allow ntp_os_ldflags to be preset to skip this stuff
107289764Sglebius    case "${ntp_os_ldflags+set}" in
108289764Sglebius     set)
109289764Sglebius	;;
110289764Sglebius     *)
111289764Sglebius	ntp_os_ldflags=
112289764Sglebius	case "$host_os" in
113289764Sglebius	 hpux*)
114289764Sglebius	    case "$GCC" in
115289764Sglebius	     yes)
116289764Sglebius		ntp_os_ldflags="-Wl,+allowdups"
117289764Sglebius		;;
118289764Sglebius	    esac
119289764Sglebius	    ;;
120289764Sglebius	esac
121289764Sglebius	;;
122289764Sglebius    esac
123289764Sglebius    case "$ntp_os_ldflags" in
124289764Sglebius     '')
125289764Sglebius	ntp_os_ldflags_msg="none needed"
126289764Sglebius	;;
127289764Sglebius     *)
128289764Sglebius	ntp_os_ldflags_msg="$ntp_os_ldflags"
129289764Sglebius    esac
130289764Sglebius    LDFLAGS_NTP="$LDFLAGS_NTP $ntp_os_ldflags"
131289764Sglebius    AC_MSG_RESULT([$ntp_os_ldflags_msg])
132289764Sglebius    AS_UNSET([ntp_os_ldflags_msg])
133275970Scy])
134275970Scydnl ======================================================================
135