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