Patrick Welche <prlw1@cam.ac.uk>
[netbsd-mini2440.git] / external / bsd / am-utils / dist / m4 / macros / os_cflags.m4
blobc57dec70db2f79af6397ebb9c2147719ada4a57a
1 dnl ######################################################################
2 dnl Specify additional compile options based on the OS and the compiler
3 AC_DEFUN([AMU_OS_CFLAGS],
5 AC_CACHE_CHECK(additional compiler flags,
6 ac_cv_os_cflags,
8 case "${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                 ;;
85 esac
87 AMU_CFLAGS="$AMU_CFLAGS $ac_cv_os_cflags"
88 # use same flags for configuring, so it matches what we do at compile time
89 CFLAGS="$CFLAGS $ac_cv_os_cflags"
90 export CFLAGS
92 dnl ======================================================================