Merged changes made for version 4.1.20 onto the trunk
[findutils.git] / import-gnulib.sh
blob3288a0123c38b0355ab690a589a56d7a4d6bd877
1 #! /bin/sh
3 # import-gnulib.sh -- imports a copy of gnulib into findutils
4 # Copyright (C) 2003 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)
9 # any later version.
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., 9 Temple Place - Suite 330, Boston, MA 02111-1307,
19 # USA.
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
30 # it to be.
33 destdir="gnulib"
36 modules="\
37 alloca argmatch dirname error fileblocks fnmatch \
38 getline getopt human idcache lstat malloc memcmp memset mktime \
39 modechange pathmax quotearg realloc regex rpmatch savedir stat \
40 stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \
41 xalloc xgetcwd xstrtol xstrtoumax yesno human basename filemode \
42 getline stpcpy"
44 if test $# -lt 1
45 then
46 echo "You need to specify the name of the directory containing gnulib" >&2
47 exit 1
50 if test -d "$1"
51 then
52 true
53 else
54 echo "$1 is not a directory" >&2
55 exit 1
58 if test -e "$1"/gnulib-tool
59 then
60 true
61 else
62 echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
63 exit 1
66 if test -x "$1"/gnulib-tool
67 then
68 true
69 else
70 echo "$1/gnulib-tool is not executable" >&2
71 exit 1
74 if test -x "$1"/gnulib-tool
75 then
76 exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules