1#!/bin/sh 2# 3# 4# PostGIS Bootstrapping Script 5# 6giveup() 7{ 8 echo 9 echo " Something went wrong, giving up!" 10 echo 11 exit 1 12} 13 14OSTYPE=`uname -s` 15 16# 17# Solaris has GNU versions of utils with a g prefix 18# 19for grep in ggrep grep; do 20 GREP=`which $grep 2>/dev/null` 21 if test -x "${GREP}"; then 22 break; 23 fi 24done 25 26for sed in gsed sed; do 27 SED=`which $sed 2>/dev/null` 28 if test -x "${SED}"; then 29 break; 30 fi 31done 32 33# 34# Find and run Autoconf 35# 36AUTOCONF=`which autoconf 2>/dev/null` 37if [ ! ${AUTOCONF} ]; then 38 echo "Missing autoconf!" 39 exit 1 40fi 41AUTOCONF_VER=`${AUTOCONF} --version | ${GREP} -E "^.*[0-9]$" | ${SED} 's/^.* //'` 42 43for aclocal in aclocal aclocal-1.10 aclocal-1.9; do 44 ACLOCAL=`which $aclocal 2>/dev/null` 45 if test -x "${ACLOCAL}"; then 46 break; 47 fi 48done 49if [ ! ${ACLOCAL} ]; then 50 echo "Missing aclocal!" 51 exit 1 52fi 53ACLOCAL_VER=`${ACLOCAL} --version | ${GREP} -E "^.*[0-9]$" | ${SED} 's/^.* //'` 54 55for libtoolize in glibtoolize libtoolize; do 56 LIBTOOLIZE=`which $libtoolize 2>/dev/null` 57 if test -x "${LIBTOOLIZE}"; then 58 break; 59 fi 60done 61if [ ! ${LIBTOOLIZE} ]; then 62 echo "Missing libtoolize!" 63 exit 1 64fi 65LIBTOOLIZE_VER=`${LIBTOOLIZE} --version | ${GREP} -E "^.*[0-9]\.[0-9]" | ${SED} 's/^.* //'` 66LIBTOOLIZE_MAJOR_VER=`echo ${LIBTOOLIZE_VER} | cut -f1 -d'.'` 67 68# TODO: Check libtool version and add --install option only for 1.9b+ 69LTOPTS="--force --copy" 70if test ${LIBTOOLIZE_MAJOR_VER} -ge 2; then 71 LTOPTS="${LTOPTS} --install" 72fi 73 74echo "* Running ${LIBTOOLIZE} (${LIBTOOLIZE_VER})" 75echo " OPTIONS = ${LTOPTS}" 76${LIBTOOLIZE} ${LTOPTS} || giveup 77 78echo "* Running $ACLOCAL (${ACLOCAL_VER})" 79${ACLOCAL} -I macros || giveup 80 81echo "* Running ${AUTOCONF} (${AUTOCONF_VER})" 82${AUTOCONF} || giveup 83 84# Work around an autoconf bug insisting in having this file 85touch build-aux/config.rpath 86 87if test -f "${PWD}/configure"; then 88 echo "======================================" 89 echo "Now you are ready to run './configure'" 90 echo "======================================" 91else 92 echo " Failed to generate ./configure script!" 93 giveup 94fi 95