1dnl ######################################################################
2dnl Specify additional compile options based on the OS and the compiler
3AC_DEFUN([AMU_OS_CFLAGS],
4[
5AC_CACHE_CHECK(additional compiler flags,
6ac_cv_os_cflags,
7[
8case "${host_os}" in
9	irix6* )
10		case "${CC}" in
11			cc )
12				# do not use 64-bit compiler
13				ac_cv_os_cflags="-n32 -mips3 -Wl,-woff,84"
14				;;
15		esac
16		;;
17	osf[[1-3]]* )
18		# get the right version of struct sockaddr
19		case "${CC}" in
20			cc )
21				ac_cv_os_cflags="-std -D_SOCKADDR_LEN -D_NO_PROTO"
22				;;
23			* )
24				ac_cv_os_cflags="-D_SOCKADDR_LEN -D_NO_PROTO"
25				;;
26		esac
27		;;
28	osf* )
29		# get the right version of struct sockaddr
30		case "${CC}" in
31			cc )
32				ac_cv_os_cflags="-std -D_SOCKADDR_LEN"
33				;;
34			* )
35				ac_cv_os_cflags="-D_SOCKADDR_LEN"
36				;;
37		esac
38		;;
39	aix[[1-3]]* )
40		ac_cv_os_cflags="" ;;
41	aix4.[[0-2]]* )
42		# turn on additional headers
43		ac_cv_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
44		;;
45	aix5.3* )
46		# avoid circular dependencies in yp headers, and more
47		ac_cv_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE -D_USE_IRS -D_MSGQSUPPORT"
48		;;
49	aix* )
50		# avoid circular dependencies in yp headers
51		ac_cv_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE -D_USE_IRS"
52		;;
53	OFF-sunos4* )
54		# make sure passing whole structures is handled in gcc
55		case "${CC}" in
56			gcc )
57				ac_cv_os_cflags="-fpcc-struct-return"
58				;;
59		esac
60		;;
61	sunos[[34]]* | solaris1* | solaris2.[[0-5]] | sunos5.[[0-5]] | solaris2.5.* | sunos5.5.* )
62		ac_cv_os_cflags="" ;;
63	solaris2* | sunos5* )
64		# turn on 64-bit file offset interface
65		case "${CC}" in
66			* )
67				ac_cv_os_cflags="-D_LARGEFILE64_SOURCE"
68				;;
69		esac
70		;;
71	hpux* )
72		# use Ansi compiler on HPUX
73		case "${CC}" in
74			cc )
75				ac_cv_os_cflags="-Ae"
76				;;
77		esac
78		;;
79	darwin* | macosx* | rhapsody* )
80		ac_cv_os_cflags="-D_P1003_1B_VISIBLE"
81		;;
82	* )
83		ac_cv_os_cflags=""
84		;;
85esac
86])
87AMU_CFLAGS="$AMU_CFLAGS $ac_cv_os_cflags"
88# use same flags for configuring, so it matches what we do at compile time
89CFLAGS="$CFLAGS $ac_cv_os_cflags"
90export CFLAGS
91])
92dnl ======================================================================
93