1dnl ######################################################################
2dnl Specify additional compile options based on the OS and the compiler
3dnl From Erez Zadok <ezk@cs.sunysb.edu>, http://www.am-utils.org
4AC_DEFUN([AMU_OS_CFLAGS],
5[
6AC_CACHE_CHECK(additional compiler flags,
7ac_cv_os_cflags,
8[
9case "${host_os}" in
10	irix6* )
11		case "${CC}" in
12			cc )
13				# do not use 64-bit compiler
14				ac_cv_os_cflags="-n32 -mips3 -Wl,-woff,84"
15				;;
16		esac
17		;;
18# HMS: am-utils needed this but we don't (apparently)
19#	osf[[1-3]]* )
20#		# get the right version of struct sockaddr
21#		case "${CC}" in
22#			cc )
23#				ac_cv_os_cflags="-std -D_SOCKADDR_LEN -D_NO_PROTO"
24#				;;
25#			* )
26#				ac_cv_os_cflags="-D_SOCKADDR_LEN -D_NO_PROTO"
27#				;;
28#		esac
29#		;;
30#	osf* )
31#		# get the right version of struct sockaddr
32#		case "${CC}" in
33#			cc )
34#				ac_cv_os_cflags="-std -D_SOCKADDR_LEN"
35#				;;
36#			* )
37#				ac_cv_os_cflags="-D_SOCKADDR_LEN"
38#				;;
39#		esac
40#		;;
41	aix[[1-3]]* )
42		ac_cv_os_cflags="" ;;
43	aix4.[[0-2]]* )
44		# turn on additional headers
45		ac_cv_os_cflags="-D_XOPEN_EXTENDED_SOURCE"
46		;;
47	aix* )
48		# avoid circular dependencies in yp headers
49		ac_cv_os_cflags="-DHAVE_BAD_HEADERS -D_XOPEN_EXTENDED_SOURCE"
50		;;
51	OFF-sunos4* )
52		# make sure passing whole structures is handled in gcc
53		case "${CC}" in
54			gcc )
55				ac_cv_os_cflags="-fpcc-struct-return"
56				;;
57		esac
58		;;
59	sunos[[34]]* | solaris1* | solaris2.[[0-5]]* | sunos5.[[0-5]]* )
60		ac_cv_os_cflags="" ;;
61	solaris* | sunos* )
62		# turn on 64-bit file offset interface
63		case "${CC}" in
64			* )
65				ac_cv_os_cflags="-D_LARGEFILE64_SOURCE"
66				;;
67		esac
68		;;
69	hpux* )
70		# use Ansi compiler on HPUX
71		case "${CC}" in
72			cc )
73				ac_cv_os_cflags="-Ae"
74				;;
75		esac
76		;;
77	darwin* | rhapsody* )
78		ac_cv_os_cflags="-D_P1003_1B_VISIBLE"
79		;;
80	* )
81		ac_cv_os_cflags=""
82		;;
83esac
84])
85CFLAGS="$CFLAGS $ac_cv_os_cflags"
86])
87dnl ======================================================================
88