Instead of selecting the old or new exec handling code with the NEW_EXEC macro, just...
[findutils.git] / import-gnulib.sh
blob8f5ded22256084caaff7bf356fb51b85a1ebb982
1 #! /bin/sh
3 # import-gnulib.sh -- imports a copy of gnulib into findutils
4 # Copyright (C) 2003,2004,2005,2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
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 # If CDPATH is set, it will sometimes print the name of the directory
34 # to which you have moved. Unsetting CDPATH prevents this, as does
35 # prefixing it with ".".
36 unset CDPATH
38 destdir="gnulib"
41 # Random extra gnulib files needed for findutils.
42 # The source path is relative to gnulib, the destination to .
43 findutils_files='
44 build-aux/config.guess
45 build-aux/config.rpath
46 build-aux/config.sub
47 build-aux/depcomp
48 build-aux/install-sh
49 build-aux/mdate-sh
50 build-aux/missing
51 build-aux/texinfo.tex
54 # Modules needed for findutils.
55 findutils_modules="\
56 alloca argmatch dirname error fileblocks fnmatch-gnu fopen-safer fts \
57 getline getopt human idcache lstat malloc memcmp memset mktime \
58 modechange pathmax quotearg realloc regex rpmatch savedir \
59 stpcpy strdup strftime strstr strtol strtoul strtoull strtoumax \
60 xalloc xalloc-die xgetcwd xstrtod xstrtol xstrtoumax yesno human filemode \
61 getline stpcpy canonicalize mountlist closeout gettext stat-macros"
63 # We need regex to ensure that we can build on platforms like
64 # Solaris which lack those functions.
66 modules="$findutils_modules"
67 export modules
69 if test $# -lt 1
70 then
71 echo "You need to specify the name of the directory containing gnulib" >&2
72 exit 1
75 if test -d "$1"
76 then
77 true
78 else
79 echo "$1 is not a directory" >&2
80 exit 1
83 if test -f "$1"/gnulib-tool
84 then
85 true
86 else
87 echo "$1/gnulib-tool does not exist, did you specify the right directory?" >&2
88 exit 1
91 if test -x "$1"/gnulib-tool
92 then
93 true
94 else
95 echo "$1/gnulib-tool is not executable" >&2
96 exit 1
100 # exec "$1"/gnulib-tool --create-testdir --dir="$destdir" --lib=libgnulib $modules
102 if [ -d gnulib ]
103 then
104 echo "Warning: directory gnulib already exists." >&2
105 else
106 mkdir gnulib
110 if "$1"/gnulib-tool --import --dir=. --lib=libgnulib --source-base=gnulib/lib --m4-base=gnulib/m4 $modules
111 then
112 : OK
113 else
114 echo "gnulib-tool failed, exiting." >&2
115 exit 1
119 for file in $findutils_files; do
120 case $file in
121 */mdate-sh | */texinfo.tex) dest=doc;;
122 *) dest=.;;
123 esac
124 cp -fp "$1"/$file $dest || exit
125 done
129 cat > gnulib/Makefile.am <<EOF
130 # Copyright (C) 2004 Free Software Foundation, Inc.
132 # This file is free software, distributed under the terms of the GNU
133 # General Public License. As a special exception to the GNU General
134 # Public License, this file may be distributed as part of a program
135 # that contains a configuration script generated by Automake, under
136 # the same distribution terms as the rest of that program.
138 # This file was generated by $0 $@.
140 SUBDIRS = lib
144 ## (
145 ## cat <<EOF
146 ## # Copyright (C) 2004 Free Software Foundation, Inc.
147 ## #
148 ## # This file is free software, distributed under the terms of the GNU
149 ## # General Public License. As a special exception to the GNU General
150 ## # Public License, this file may be distributed as part of a program
151 ## # that contains a configuration script generated by Automake, under
152 ## # the same distribution terms as the rest of that program.
153 ## #
154 ## # This file was generated by $0 $@.
155 ## #
156 ## EOF
157 ## printf "%s" "EXTRA_DIST = "
158 ## cd ./gnulib/m4
159 ## ls *.m4 | sed -e 's/$/ \\/' | sed -e '$ s/\\$//'
160 ## echo
161 ## ) > gnulib/m4/Makefile.am