Debian Codegraph @

m4/arch.m4

raw
1 dnl
2 dnl arch.m4 --- autoconf input file for gawk
3 dnl
4 dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2004, 2015
5 dnl the Free Software Foundation, Inc.
6 dnl
7 dnl This file is part of GAWK, the GNU implementation of the
8 dnl AWK Progamming Language.
9 dnl
10 dnl GAWK is free software; you can redistribute it and/or modify
11 dnl it under the terms of the GNU General Public License as published by
12 dnl the Free Software Foundation; either version 3 of the License, or
13 dnl (at your option) any later version.
14 dnl
15 dnl GAWK is distributed in the hope that it will be useful,
16 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 dnl GNU General Public License for more details.
19 dnl
20 dnl You should have received a copy of the GNU General Public License
21 dnl along with this program; if not, write to the Free Software
22 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 dnl
24
25 dnl Check for z/OS Unix Systems Services
26 AC_DEFUN([AC_ZOS_USS], [
27 AC_MSG_CHECKING([for z/OS USS compilation])
28 AC_CACHE_VAL(ac_cv_zos_uss, [
29 if test "OS/390" = "`uname`"
30 then
31 ac_cv_zos_uss=yes
32 else
33 ac_cv_zos_uss=no
34 fi
35 ])dnl
36 AC_MSG_RESULT([${ac_cv_zos_uss}])
37 if test "x$ac_cv_zos_uss" = "xyes"
38 then
39 dnl Identify the compiler.
40 ac_zos_uss_cc_id=unknown
41 echo " $CC " | $EGREP [' (/bin/)?c89[ |_]'] >/dev/null && ac_zos_uss_cc_id=c89
42 echo " $CC " | $EGREP [' (/bin/)?c99[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc
43 echo " $CC " | $EGREP [' (/bin/)?cc[ |_]'] >/dev/null && ac_zos_uss_cc_id=cc
44 echo " $CC " | $EGREP [' (/bin/)?xlc[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc
45 echo " $CC " | $EGREP [' (/bin/)?xlC[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc++
46 echo " $CC " | $EGREP [' (/bin/)?xlc\+\+[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc++
47 test "x$GCC" = "xyes" && ac_zos_uss_cc_id=gcc
48 dnl These feature test macros are needed on z/OS.
49 CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_OPEN_SYS_UNLOCKED_EXT"
50 test "$ac_zos_uss_cc_id" != xlc++ && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
51 case "$ac_zos_uss_cc_id" in
52 c89)
53 dnl If the user has set CC=c89 and _C89_OPTIONS, then don't get in
54 dnl their way. c89 (as well as cc) pre-dates xlc, and accepts an
55 dnl option syntax that involves parentheses and cannot be handled
56 dnl in the usual way in C(PP)FLAGS. However, c89 will also accept
57 dnl options via the aforementioned environment variable, which
58 dnl gives the user one way around the problem. (If you're
59 dnl wondering about cc, it is meant for programs written in
60 dnl "Common Usage C" [a.k.a. K&R C] as opposed to "Standard C"
61 dnl [a.k.a. ANSI], and does not build gawk correctly.)
62 if test -n "$_C89_OPTIONS"
63 then
64 AC_MSG_NOTICE([CC = $CC])
65 AC_MSG_NOTICE([_C89_OPTIONS = $_C89_OPTIONS])
66 else
67 AC_MSG_ERROR([c89-setup-required
68 To build GNU Awk using "c89", please set
69
70 _C89_OPTIONS="-W c,langlvl(stdc99,libext),haltonmsg(CCN3296)"
71
72 in your environment, and reconfigure. (The above flags cannot be specified
73 in CFLAGS/CPPFLAGS, due to the parentheses.)])
74 fi
75 ;;
76 gcc)
77 dnl GCC has not yet been ported to z/OS as of this writing
78 ;;
79 cc)
80 AC_MSG_ERROR([cc-invalid
81 The z/OS "cc" compiler does not build GNU Awk correctly.
82
83 If the "xlc" or "c89" compiler is available, please set CC accordingly
84 and reconfigure. ("xlc" is the recommended compiler on z/OS.)])
85 ;;
86 xlc*)
87 dnl This enables C99, and on z/OS 1.11, the setenv() prototype.
88 CFLAGS="$CFLAGS -qlanglvl=stdc99:libext"
89 dnl Use a compiler wrapper script to address some annoyances.
90 cat >zos-cc <<EOF
91 #!/bin/sh
92 #
93 # This wrapper script addresses two annoying peculiarities of the IBM
94 # xlc/c99 compiler on z/OS:
95 #
96 # 1. Missing header files are considered warnings by default rather
97 # than fatal errors;
98 #
99 # 2. Include directories specified with -I are searched _after_ the
100 # system include directories (for #include<> directives) rather
101 # than before.
102 #
103 # This script allows the code and the build system to assume standard
104 # compiler behavior.
105 #
106
107 PS4='zos-cc: '
108 REAL_CC="$CC"
109
110 set -x
111 \$REAL_CC -qhaltonmsg=CCN3296 -qnosearch "\$[]@" -qsearch=/usr/include
112 EOF
113 chmod +x zos-cc
114 AC_MSG_NOTICE([wrapping $CC with zos-cc to obtain standard behavior])
115 CC="`pwd`/zos-cc"
116 ;;
117 *)
118 AC_MSG_WARN([unrecognized compiler environment])
119 ;;
120 esac
121 fi # ac_cv_zos_uss = yes
122 ])dnl