1#! /bin/sh 2# 3# bootstrap.sh 4# 5# Bootstrap the iODBC project so we do not need to maintain the 6# files generated by autoconf, automake and libtool 7# 8# The iODBC driver manager. 9# 10# Copyright (C) 1996-2006 by OpenLink Software <iodbc@openlinksw.com> 11# All Rights Reserved. 12# 13# This software is released under the terms of either of the following 14# licenses: 15# 16# - GNU Library General Public License (see LICENSE.LGPL) 17# - The BSD License (see LICENSE.BSD). 18# 19# Note that the only valid version of the LGPL license as far as this 20# project is concerned is the original GNU Library General Public License 21# Version 2, dated June 1991. 22# 23# While not mandated by the BSD license, any patches you make to the 24# iODBC source code may be contributed back into the iODBC project 25# at your discretion. Contributions will benefit the Open Source and 26# Data Access community as a whole. Submissions may be made at: 27# 28# http://www.iodbc.org 29# 30# 31# GNU Library Generic Public License Version 2 32# ============================================ 33# This library is free software; you can redistribute it and/or 34# modify it under the terms of the GNU Library General Public 35# License as published by the Free Software Foundation; only 36# Version 2 of the License dated June 1991. 37# 38# This library is distributed in the hope that it will be useful, 39# but WITHOUT ANY WARRANTY; without even the implied warranty of 40# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 41# Library General Public License for more details. 42# 43# You should have received a copy of the GNU Library General Public 44# License along with this library; if not, write to the Free 45# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 46# 47# 48# The BSD License 49# =============== 50# Redistribution and use in source and binary forms, with or without 51# modification, are permitted provided that the following conditions 52# are met: 53# 54# 1. Redistributions of source code must retain the above copyright 55# notice, this list of conditions and the following disclaimer. 56# 2. Redistributions in binary form must reproduce the above copyright 57# notice, this list of conditions and the following disclaimer in 58# the documentation and/or other materials provided with the 59# distribution. 60# 3. Neither the name of OpenLink Software Inc. nor the names of its 61# contributors may be used to endorse or promote products derived 62# from this software without specific prior written permission. 63# 64# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 65# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 66# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 67# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR 68# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 69# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 70# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 71# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 72# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 73# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 74# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 75# 76 77# ---------------------------------------------------------------------- 78# Globals 79# ---------------------------------------------------------------------- 80DIE=0 81ELINES=3 82 83 84# ---------------------------------------------------------------------- 85# Color settings 86# ---------------------------------------------------------------------- 87B=`tput bold 2>/dev/null` 88N=`tput sgr0 2>/dev/null` 89 90ERROR="${B}** ERROR **${N}" 91WARNING="${B}* WARNING *${N}" 92 93 94# ---------------------------------------------------------------------- 95# Functions 96# ---------------------------------------------------------------------- 97CHECK() { 98 for PROG in $* 99 do 100 VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"` 101 if test \! -z "$VERSION" 102 then 103 echo "Using $PROG $VERSION" 104 USE_PROG=$PROG 105 break 106 fi 107 done 108 109 if test -z "VERSION" 110 then 111 echo 112 echo "${ERROR} : You must have \`${B}${PROG}${N}' installed on your system." 113 echo 114 DIE=1 115 fi 116} 117 118 119CHECK_WARN() { 120 for PROG in $* 121 do 122 VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"` 123 if test \! -z "$VERSION" 124 then 125 echo "Using $PROG $VERSION" 126 USE_PROG=$PROG 127 break 128 fi 129 done 130 131 if test -z "VERSION" 132 then 133 echo 134 echo "${WARNING} : You may need \`${B}${PROG}${N}' installed on your system." 135 echo 136 fi 137} 138 139 140RUN() { 141 PROG=$1; shift 142 ARGS=$* 143 144 echo "Running ${B}${PROG}${N} ..." 145 $PROG $ARGS 2>> bootstrap.log 146 if test $? -ne 0 147 then 148 echo 149 echo "${ERROR}" 150 tail -$ELINES bootstrap.log 151 echo 152 echo "Bootstrap script aborting (see bootstrap.log for details) ..." 153 exit 1 154 fi 155} 156 157 158# 159# Check availability of build tools 160# 161echo 162echo "${B}Checking build environment${N} ..." 163 164CHECK libtoolize glibtoolize; LIBTOOLIZE=$USE_PROG 165CHECK aclocal 166CHECK autoheader 167CHECK automake 168CHECK autoconf 169CHECK_WARN gtk-config 170 171if test "$DIE" -eq 1 172then 173 echo 174 echo "Please read the ${B}README.CVS${N} file for a list of packages you need" 175 echo "to install on your system before bootstrapping this project." 176 echo 177 echo "Bootstrap script aborting ..." 178 exit 1 179fi 180 181 182# 183# Generate the build scripts 184# 185> bootstrap.log 186 187echo 188echo "${B}Generating build scripts${N} ..." 189 190RUN $LIBTOOLIZE --force --copy 191RUN aclocal -I admin 192RUN autoheader 193RUN automake --copy --add-missing 194RUN autoconf 195 196echo 197echo "Please check the ${B}INSTALL${N} and ${B}README${N} files for instructions to" 198echo "configure, build and install iODBC on your system." 199echo 200echo "Certain build targets are only enabled in maintainer mode:" 201echo 202echo " ./configure --enable-maintainer-mode ..." 203echo 204echo "Bootstrap script completed successfully." 205 206exit 0 207