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