Switch to using the gnulib gettext module, to ensure that 'make distcheck' works...
[findutils.git] / import-gnulib.sh
blob4a78ae0cb268ea21c5857416d3fab1b57332e640
1 #! /bin/sh
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)
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 canonicalize mountlist closeout gettext"
45 # Modules needed for the "intl" subdirectory.
46 #intl_modules="regex"
47 # We currently don't use the intl subdirectory.
48 intl_modules=""
50 modules="$findutils_modules $intl_modules"
51 export modules
53 if test $# -lt 1
54 then
55 echo "You need to specify the name of the directory containing gnulib" >&2
56 exit 1
59 if test -d "$1"
60 then
61 true
62 else
63 echo "$1 is not a directory" >&2
64 exit 1
67 if test -f "$1"/gnulib-tool
68 then
69 true
70 else
71 echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
72 exit 1
75 if test -x "$1"/gnulib-tool
76 then
77 true
78 else
79 echo "$1/gnulib-tool is not executable" >&2
80 exit 1
84 # exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules
86 if [ -d gnulib ]
87 then
88 echo "Warning: directory gnulib already exists." >&2
89 else
90 mkdir gnulib
94 if "$1"/gnulib-tool --import --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 $modules
95 then
96 : OK
97 else
98 echo "gnulib-tool failed, exiting." >&2
99 exit 1
104 cat > gnulib/Makefile.am <<EOF
105 # Copyright (C) 2004 Free Software Foundation, Inc.
107 # This file is free software, distributed under the terms of the GNU
108 # General Public License. As a special exception to the GNU General
109 # Public License, this file may be distributed as part of a program
110 # that contains a configuration script generated by Automake, under
111 # the same distribution terms as the rest of that program.
113 # This file was generated by $0 $@.
115 SUBDIRS = lib m4
119 cat <<EOF
120 # Copyright (C) 2004 Free Software Foundation, Inc.
122 # This file is free software, distributed under the terms of the GNU
123 # General Public License. As a special exception to the GNU General
124 # Public License, this file may be distributed as part of a program
125 # that contains a configuration script generated by Automake, under
126 # the same distribution terms as the rest of that program.
128 # This file was generated by $0 $@.
131 printf "%s" "EXTRA_DIST = "
132 cd gnulib/m4
133 ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//'
134 echo
135 ) > gnulib/m4/Makefile.am