]> Savannah Git Hosting - gnulib.git/commitdiff
fclose, strstr-simple, wchar: port to z/OS
authorDaniel Richard G <skunk@iSKUNK.ORG>
Wed, 17 Aug 2016 23:09:38 +0000 (16:09 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 18 Aug 2016 00:44:56 +0000 (17:44 -0700)
* m4/fclose.m4, m4/strstr.m4, m4/wchar_h.m4:
Changes to the Autoconf M4 code to support z/OS.  Note that
fclose() is broken in a different way on z/OS than it is on other
systems, thus the special-case in fclose.m4.

ChangeLog
m4/fclose.m4
m4/strstr.m4
m4/wchar_h.m4

index 7806ee561c5d2cb52da50eefd20634063a4e635a..5515b1461e7073b8e0470c23bda95f48ec339108 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2016-08-17  Daniel Richard G.  <skunk@iSKUNK.ORG>
 
+       fclose, strstr-simple, wchar: port to z/OS
+       * m4/fclose.m4, m4/strstr.m4, m4/wchar_h.m4:
+       Changes to the Autoconf M4 code to support z/OS.  Note that
+       fclose() is broken in a different way on z/OS than it is on other
+       systems, thus the special-case in fclose.m4.
+
        iconv_open-utf-tests, iconv-tests: port to EBCDIC
        * tests/test-iconv-utf.c, tests/test-iconv.c:
        Added appropriately conditional #pragmas so that the test strings
index 363b7fee83559c7d52f9e2cd129f7d599d6dc774..3fa25b105209066733d4bb999d8bc7b4ea406188 100644 (file)
@@ -1,4 +1,4 @@
-# fclose.m4 serial 6
+# fclose.m4 serial 7
 dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_FCLOSE],
 [
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
 
   gl_FUNC_FFLUSH_STDIN
   if test $gl_cv_func_fflush_stdin != yes; then
@@ -17,4 +18,8 @@ AC_DEFUN([gl_FUNC_FCLOSE],
   if test $REPLACE_CLOSE = 1; then
     REPLACE_FCLOSE=1
   fi
+
+  case "$host_os" in
+    openedition) REPLACE_FCLOSE=1 ;;
+  esac
 ])
index 77db2a47f97f7a9911d3b6c4b16e1b389ddff507..bfe4c8590d95a5d9b1edc066f2c87aaac138ac20 100644 (file)
@@ -1,4 +1,4 @@
-# strstr.m4 serial 16
+# strstr.m4 serial 17
 dnl Copyright (C) 2008-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -67,6 +67,12 @@ AC_DEFUN([gl_FUNC_STRSTR],
     AC_CACHE_CHECK([whether strstr works in linear time],
       [gl_cv_func_strstr_linear],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#ifdef __MVS__
+/* z/OS does not deliver signals while strstr() is running (thanks to
+   restrictions on its LE runtime), which prevents us from limiting the
+   running time of this test.  */
+# error "This test does not work properly on z/OS"
+#endif
 #include <signal.h> /* for signal */
 #include <string.h> /* for strstr */
 #include <stdlib.h> /* for malloc */
index b40b73237d5f16bb12b1f9f4fb573e2e7811a1cd..16017a59fbbaf029b3761c4d45f7bc20310085b3 100644 (file)
@@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 
 dnl Written by Eric Blake.
 
-# wchar_h.m4 serial 39
+# wchar_h.m4 serial 40
 
 AC_DEFUN([gl_WCHAR_H],
 [
@@ -81,8 +81,14 @@ AC_DEFUN([gl_WCHAR_H_INLINE_OK],
 extern int zero (void);
 int main () { return zero(); }
 ]])])
+     dnl Do not rename the object file from conftest.$ac_objext to
+     dnl conftest1.$ac_objext, as this will cause the link to fail on
+     dnl z/OS when using the XPLINK object format (due to duplicate
+     dnl CSECT names). Instead, temporarily redefine $ac_compile so
+     dnl that the object file has the latter name from the start.
+     save_ac_compile="$ac_compile"
+     ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest1/`
      if AC_TRY_EVAL([ac_compile]); then
-       mv conftest.$ac_objext conftest1.$ac_objext
        AC_LANG_CONFTEST([
          AC_LANG_SOURCE([[#define wcstod renamed_wcstod
 /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
@@ -95,8 +101,9 @@ int main () { return zero(); }
 #include <wchar.h>
 int zero (void) { return 0; }
 ]])])
+       dnl See note above about renaming object files.
+       ac_compile=`echo "$save_ac_compile" | sed s/conftest/conftest2/`
        if AC_TRY_EVAL([ac_compile]); then
-         mv conftest.$ac_objext conftest2.$ac_objext
          if $CC -o conftest$ac_exeext $CFLAGS $LDFLAGS conftest1.$ac_objext conftest2.$ac_objext $LIBS >&AS_MESSAGE_LOG_FD 2>&1; then
            :
          else
@@ -104,6 +111,7 @@ int zero (void) { return 0; }
          fi
        fi
      fi
+     ac_compile="$save_ac_compile"
      rm -f conftest1.$ac_objext conftest2.$ac_objext conftest$ac_exeext
     ])
   if test $gl_cv_header_wchar_h_correct_inline = no; then