Blame m4/arch.m4

Packit Service f629e6
dnl
Packit Service f629e6
dnl arch.m4 --- autoconf input file for gawk
Packit Service f629e6
dnl
Packit Service f629e6
dnl Copyright (C) 1995, 1996, 1998, 1999, 2000, 2003, 2004, 2015
Packit Service f629e6
dnl the Free Software Foundation, Inc.
Packit Service f629e6
dnl
Packit Service f629e6
dnl This file is part of GAWK, the GNU implementation of the
Packit Service f629e6
dnl AWK Progamming Language.
Packit Service f629e6
dnl
Packit Service f629e6
dnl GAWK is free software; you can redistribute it and/or modify
Packit Service f629e6
dnl it under the terms of the GNU General Public License as published by
Packit Service f629e6
dnl the Free Software Foundation; either version 3 of the License, or
Packit Service f629e6
dnl (at your option) any later version.
Packit Service f629e6
dnl
Packit Service f629e6
dnl GAWK is distributed in the hope that it will be useful,
Packit Service f629e6
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service f629e6
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service f629e6
dnl GNU General Public License for more details.
Packit Service f629e6
dnl
Packit Service f629e6
dnl You should have received a copy of the GNU General Public License
Packit Service f629e6
dnl along with this program; if not, write to the Free Software
Packit Service f629e6
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
Packit Service f629e6
dnl
Packit Service f629e6
Packit Service f629e6
dnl Check for z/OS Unix Systems Services
Packit Service f629e6
AC_DEFUN([AC_ZOS_USS], [
Packit Service f629e6
AC_MSG_CHECKING([for z/OS USS compilation])
Packit Service f629e6
AC_CACHE_VAL(ac_cv_zos_uss, [
Packit Service f629e6
if test "OS/390" = "`uname`"
Packit Service f629e6
then
Packit Service f629e6
  ac_cv_zos_uss=yes
Packit Service f629e6
else
Packit Service f629e6
  ac_cv_zos_uss=no
Packit Service f629e6
fi
Packit Service f629e6
])dnl
Packit Service f629e6
AC_MSG_RESULT([${ac_cv_zos_uss}])
Packit Service f629e6
if test "x$ac_cv_zos_uss" = "xyes"
Packit Service f629e6
then
Packit Service f629e6
  dnl Identify the compiler.
Packit Service f629e6
  ac_zos_uss_cc_id=unknown
Packit Service f629e6
  echo " $CC " | $EGREP [' (/bin/)?c89[ |_]'] >/dev/null && ac_zos_uss_cc_id=c89
Packit Service f629e6
  echo " $CC " | $EGREP [' (/bin/)?c99[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc
Packit Service f629e6
  echo " $CC " | $EGREP [' (/bin/)?cc[ |_]']  >/dev/null && ac_zos_uss_cc_id=cc
Packit Service f629e6
  echo " $CC " | $EGREP [' (/bin/)?xlc[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc
Packit Service f629e6
  echo " $CC " | $EGREP [' (/bin/)?xlC[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc++
Packit Service f629e6
  echo " $CC " | $EGREP [' (/bin/)?xlc\+\+[ |_]'] >/dev/null && ac_zos_uss_cc_id=xlc++
Packit Service f629e6
  test "x$GCC" = "xyes" && ac_zos_uss_cc_id=gcc
Packit Service f629e6
  dnl These feature test macros are needed on z/OS.
Packit Service f629e6
  CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE -D_OPEN_SYS_UNLOCKED_EXT"
Packit Service f629e6
  test "$ac_zos_uss_cc_id" != xlc++ && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=600"
Packit Service f629e6
  case "$ac_zos_uss_cc_id" in
Packit Service f629e6
  c89)
Packit Service f629e6
    dnl If the user has set CC=c89 and _C89_OPTIONS, then don't get in
Packit Service f629e6
    dnl their way.  c89 (as well as cc) pre-dates xlc, and accepts an
Packit Service f629e6
    dnl option syntax that involves parentheses and cannot be handled
Packit Service f629e6
    dnl in the usual way in C(PP)FLAGS.  However, c89 will also accept
Packit Service f629e6
    dnl options via the aforementioned environment variable, which
Packit Service f629e6
    dnl gives the user one way around the problem.  (If you're
Packit Service f629e6
    dnl wondering about cc, it is meant for programs written in
Packit Service f629e6
    dnl "Common Usage C" [a.k.a. K&R C] as opposed to "Standard C"
Packit Service f629e6
    dnl [a.k.a. ANSI], and does not build gawk correctly.)
Packit Service f629e6
    if test -n "$_C89_OPTIONS"
Packit Service f629e6
    then
Packit Service f629e6
      AC_MSG_NOTICE([CC = $CC])
Packit Service f629e6
      AC_MSG_NOTICE([_C89_OPTIONS = $_C89_OPTIONS])
Packit Service f629e6
    else
Packit Service f629e6
      AC_MSG_ERROR([c89-setup-required
Packit Service f629e6
To build GNU Awk using "c89", please set
Packit Service f629e6
Packit Service f629e6
    _C89_OPTIONS="-W c,langlvl(stdc99,libext),haltonmsg(CCN3296)"
Packit Service f629e6
Packit Service f629e6
in your environment, and reconfigure. (The above flags cannot be specified
Packit Service f629e6
in CFLAGS/CPPFLAGS, due to the parentheses.)])
Packit Service f629e6
    fi
Packit Service f629e6
    ;;
Packit Service f629e6
  gcc)
Packit Service f629e6
    dnl GCC has not yet been ported to z/OS as of this writing
Packit Service f629e6
    ;;
Packit Service f629e6
  cc)
Packit Service f629e6
    AC_MSG_ERROR([cc-invalid
Packit Service f629e6
The z/OS "cc" compiler does not build GNU Awk correctly.
Packit Service f629e6
Packit Service f629e6
If the "xlc" or "c89" compiler is available, please set CC accordingly
Packit Service f629e6
and reconfigure. ("xlc" is the recommended compiler on z/OS.)])
Packit Service f629e6
    ;;
Packit Service f629e6
  xlc*)
Packit Service f629e6
    dnl This enables C99, and on z/OS 1.11, the setenv() prototype.
Packit Service f629e6
    CFLAGS="$CFLAGS -qlanglvl=stdc99:libext"
Packit Service f629e6
    dnl Use a compiler wrapper script to address some annoyances.
Packit Service f629e6
    cat >zos-cc <
Packit Service f629e6
#!/bin/sh
Packit Service f629e6
#
Packit Service f629e6
# This wrapper script addresses two annoying peculiarities of the IBM
Packit Service f629e6
# xlc/c99 compiler on z/OS:
Packit Service f629e6
#
Packit Service f629e6
# 1. Missing header files are considered warnings by default rather
Packit Service f629e6
#    than fatal errors;
Packit Service f629e6
#
Packit Service f629e6
# 2. Include directories specified with -I are searched _after_ the
Packit Service f629e6
#    system include directories (for #include<> directives) rather
Packit Service f629e6
#    than before.
Packit Service f629e6
#
Packit Service f629e6
# This script allows the code and the build system to assume standard
Packit Service f629e6
# compiler behavior.
Packit Service f629e6
#
Packit Service f629e6
Packit Service f629e6
PS4='zos-cc: '
Packit Service f629e6
REAL_CC="$CC"
Packit Service f629e6
Packit Service f629e6
set -x
Packit Service f629e6
\$REAL_CC -qhaltonmsg=CCN3296 -qnosearch "\$[]@" -qsearch=/usr/include
Packit Service f629e6
EOF
Packit Service f629e6
    chmod +x zos-cc
Packit Service f629e6
    AC_MSG_NOTICE([wrapping $CC with zos-cc to obtain standard behavior])
Packit Service f629e6
    CC="`pwd`/zos-cc"
Packit Service f629e6
    ;;
Packit Service f629e6
  *)
Packit Service f629e6
    AC_MSG_WARN([unrecognized compiler environment])
Packit Service f629e6
    ;;
Packit Service f629e6
  esac
Packit Service f629e6
fi # ac_cv_zos_uss = yes
Packit Service f629e6
])dnl