From 3d2af5b8dbda182a2be8df30ea8149239f617d8d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 26 Dec 2017 21:45:11 +0200 Subject: Small fix in extension/gawkfts.c. --- extension/ChangeLog | 6 ++++++ extension/gawkfts.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'extension') diff --git a/extension/ChangeLog b/extension/ChangeLog index b6e943cd..49b156bc 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,9 @@ +2017-12-26 Arnold D. Robbins + + * gawkfts.c (fts_safe_changedir): Add check for path not null + before trying to open it. Thanks to Michal Jaegermann + for the report. + 2017-12-24 Michal Jaegermann * intdiv.c: Fix compilation for MPFR 2.4.1. diff --git a/extension/gawkfts.c b/extension/gawkfts.c index d9edd87f..c7fbc17d 100644 --- a/extension/gawkfts.c +++ b/extension/gawkfts.c @@ -1239,7 +1239,7 @@ fts_safe_changedir(const FTS *sp, const FTSENT *p, int fd, const char *path) if (ISSET(FTS_NOCHDIR)) return 0; - if (oldfd < 0 && (fd = open(path, O_RDONLY)) == -1) + if (oldfd < 0 && (path == NULL || (fd = open(path, O_RDONLY)) == -1)) return -1; if (fstat(fd, &sb) == -1) -- cgit v1.2.3 From a89622fa57b3cf74e96b9f04c9cae897498155e9 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Thu, 28 Dec 2017 20:15:50 +0200 Subject: Get rid of GLIBC/compile warnings on Fedora in extension directory. --- extension/ChangeLog | 13 ++++++ extension/configh.in | 17 +++----- extension/configure | 115 ++++++++++++++++++++++++++----------------------- extension/configure.ac | 14 ++++-- extension/filefuncs.c | 12 +++--- extension/fnmatch.c | 11 ++--- 6 files changed, 103 insertions(+), 79 deletions(-) (limited to 'extension') diff --git a/extension/ChangeLog b/extension/ChangeLog index 49b156bc..5fd1757e 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,16 @@ +2017-12-28 Arnold D. Robbins + + More configuration fixes, mainly for Fedora. Thanks to + Michal Jaegermann for the reports + and for validating. + + * configure.ac (AC_HEADER_MAJOR): Comment out, no longer works. + (sys/sysmacros.h, sys/mkdev.h): Check for header existence. + (fmod): Check with AC_SEARCH_LIB instead of AC_CHECK_FUNCS. + * filefuncs.c: Rework header inclusion checks and order so + that we get the `major' macro without warnings on Fedora. + * fnmatch.c: Ditto. + 2017-12-26 Arnold D. Robbins * gawkfts.c (fts_safe_changedir): Add check for path not null diff --git a/extension/configh.in b/extension/configh.in index 9d3d9919..c2b16d7b 100644 --- a/extension/configh.in +++ b/extension/configh.in @@ -27,9 +27,6 @@ /* Define to 1 if you have the `fdopendir' function. */ #undef HAVE_FDOPENDIR -/* Define to 1 if you have the `fmod' function. */ -#undef HAVE_FMOD - /* Define to 1 if you have the `fnmatch' function. */ #undef HAVE_FNMATCH @@ -88,6 +85,9 @@ */ #undef HAVE_SYS_DIR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MKDEV_H + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H @@ -104,6 +104,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H @@ -116,14 +119,6 @@ /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR -/* Define to 1 if `major', `minor', and `makedev' are declared in . - */ -#undef MAJOR_IN_MKDEV - -/* Define to 1 if `major', `minor', and `makedev' are declared in - . */ -#undef MAJOR_IN_SYSMACROS - /* Name of package */ #undef PACKAGE diff --git a/extension/configure b/extension/configure index 3666df28..854e296f 100755 --- a/extension/configure +++ b/extension/configure @@ -12618,7 +12618,8 @@ else $as_echo "no" >&6; } fi -for ac_header in fnmatch.h limits.h sys/time.h sys/select.h sys/param.h sys/statvfs.h +for ac_header in fnmatch.h limits.h sys/mkdev.h sys/param.h sys/select.h \ + sys/statvfs.h sys/sysmacros.h sys/time.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" @@ -12631,6 +12632,7 @@ fi done + ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` @@ -12789,56 +12791,6 @@ fi fi -{ $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 -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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : @@ -12959,8 +12911,9 @@ $as_echo "#define HAVE_MPFR 1" >>confdefs.h ;; esac -for ac_func in fdopendir fmod fnmatch getdtablesize \ - gettimeofday nanosleep select statvfs GetSystemTimeAsFileTime +for ac_func in fdopendir fnmatch getdtablesize \ + gettimeofday nanosleep select statvfs \ + GetSystemTimeAsFileTime do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -12972,6 +12925,62 @@ _ACEOF fi done +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing fmod" >&5 +$as_echo_n "checking for library containing fmod... " >&6; } +if ${ac_cv_search_fmod+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char fmod (); +int +main () +{ +return fmod (); + ; + return 0; +} +_ACEOF +for ac_lib in '' m; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_fmod=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_fmod+:} false; then : + break +fi +done +if ${ac_cv_search_fmod+:} false; then : + +else + ac_cv_search_fmod=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_fmod" >&5 +$as_echo "$ac_cv_search_fmod" >&6; } +ac_res=$ac_cv_search_fmod +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + diff --git a/extension/configure.ac b/extension/configure.ac index e1438259..14259333 100644 --- a/extension/configure.ac +++ b/extension/configure.ac @@ -75,9 +75,13 @@ else AC_MSG_RESULT([no]) fi -AC_CHECK_HEADERS(fnmatch.h limits.h sys/time.h sys/select.h sys/param.h sys/statvfs.h) +AC_CHECK_HEADERS(fnmatch.h limits.h sys/mkdev.h sys/param.h sys/select.h \ + sys/statvfs.h sys/sysmacros.h sys/time.h) + AC_HEADER_DIRENT -AC_HEADER_MAJOR +dnl 12/2017: AC_HEADER_MAJOR no longer works on recent Fedora / GLIBC. +dnl Instead we just check for the headers in the call above. +dnl AC_HEADER_MAJOR AC_HEADER_TIME dnl check for mpfr support @@ -92,8 +96,10 @@ case `uname -m` in ;; esac -AC_CHECK_FUNCS(fdopendir fmod fnmatch getdtablesize \ - gettimeofday nanosleep select statvfs GetSystemTimeAsFileTime) +AC_CHECK_FUNCS(fdopendir fnmatch getdtablesize \ + gettimeofday nanosleep select statvfs \ + GetSystemTimeAsFileTime) +AC_SEARCH_LIBS(fmod, m) GAWK_FUNC_DIRFD GAWK_PREREQ_DIRFD diff --git a/extension/filefuncs.c b/extension/filefuncs.c index 38542115..64016402 100644 --- a/extension/filefuncs.c +++ b/extension/filefuncs.c @@ -72,17 +72,17 @@ #include #include -#include - #ifdef HAVE_SYS_PARAM_H #include #endif /* HAVE_SYS_PARAM_H */ -#ifdef MAJOR_IN_MKDEV -#include -#elif defined(MAJOR_IN_SYSMACROS) +#if HAVE_SYS_SYSMACROS_H #include -#endif +#elif HAVE_SYS_MKDEV_H +#include +#endif /* HAVE_SYS_MKDEV_H */ + +#include #include diff --git a/extension/fnmatch.c b/extension/fnmatch.c index 9b7640de..5119bfda 100644 --- a/extension/fnmatch.c +++ b/extension/fnmatch.c @@ -36,14 +36,15 @@ #include #include -#include #include -#ifdef MAJOR_IN_MKDEV -#include -#elif defined(MAJOR_IN_SYSMACROS) +#if HAVE_SYS_SYSMACROS_H #include -#endif +#elif HAVE_SYS_MKDEV_H +#include +#endif /* HAVE_SYS_MKDEV_H */ + +#include #include "gawkapi.h" -- cgit v1.2.3