| #!/bin/sh -e |
| |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| get () { |
| variable_name=$1 |
| echo "changequote(\`[', \`]')" > acinclude.m4.tmp |
| sed -e "s/m4_//" < acinclude.m4.in >> acinclude.m4.tmp |
| echo $variable_name >> acinclude.m4.tmp |
| if test -x "`which gm4 2> /dev/null || true`"; then |
| gm4 acinclude.m4.tmp | grep -v "^$" || true |
| else |
| if test -x "`which m4 2> /dev/null || true`"; then |
| m4 acinclude.m4.tmp | grep -v "^$" || true |
| else |
| echo unknown |
| fi |
| fi |
| rm -f acinclude.m4.tmp |
| } |
| |
| mkdir -p build-aux |
| |
| if test -z "$REVISION"; then |
| if test -d .git; then |
| REVISION=`git log --pretty="format:%h" | head -1`-git |
| else |
| # default to svn |
| REVISION=`\`which svn\` info . 2> /dev/null | awk "/Revision:/{print \\$2}"` |
| fi |
| fi |
| if test -z "`get LOCAL_VERSION_STAGE`" -o -z "$REVISION"; then |
| sed "s/%release%//" < acinclude.m4.in > acinclude.m4 |
| else |
| sed "s/%release%/$REVISION/" < acinclude.m4.in > acinclude.m4 |
| fi |
| |
| gunzip -c m4/ac_check_icu.m4.gz > m4/ac_check_icu.m4 |
| gunzip -c m4/ac_check_curl.m4.gz > m4/ac_check_curl.m4 |
| gunzip -c m4/pkg.m4.gz > m4/pkg.m4 |
| |
| # Seach a list of names for the first occurence of a program. |
| # Some systems may use aclocal-1.10, others may have aclocal etc. |
| # |
| # Exit with status code 0 if the program exists (and print the |
| # path to stdout), exit with status code 1 if it can't be |
| # located |
| find_program() { |
| set +e |
| for f in "$@" |
| do |
| file=`which ${f} 2>/dev/null | grep -v '^no '` |
| if test -n "x${file}" -a -x "${file}" |
| then |
| echo ${file} |
| set -e |
| exit 0 |
| fi |
| done |
| |
| echo "Failed to locate required program:" 1>&2 |
| echo "\t$@" 1>&2 |
| set -e |
| exit 1 |
| } |
| |
| LIBTOOLIZE=`find_program glibtoolize libtoolize` |
| ACLOCAL=`find_program aclocal-1.11 aclocal-1.10 aclocal-1.9 aclocal` |
| AUTOHEADER=`find_program autoheader` |
| AUTOMAKE=`find_program automake-1.11 automake-1.10 automake-1.9 automake` |
| AUTOCONF=`find_program autoconf` |
| |
| ${LIBTOOLIZE} -f -c --automake |
| ${ACLOCAL} -I m4 |
| ${AUTOHEADER} -f |
| ${AUTOMAKE} -f -a 2>&1 | sed -e "/install/d" |
| ${AUTOCONF} -f |
| |
| ln -f -s "`dirname \`readlink build-aux/missing\``/INSTALL" |
| |
| cat << EOF |
| You have bootstrapped Apache CouchDB, time to relax. |
| |
| Run \`./configure' to configure the source before you install. |
| EOF |