-
Notifications
You must be signed in to change notification settings - Fork 22
/
bootstrap
executable file
·140 lines (126 loc) · 3.05 KB
/
bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
ARGS=1
BF_OPTIONS=
MAINT_FLAGS="--cache-file=config.cache"
while [ $ARGS != 0 ]
do
case "$1" in
bat)
cmd /c bootstrap.bat $BF_OPTIONS
exit 0
;;
nodoc)
BF_OPTIONS="-DBUILDDOCS=no $BF_OPTIONS"
shift
;;
noex)
BF_OPTIONS="-DBUILDEXAMPLES=no $BF_OPTIONS"
shift
;;
nolib)
BF_OPTIONS="-DBUILDLIBRARY=no $BF_OPTIONS"
shift
;;
nomaint)
MAINT_FLAGS=
shift
;;
noopt)
export CXXFLAGS="-g -O0"
shift
;;
pedantic)
export CXXFLAGS="-g -O2 -ansi -pedantic -Wall -Wextra -W -Wold-style-cast -Wfloat-equal -Wwrite-strings -Wno-overloaded-virtual -Wno-long-long -Wno-variadic-macros -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC"
shift
;;
*)
ARGS=0
;;
esac
done
# Find location of Bakefile stuff.
bakefilize=bakefilize
for d in /usr/share/aclocal /usr/local/share/aclocal \
'/c/Program Files (x86)/Bakefile/autoconf'
do
BAKEFILE_M4="$d"
if [ -e "$BAKEFILE_M4/bakefile.m4" ]
then
if [ -x "$d/bakefilize" ]
then
bakefilize="$d/bakefilize"
fi
break
fi
done
if [ ! -e "$BAKEFILE_M4/bakefile.m4" ]
then
echo
echo "Failed to find bakefile.m4. Add the directory containing"
echo "this to the bootstrap script."
echo
exit 1
fi
if [ ! -x "$bakefilize" ] && ! type -p "$bakefilize" > /dev/null
then
echo
echo "Failed to find the bakefilize script. Is Bakefile installed?"
echo
exit 1
fi
# Check for existence of needed tools, so we can give a better error
# message than the shell will.
tools="make" # POSIX
tools="$tools aclocal autoconf autoheader autoreconf libtoolize" # Autotools
tools="$tools bakefile bakefile_gen" # Bakefile
for tool in $tools
do
if ! type -p $tool > /dev/null
then
echo "FAILED to find build tool '$tool'!"
echo
echo BOOTSTRAP FAILED!
echo
exit 1
fi
done
# Do Bakefile stuff first. Autoconf can't succeed without
# autoconf_in.m4, which Bakefile creates.
success=
set -x &&
for d in 3 5 8 ; do mkdir -p vc200$d ; done &&
"$bakefilize" &&
rm -f INSTALL &&
bakefile_gen $BF_OPTIONS &&
bakefile -f gnu -o Makefile.simple -DBUILDLIBRARY=no mysql++.bkl &&
set +x &&
success=shonuff
# Do the autotools stuff if Bakefile steps succeeded
#
# We're calling automake only because autoconf depends on install-sh or
# similar, and it *ass*umes you're using automake as well, so it
# delegates installation of that to automake! This is why we ignore its
# errors: it fails because configure.ac doesn't refer to AM_* and there
# is no Makefile.am file, but it does still copy over the missing files.
if [ -n "$success" ]
then
# autoreconf from old Autoconf doesn't pass -I to aclocal properly.
export ACLOCAL="aclocal -I config -I '${BAKEFILE_M4}'"
rm -f config.cache
mv autoconf_inc.m4 config > /dev/null 2>&1 # don't care if it fails
set -x &&
automake --add-missing --force-missing > /dev/null 2>&1 ;
autoreconf -i &&
./configure $MAINT_FLAGS $* &&
make lib/querydef.h lib/ssqls.h &&
set +x &&
success=awyeah
fi
# Detect failure in any part of above
if [ -z "$success" ]
then
echo
echo BOOTSTRAP FAILED!
echo
exit 1
fi