daemon: Fix sync() call on Unix.
[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 }
9
10 for option
11 do
12   case $option in
13   --help)
14     usage
15     exit;;
16   *)
17     echo >&2 "$0: $option: unknown option"
18     exit 1;;
19   esac
20 done
21
22 # Get gnulib files.
23
24 echo "$0: getting gnulib files..."
25 git submodule init || exit $?
26 git submodule update || exit $?
27 GNULIB_SRCDIR=.gnulib
28
29 ls po/*.po 2>/dev/null | sed 's|.*/||; s|\.po$||' > po/LINGUAS
30
31 # Run autopoint, to get po/Makevars.template:
32 # Also, released autopoint has the tendency to install macros that have
33 # been obsoleted in current gnulib, so run this before gnulib-tool.
34 autopoint --force
35
36 # Autoreconf runs aclocal before libtoolize, which causes spurious
37 # warnings if the initial aclocal is confused by the libtoolized
38 # (or worse out-of-date) macro directory.
39 libtoolize --copy --install
40
41 # Create gettext configuration.
42 echo "$0: Creating po/Makevars from po/Makevars.template ..."
43 rm -f po/Makevars
44 sed '
45   /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
46   /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
47   /^XGETTEXT_OPTIONS *=/{
48     s/$/ \\/
49     a\
50         '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
51   }
52 ' po/Makevars.template >po/Makevars
53
54 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
55 <$gnulib_tool || exit
56
57 (cd daemon && mkdir -p tests lib && ../$gnulib_tool --update)
58
59 modules='
60 arpa_inet
61 c-ctype
62 closeout
63 gitlog-to-changelog
64 gnu-make
65 gnumakefile
66 hash
67 hash-pjw
68 ignore-value
69 maintainer-makefile
70 manywarnings
71 netinet_in
72 progname
73 strchrnul
74 strerror
75 strndup
76 vasprintf
77 vc-list-files
78 warnings
79 '
80
81 $gnulib_tool                    \
82   --avoid=dummy                 \
83   --with-tests                  \
84   --m4-base=m4                  \
85   --source-base=gnulib/lib      \
86   --tests-base=gnulib/tests     \
87   --import $modules
88
89 # Disable autopoint and libtoolize, since they were already done above.
90 AUTOPOINT=true LIBTOOLIZE=true autoreconf --verbose --install