* configure.ac: gnulib supplies waitpid and C89 supplies strspn. Hence there is no need for any call to FINDLIB_REPLACE_FUNCS. That being the case we don't need to test it with forcefindlib. * m4/findlib.m4: remove since FINDLIB_REPLACE_FUNCS is unused. * m4/Makefile.am (EXTRA_DIST): findlib.m4 has been deleted, so don't distribute it. * lib/waitpid.c: remove, since gnulib provides this. * lib/forcefindlib.c: remove, since there is no longer any need to test FINDLIB_REPLACE_FUNCS. * lib/Makefile.am (libfind_a_SOURCES): Specify this variable all in one go, instead of in several parts. Move some header files into here instead of just having them in EXTRA_DIST. Because FINDLIBOBJS is empty now, there is no need to copy that to libfind_a_LIBADD. --- configure.ac | 5 ---- lib/Makefile.am | 35 +++++++++++++++--------- lib/forcefindlib.c | 47 -------------------------------- lib/waitpid.c | 79 ------------------------------------------------------ m4/Makefile.am | 2 +- m4/findlib.m4 | 69 ----------------------------------------------- 6 files changed, 24 insertions(+), 213 deletions(-) delete mode 100644 lib/forcefindlib.c delete mode 100644 lib/waitpid.c delete mode 100644 m4/findlib.m4
diff --git a/configure.ac b/configure.ac index dd2496e..93fef61 100644 --- a/configure.ac +++ b/configure.ac @@ -170,11 +170,6 @@ AC_CHECK_FUNCS(getmntent) AC_CHECK_FUNCS(setmntent endmntent) -dnl Checks for library functions that are provided by findlib. -FINDLIB_REPLACE_FUNCS(waitpid strspn) -FINDLIB_REPLACE_FUNCS(forcefindlib) - - # Check for common but not-POSIX functions. AC_CHECK_FUNCS(setgroups) diff --git a/lib/Makefile.am b/lib/Makefile.am index 5bfa8ca..0863bec 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -18,10 +18,30 @@ else TESTS += check-regexprops test_splitstring endif -libfind_a_SOURCES = findutils-version.c -EXTRA_DIST = extendbuf.h buildcmd.h \ +libfind_a_SOURCES = \ + buildcmd.c \ + buildcmd.h \ + dircallback.c \ + dircallback.h \ + extendbuf.c \ + extendbuf.h \ + fdleak.c \ + fdleak.h \ + findutils-version.c \ findutils-version.h \ - fdleak.h unused-result.h check-regexprops.sh + listfile.c \ + listfile.h \ + printquoted.c \ + printquoted.h \ + qmark.c \ + regextype.c \ + regextype.h \ + safe-atoi.c \ + safe-atoi.h \ + splitstring.c \ + splitstring.h + +EXTRA_DIST = unused-result.h check-regexprops.sh SUFFIXES = MOSTLYCLEANFILES = DISTCLEANFILES = @@ -31,12 +51,6 @@ MAINTAINERCLEANFILES = AM_CPPFLAGS = -I../gl/lib -I$(top_srcdir)/gl/lib LDADD = ../gl/lib/libgnulib.a $(LIBINTL) -libfind_a_SOURCES += printquoted.h listfile.h \ - regextype.h dircallback.h safe-atoi.h splitstring.h -libfind_a_SOURCES += listfile.c extendbuf.c buildcmd.c \ - forcefindlib.c qmark.c printquoted.c regextype.c dircallback.c fdleak.c \ - safe-atoi.c splitstring.c - CLEANFILES = check-regexprops # Clean coverage files generated by running binaries built with @@ -46,10 +60,7 @@ coverage-clean: clean-local: coverage-clean -EXTRA_DIST += waitpid.c forcefindlib.c TESTS_ENVIRONMENT = REGEXPROPS=regexprops$(EXEEXT) -libfind_a_LIBADD = $(FINDLIBOBJS) -libfind_a_DEPENDENCIES = $(FINDLIBOBJS) check-regexprops: check-regexprops.sh cp $(srcdir)/check-regexprops.sh check-regexprops diff --git a/lib/forcefindlib.c b/lib/forcefindlib.c deleted file mode 100644 index 82999b6..0000000 --- a/lib/forcefindlib.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Ensures that the FINDLIB_REPLACE_FUNCS macro in configure.in works - Copyright (C) 2004, 2010, 2011 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -*/ - -/* Written by James Youngman. */ - - -#include <config.h> - - -extern void forcefindlib (void); /* prevent GCC warning... */ - - - -/* forcefindlib - * - * This function exists only to be pulled into libfind.a by the - * FINDLIB_REPLACE_FUNCS macro in configure.in. We already have - * AC_REPLACE_FUNCS, but that adds to LIBOBJS, and that's a gnulib thing - * in the case of findutils. Hence we have out own library of replacement - * functions which aren't in gnulib (or aren't in it any more). An example - * of this is waitpid(). I develop on a system that doesn't - * lack waitpid, for example. Therefore FINDLIB_REPLACE_FUNCS(waitpid) - * never puts waitpid.o into FINDLIBOBJS. Hence, to ensure that these - * macros are tested every time, we use FINDLIB_REPLACE_FUNCS on a function - * that never exists anywhere, so always needs to be pulled in. That function - * is forcefindlib(). - */ -void -forcefindlib (void) -{ - /* does nothing, exists only to ensure that FINDLIB_REPLACE_FUNCS works. */ -} diff --git a/lib/waitpid.c b/lib/waitpid.c deleted file mode 100644 index 1d63fbd..0000000 --- a/lib/waitpid.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Emulate waitpid on systems that just have wait. - Copyright 1994, 1995, 1998, 1999, 2010, 2011 Free Software - Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -/* config.h must always be included first. */ -#include <config.h> - -/* system headers. */ -#include <errno.h> - - -/* TODO: replace this with gnulib's waitpid. */ -#if defined _MSC_VER || defined __MINGW32__ -/* Native Woe32 API. */ -#include <process.h> -#else -/* Unix API. */ -#include <sys/wait.h> -#endif - -#define WAITPID_CHILDREN 8 -static pid_t waited_pid[WAITPID_CHILDREN]; -static int waited_status[WAITPID_CHILDREN]; - -pid_t -waitpid (pid_t pid, int *stat_loc, int options) -{ - int i; - pid_t p; - - if (!options && (pid == -1 || 0 < pid)) - { - /* If we have already waited for this child, return it immediately. */ - for (i = 0; i < WAITPID_CHILDREN; i++) - { - p = waited_pid[i]; - if (p && (p == pid || pid == -1)) - { - waited_pid[i] = 0; - goto success; - } - } - - /* The child has not returned yet; wait for it, accumulating status. */ - for (i = 0; i < WAITPID_CHILDREN; i++) - if (! waited_pid[i]) - { - p = wait (&waited_status[i]); - if (p < 0) - return p; - if (p == pid || pid == -1) - goto success; - waited_pid[i] = p; - } - } - - /* We cannot emulate this wait call, e.g. because of too many children. */ - errno = EINVAL; - return -1; - -success: - if (stat_loc) - *stat_loc = waited_status[i]; - return p; -} diff --git a/m4/Makefile.am b/m4/Makefile.am index 0e513fd..d7c7230 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = findlib.m4 nullsort.m4 order-bad.bin order-good.bin withfts.m4 +EXTRA_DIST = nullsort.m4 order-bad.bin order-good.bin withfts.m4 diff --git a/m4/findlib.m4 b/m4/findlib.m4 deleted file mode 100644 index 5a58afc..0000000 --- a/m4/findlib.m4 +++ /dev/null @@ -1,69 +0,0 @@ -# FINDLIB_REPLACE_FUNCS(FUNCTION...) -# ----------------------------- -AC_DEFUN([FINDLIB_REPLACE_FUNCS], -[AC_FOREACH([AC_Func], [$1], [jy_FINDLIBSOURCE(AC_Func.c)])dnl -AC_CHECK_FUNCS([$1], , [_jy_FINDLIBOBJ($ac_func)]) -]) - - - -# jy_FINDLIBSOURCE(FILENAME) -# ---------------------- -# Announce we might need the file `FILENAME'. -m4_define([jy_FINDLIBSOURCE], []) - - - -# jy_FINDLIBOBJ(FILENAME-NOEXT, ACTION-IF-INDIR) -# ------------------------------------------- -# We need `FILENAME-NOEXT.o', save this into `FINDLIBOBJS'. -# We don't use AC_SUBST/2 because it forces an unnecessary eol. -m4_define([_jy_FINDLIBOBJ], -[AS_LITERAL_IF([$1], - [jy_FINDLIBSOURCE([$1.c])], - [$2])dnl -AC_SUBST([FINDLIB@&t@OBJS])dnl -case $FINDLIB@&t@OBJS in - "$1.$ac_objext" | \ - *" $1.$ac_objext" | \ - "$1.$ac_objext "* | \ - *" $1.$ac_objext "* ) ;; - *) FINDLIB@&t@OBJS="$FINDLIB@&t@OBJS $1.$ac_objext" ;; -esac -]) - - - -# jy_FINDLIBOBJ(FILENAME-NOEXT) -# ------------------------- -# We need `FILENAME-NOEXT.o', save this into `FINDLIBOBJS'. -# We don't use AC_SUBST/2 because it forces an unnecessary eol. -m4_define([jy_FINDLIBOBJ], -[_jy_FINDLIBOBJ([$1], - [AC_DIAGNOSE(syntax, - [$0($1): you should use literals])])dnl -]) - - -# _jy_FINDLIBOBJS_NORMALIZE -# --------------------- -# Adapted from autoconf's general.m4. -# Clean up FINDLIBOBJS abd LTFINDLIBOBJS -# Used with AC_CONFIG_COMMANDS_PRE. -AC_DEFUN([_jy_FINDLIBOBJS_NORMALIZE], -[ac_findlibobjs= -ac_ltfindlibobjs= -for ac_i in : $FINDLIB@&t@OBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_findlibobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltfindlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -AC_SUBST([FINDLIB@&t@OBJS], [$ac_findlibobjs]) -AC_SUBST([LTFINDLIBOBJS], [$ac_ltfindlibobjs]) -]) - - -dnl AC_CONFIG_COMMANDS_PRE(_jy_FINDLIBOBJS_NORMALIZE) -- 2.1.4