| AIX port, bug#490266. |
| |
| This is from 2 upstream commits: |
| |
| http://git.savannah.gnu.org/cgit/gawk.git/commit/?h=gawk-4.1-stable&id=21c8b6d547b12942775d675ead2994992285c04c |
| http://git.savannah.gnu.org/cgit/gawk.git/commit/?h=gawk-4.1-stable&id=29e3ae329c550b884169b7db20775cd74b95b77a |
| |
| #diff --git a/extension/ChangeLog b/extension/ChangeLog |
| #index e01d6d1..4d1af22 100644 |
| #--- a/extension/ChangeLog |
| #+++ b/extension/ChangeLog |
| #@@ -1,3 +1,20 @@ |
| #+2013-10-23 Michael Haubenwallner <michael.haubenwallner@salomon.at> |
| #+ |
| #+ Fix portability for AIX. |
| #+ |
| #+ * inplace.c (_XOPEN_SOURCE): Define when not defined yet. |
| #+ (_XOPEN_SOURCE_EXTENDED): Ditto. Needs to define a number. |
| #+ |
| #+2013-06-10 Arnold D. Robbins <arnold@skeeve.com> |
| #+ |
| #+ * configure.ac (AC_HEADER_MAJOR): New macro added. |
| #+ Add check for limits.h header. |
| #+ * filefuncs.c: Add the right stuff to get the major/minor macros. |
| #+ * readdir.c: Add include of limits.h appropriately wrapped. |
| #+ |
| #+ Thanks to ICHII Takashi <ichii386@schweetheart.jp> for the reports |
| #+ and pointers. |
| #+ |
| # 2013-05-09 Arnold D. Robbins <arnold@skeeve.com> |
| # |
| # * 4.1.0: Release tar ball made. |
| #diff --git a/extension/configure.ac b/extension/configure.ac |
| #index 53ed588..3ad03ed 100644 |
| #--- a/extension/configure.ac |
| #+++ b/extension/configure.ac |
| #@@ -64,7 +64,8 @@ else |
| # AC_MSG_RESULT([no]) |
| # fi |
| # |
| #-AC_CHECK_HEADERS(dirent.h fnmatch.h time.h sys/time.h sys/select.h) |
| #+AC_HEADER_MAJOR |
| #+AC_CHECK_HEADERS(dirent.h fnmatch.h limits.h time.h sys/time.h sys/select.h) |
| # |
| # AC_CHECK_FUNCS(fdopendir fnmatch gettimeofday \ |
| # getdtablesize nanosleep select GetSystemTimeAsFileTime) |
| diff --git a/extension/configh.in b/extension/configh.in |
| index 9162ce4..02954ee 100644 |
| --- a/extension/configh.in |
| +++ b/extension/configh.in |
| @@ -66,6 +66,9 @@ |
| /* Define to 1 if you have the <inttypes.h> header file. */ |
| #undef HAVE_INTTYPES_H |
| |
| +/* Define to 1 if you have the <limits.h> header file. */ |
| +#undef HAVE_LIMITS_H |
| + |
| /* Define to 1 if you have the <memory.h> header file. */ |
| #undef HAVE_MEMORY_H |
| |
| @@ -109,6 +112,14 @@ |
| */ |
| #undef LT_OBJDIR |
| |
| +/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>. |
| + */ |
| +#undef MAJOR_IN_MKDEV |
| + |
| +/* Define to 1 if `major', `minor', and `makedev' are declared in |
| + <sysmacros.h>. */ |
| +#undef MAJOR_IN_SYSMACROS |
| + |
| /* Name of package */ |
| #undef PACKAGE |
| |
| diff --git a/extension/configure b/extension/configure |
| index f848b9b..c3f8f1c 100755 |
| --- a/extension/configure |
| +++ b/extension/configure |
| @@ -13885,7 +13885,57 @@ else |
| $as_echo "no" >&6; } |
| fi |
| |
| -for ac_header in dirent.h fnmatch.h time.h sys/time.h sys/select.h |
| +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 |
| +$as_echo_n "checking whether sys/types.h defines makedev... " >&6; } |
| +if ${ac_cv_header_sys_types_h_makedev+:} false; then : |
| + $as_echo_n "(cached) " >&6 |
| +else |
| + cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
| +/* end confdefs.h. */ |
| +#include <sys/types.h> |
| +int |
| +main () |
| +{ |
| +return makedev(0, 0); |
| + ; |
| + return 0; |
| +} |
| +_ACEOF |
| +if ac_fn_c_try_link "$LINENO"; then : |
| + ac_cv_header_sys_types_h_makedev=yes |
| +else |
| + ac_cv_header_sys_types_h_makedev=no |
| +fi |
| +rm -f core conftest.err conftest.$ac_objext \ |
| + conftest$ac_exeext conftest.$ac_ext |
| + |
| +fi |
| +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5 |
| +$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } |
| + |
| +if test $ac_cv_header_sys_types_h_makedev = no; then |
| +ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" |
| +if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : |
| + |
| +$as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h |
| + |
| +fi |
| + |
| + |
| + |
| + if test $ac_cv_header_sys_mkdev_h = no; then |
| + ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" |
| +if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : |
| + |
| +$as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h |
| + |
| +fi |
| + |
| + |
| + fi |
| +fi |
| + |
| +for ac_header in dirent.h fnmatch.h limits.h time.h sys/time.h sys/select.h |
| do : |
| as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` |
| ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" |
| diff --git a/extension/filefuncs.c b/extension/filefuncs.c |
| index 1e8fc8d..9e637aa 100644 |
| --- a/extension/filefuncs.c |
| +++ b/extension/filefuncs.c |
| @@ -46,6 +46,12 @@ |
| #include <sys/types.h> |
| #include <sys/stat.h> |
| |
| +#ifdef MAJOR_IN_MKDEV |
| +#include <sys/mkdev.h> |
| +#elif defined(MAJOR_IN_SYSMACROS) |
| +#include <sys/sysmacros.h> |
| +#endif |
| + |
| #include "gawkapi.h" |
| |
| #include "gettext.h" |
| diff --git a/extension/inplace.c b/extension/inplace.c |
| index ded4746..69d452a 100644 |
| --- a/extension/inplace.c |
| +++ b/extension/inplace.c |
| @@ -27,8 +27,12 @@ |
| #include <config.h> |
| #endif |
| |
| -#define _XOPEN_SOURCE |
| -#define _XOPEN_SOURCE_EXTENDED |
| +#ifndef _XOPEN_SOURCE |
| +# define _XOPEN_SOURCE |
| +#endif |
| +#ifndef _XOPEN_SOURCE_EXTENDED |
| +# define _XOPEN_SOURCE_EXTENDED 1 |
| +#endif |
| |
| #include <stdio.h> |
| #include <assert.h> |
| diff --git a/extension/readdir.c b/extension/readdir.c |
| index 5ca4dc6..c2a626a 100644 |
| --- a/extension/readdir.c |
| +++ b/extension/readdir.c |
| @@ -44,6 +44,10 @@ |
| #include <sys/types.h> |
| #include <sys/stat.h> |
| |
| +#ifdef HAVE_LIMITS_H |
| +#include <limits.h> |
| +#endif |
| + |
| #ifdef HAVE_DIRENT_H |
| #include <dirent.h> |
| #else |