Corrected typo in the address of the FSF office
[findutils.git] / import-gnulib.sh
blob9abc468f7aec061b24c2712be3fa435b7609d730
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., 59 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 needed for findutils itself.
37 findutils_modules="\
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"
45 # Modules needed for the "intl" subdirectory.
46 intl_modules="regex"
48 modules="$findutils_modules $intl_modules"
49 export modules
51 if test $# -lt 1
52 then
53 echo "You need to specify the name of the directory containing gnulib" >&2
54 exit 1
57 if test -d "$1"
58 then
59 true
60 else
61 echo "$1 is not a directory" >&2
62 exit 1
65 if test -e "$1"/gnulib-tool
66 then
67 true
68 else
69 echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
70 exit 1
73 if test -x "$1"/gnulib-tool
74 then
75 true
76 else
77 echo "$1/gnulib-tool is not executable" >&2
78 exit 1
82 # exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules
84 if [ -d gnulib ]
85 then
86 echo "Warning: directory gnulib already exists." >&2
87 else
88 mkdir gnulib
92 "$1"/gnulib-tool --import --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 $modules
96 cat > gnulib/Makefile.am <<EOF
97 # Copyright (C) 2004 Free Software Foundation, Inc.
99 # This file is free software, distributed under the terms of the GNU
100 # General Public License. As a special exception to the GNU General
101 # Public License, this file may be distributed as part of a program
102 # that contains a configuration script generated by Automake, under
103 # the same distribution terms as the rest of that program.
105 # This file was generated by $0 $@.
107 SUBDIRS = lib m4
111 cat <<EOF
112 # Copyright (C) 2004 Free Software Foundation, Inc.
114 # This file is free software, distributed under the terms of the GNU
115 # General Public License. As a special exception to the GNU General
116 # Public License, this file may be distributed as part of a program
117 # that contains a configuration script generated by Automake, under
118 # the same distribution terms as the rest of that program.
120 # This file was generated by $0 $@.
123 printf "%s" "EXTRA_DIST = "
124 cd gnulib/m4
125 ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//'
126 echo
127 ) > gnulib/m4/Makefile.am