3 # import-gnulib.sh -- imports a copy of gnulib into findutils
4 # Copyright (C) 2003,2004 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 ##########################################################################
23 # This script is intended to populate the "gnulib" directory
24 # with a subset of the gnulib code, as provided by "gnulib-tool".
26 # To use it, run this script, speficying the location of the
27 # gnulib code as the only argument. Some sanity-checking is done
28 # before we commit to modifying things. The gnulib code is placed
29 # in the "gnulib" subdirectory, which is where the buid files expect
36 # Modules needed for findutils itself.
38 alloca argmatch dirname error fileblocks fnmatch-gnu \
39 getline getopt human idcache lstat malloc memcmp memset mktime \
40 modechange pathmax quotearg realloc regex rpmatch savedir stat \
41 stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \
42 xalloc xalloc-die xgetcwd xstrtol xstrtoumax yesno human filemode \
43 getline stpcpy canonicalize mountlist closeout gettext"
45 # We need regex to ensure that we can build on platforms like
46 # Solaris which lack those functions.
48 modules
="$findutils_modules $intl_modules"
53 echo "You need to specify the name of the directory containing gnulib" >&2
61 echo "$1 is not a directory" >&2
65 if test -f "$1"/gnulib-tool
69 echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
73 if test -x "$1"/gnulib-tool
77 echo "$1/gnulib-tool is not executable" >&2
82 # exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules
86 echo "Warning: directory gnulib already exists." >&2
92 if "$1"/gnulib-tool
--import --dir=.
--lib=libgnulib
--source-base=gnulib
/lib
--m4-base=gnulib
/m4 $modules
96 echo "gnulib-tool failed, exiting." >&2
102 cat > gnulib
/Makefile.am
<<EOF
103 # Copyright (C) 2004 Free Software Foundation, Inc.
105 # This file is free software, distributed under the terms of the GNU
106 # General Public License. As a special exception to the GNU General
107 # Public License, this file may be distributed as part of a program
108 # that contains a configuration script generated by Automake, under
109 # the same distribution terms as the rest of that program.
111 # This file was generated by $0 $@.
118 # Copyright (C) 2004 Free Software Foundation, Inc.
120 # This file is free software, distributed under the terms of the GNU
121 # General Public License. As a special exception to the GNU General
122 # Public License, this file may be distributed as part of a program
123 # that contains a configuration script generated by Automake, under
124 # the same distribution terms as the rest of that program.
126 # This file was generated by $0 $@.
129 printf "%s" "EXTRA_DIST = "
131 ls *.
m4 |
sed -e 's/$/ \\/' |
sed -e '$ s/\\$//'
133 ) > gnulib
/m
4/Makefile.am
137 # We also need config.rpath, because configure calls it, but for
138 # some reason, "autoreconf -i" doesn't fetch it.
139 for f
in config.rpath
141 (set -x; cp "$1"/config
/"$f" .
)