1dnl ######################################################################
2dnl Specify additional compile options based on the OS and the compiler
3AC_DEFUN([NTP_OS_CFLAGS], [
4    AC_MSG_CHECKING([additional compiler flags])
5    # allow ntp_os_flags to be preset to skip this stuff
6    case "${ntp_os_cflags+set}" in
7     set)
8	;;
9     *)
10	ntp_os_cflags=""
11	case "$host_os" in
12	 aix[[1-3]]*)
13	    ;;
14	 aix4.[[0-2]]*)
15	    # turn on additional headers
16	    ntp_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
17	    ;;
18	 aix5.3*)
19	    # avoid circular dependencies in yp headers, and more
20	    ntp_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
21	    ntp_os_cflags="${ntp_os_cflags} -D_USE_IRS -D_MSGQSUPPORT"
22	    ;;
23	 aix*)
24	    # avoid circular dependencies in yp headers
25	    ntp_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
26	    ntp_os_cflags="${ntp_os_cflags} -D_USE_IRS"
27	    ;;
28	 amigaos)
29	    ntp_os_cflags="-DSYS_AMIGA"
30	    ;;
31	 darwin*|macosx*|rhapsody*)
32	    ntp_os_cflags="-D_P1003_1B_VISIBLE"
33	    ;;
34	 hpux10.*)		# at least for hppa2.0-hp-hpux10.20
35	    case "$GCC" in
36	     yes)
37		;;
38	     *)
39		# use Ansi compiler on HPUX, and some -Wp magic
40		ntp_os_cflags="-Ae -Wp,-H18816"
41		;;
42	    esac
43	    ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE"
44	    ;;
45	 hpux*)
46	    case "$GCC" in
47	     yes)
48		;;
49	     *)
50		# use Ansi compiler on HPUX
51		ntp_os_cflags="-Ae"
52	    esac
53	    ntp_os_cflags="${ntp_os_cflags} -D_HPUX_SOURCE"
54	    ;;
55	 irix6*)
56	    case "$CC" in
57	     cc)
58		# do not use 64-bit compiler
59		ntp_os_cflags="-n32 -mips3 -Wl,-woff,84"
60	    esac
61	    ;;
62	 nextstep3)
63	    ntp_os_cflags="-posix"
64	    ;;
65	 solaris1*|solaris2.[[0-5]]|solaris2.5.*)
66	    ;;
67	 sunos[[34]]*|sunos5.[[0-5]]|sunos5.5.*)
68	    ;;
69	 solaris2*|sunos5*)
70	    # turn on 64-bit file offset interface
71	    ntp_os_cflags="-D_LARGEFILE64_SOURCE"
72	    ;;
73	 vxworks*)
74	    case "$build" in
75	     $host)
76		;;
77	     *)
78		# Quick and dirty sanity check
79		case "$VX_KERNEL" in
80		 '')
81		    AC_MSG_ERROR([See html/build/hints/vxworks.html])
82		esac
83		ntp_os_cflags="-DSYS_VXWORKS"
84	    esac
85	    ;;
86	esac
87    esac
88    case "$ntp_os_flags" in
89     '')
90	ntp_os_cflags_msg="none needed"
91	;;
92     *)
93	ntp_os_cflags_msg="$ntp_os_cflags"
94	CFLAGS="$CFLAGS $ntp_os_cflags"
95    esac
96    AC_MSG_RESULT([$ntp_os_cflags_msg])
97    AS_UNSET([ntp_os_cflags_msg])
98])
99dnl ======================================================================
100