merge mainline to ia64
[grub.git] / autogen.sh
1 #! /usr/bin/env bash
2
3 set -e
4
5 autogen --version >/dev/null || exit 1
6
7 echo "Importing unicode..."
8 python util/import_unicode.py unicode/UnicodeData.txt unicode/BidiMirroring.txt unicode/ArabicShaping.txt grub-core/unidata.c
9
10 echo "Importing libgcrypt..."
11 python util/import_gcry.py grub-core/lib/libgcrypt/ grub-core
12
13 echo "Creating Makefile.tpl..."
14 python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
15
16 echo "Running autogen..."
17
18 # Automake doesn't like including files from a path outside the project.
19 rm -f contrib grub-core/contrib
20 if [ "x${GRUB_CONTRIB}" != x ]; then
21   [ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
22   [ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
23 fi
24
25 UTIL_DEFS=Makefile.util.def
26 CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
27
28 for extra in contrib/*/Makefile.util.def; do
29   if test -e "$extra"; then
30     UTIL_DEFS="$UTIL_DEFS $extra"
31   fi
32 done
33
34 for extra in contrib/*/Makefile.core.def; do
35   if test -e "$extra"; then
36     CORE_DEFS="$CORE_DEFS $extra"
37   fi
38 done
39
40 cat $UTIL_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
41 cat $CORE_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
42
43 for extra in contrib/*/Makefile.common; do
44   if test -e "$extra"; then
45     echo "include $extra" >> Makefile.util.am
46     echo "include $extra" >> grub-core/Makefile.core.am
47   fi
48 done
49
50 for extra in contrib/*/Makefile.util.common; do
51   if test -e "$extra"; then
52     echo "include $extra" >> Makefile.util.am
53   fi
54 done
55
56 for extra in contrib/*/Makefile.core.common; do
57   if test -e "$extra"; then
58     echo "include $extra" >> grub-core/Makefile.core.am
59   fi
60 done
61
62 echo "Saving timestamps..."
63 echo timestamp > stamp-h.in
64
65 echo "Running autoreconf..."
66 autoreconf -vi
67 exit 0