Remove files imported via autogen.sh.
[libguestfs.git] / bootstrap
1 #!/bin/sh
2
3 usage() {
4   echo >&2 "\
5 Usage: $0 [OPTION]...
6 Bootstrap this package from the checked-out sources.
7
8 Options:
9  --gnulib-srcdir=DIRNAME  Specify the local directory where gnulib
10                           sources reside.  Use this if you already
11                           have gnulib sources on your machine, and
12                           do not want to waste your bandwidth downloading
13                           them again.
14
15 If the file bootstrap.conf exists in the current working directory, its
16 contents are read as shell variables to configure the bootstrap.
17
18 Running without arguments will suffice in most cases.
19 "
20 }
21
22 for option
23 do
24   case $option in
25   --help)
26     usage
27     exit;;
28   --gnulib-srcdir=*)
29     GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
30   *)
31     echo >&2 "$0: $option: unknown option"
32     exit 1;;
33   esac
34 done
35
36 # Get gnulib files.
37
38 case ${GNULIB_SRCDIR--} in
39 -)
40   echo "$0: getting gnulib files..."
41   git submodule init || exit $?
42   git submodule update || exit $?
43   GNULIB_SRCDIR=.gnulib
44   ;;
45 *)
46   # Redirect the gnulib submodule to the directory on the command line
47   # if possible.
48   if test -d "$GNULIB_SRCDIR"/.git && \
49         git config --file .gitmodules submodule.gnulib.url >/dev/null; then
50     git submodule init
51     GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
52     git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
53     echo "$0: getting gnulib files..."
54     git submodule update || exit $?
55     GNULIB_SRCDIR=.gnulib
56   else
57     echo >&2 "$0: invalid gnulib srcdir: $GNULIB_SRCDIR"
58     exit 1
59   fi
60   ;;
61 esac
62
63 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
64 <$gnulib_tool || exit
65
66 modules='
67 gitlog-to-changelog
68 gnu-make
69 gnumakefile
70 maintainer-makefile
71 manywarnings
72 warnings
73 vc-list-files
74 '
75
76 $gnulib_tool                    \
77   --avoid=dummy                 \
78   --with-tests                  \
79   --m4-base=gnulib/m4           \
80   --source-base=gnulib/lib      \
81   --tests-base=gnulib/tests     \
82   --import $modules