1*b725ae77Skettenis#!/bin/sh 2*b725ae77Skettenis# 3*b725ae77Skettenis# This shell script is a wrapper to the main configure script when 4*b725ae77Skettenis# configuring GDB for DJGPP. 99% of it can also be used when 5*b725ae77Skettenis# configuring other GNU programs for DJGPP. 6*b725ae77Skettenis# 7*b725ae77Skettenis#===================================================================== 8*b725ae77Skettenis# Copyright 1997,1999,2000,2001,2002,2003 Free Software Foundation, Inc. 9*b725ae77Skettenis# 10*b725ae77Skettenis# Originally written by Robert Hoehne, revised by Eli Zaretskii. 11*b725ae77Skettenis# This file is part of GDB. 12*b725ae77Skettenis# 13*b725ae77Skettenis# This program is free software; you can redistribute it and/or modify 14*b725ae77Skettenis# it under the terms of the GNU General Public License as published by 15*b725ae77Skettenis# the Free Software Foundation; either version 2 of the License, or 16*b725ae77Skettenis# (at your option) any later version. 17*b725ae77Skettenis# 18*b725ae77Skettenis# This program is distributed in the hope that it will be useful, 19*b725ae77Skettenis# but WITHOUT ANY WARRANTY; without even the implied warranty of 20*b725ae77Skettenis# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*b725ae77Skettenis# GNU General Public License for more details. 22*b725ae77Skettenis# 23*b725ae77Skettenis# You should have received a copy of the GNU General Public License 24*b725ae77Skettenis# along with this program; if not, write to the Free Software 25*b725ae77Skettenis# Foundation, Inc., 59 Temple Place - Suite 330, 26*b725ae77Skettenis# Boston, MA 02111-1307, USA. */ 27*b725ae77Skettenis#===================================================================== 28*b725ae77Skettenis# 29*b725ae77Skettenis# Call this script like the main configure script with one exception. If you 30*b725ae77Skettenis# want to pass parameters to configure, you have to pass as the first 31*b725ae77Skettenis# argument the srcdir, even when it is `.' !!!!! 32*b725ae77Skettenis# 33*b725ae77Skettenis# First, undo any CDPATH settings; they will get in our way when we 34*b725ae77Skettenis# chdir to directories. 35*b725ae77Skettenisunset CDPATH 36*b725ae77Skettenis 37*b725ae77Skettenis# Where are the sources? If you are used to having the sources 38*b725ae77Skettenis# in a separate directory and the objects in another, then set 39*b725ae77Skettenis# here the full path to the source directory and run this script 40*b725ae77Skettenis# in the directory where you want to build gdb!! 41*b725ae77Skettenis# You might give the source directory on commandline, but use 42*b725ae77Skettenis# then only forward slashes (/) in the directories. It should be 43*b725ae77Skettenis# an absolute path. 44*b725ae77Skettenis 45*b725ae77Skettenisif [ x$1 = x ]; then 46*b725ae77Skettenis srcdir=`pwd` 47*b725ae77Sketteniselse 48*b725ae77Skettenis srcdir=`cd $1 && pwd` 49*b725ae77Skettenis shift 50*b725ae77Skettenisfi 51*b725ae77Skettenis 52*b725ae77Skettenis# Make sure they don't have some file names mangled by untarring. 53*b725ae77Skettenisecho -n "Checking the unpacked distribution..." 54*b725ae77Skettenisif ( ! test -f ${srcdir}/intl/po2tblsed.in || \ 55*b725ae77Skettenis ! test -f ${srcdir}/gdb/ChangeLog.002 || \ 56*b725ae77Skettenis ! test -f ${srcdir}/readline/config.h-in ) ; then 57*b725ae77Skettenis if ( ! test -f ${srcdir}/intl/po2tblsed.in ) ; then 58*b725ae77Skettenis notfound=${srcdir}/intl/po2tblsed.in 59*b725ae77Skettenis else 60*b725ae77Skettenis if ( ! test -d ${srcdir}/gdb/testsuite/cxx) ; then 61*b725ae77Skettenis notfound=${srcdir}/gdb/ChangeLog.002 62*b725ae77Skettenis else 63*b725ae77Skettenis if ( ! test -f ${srcdir}/readline/config.h-in ) ; then 64*b725ae77Skettenis notfound=${srcdir}/readline/config.h-in 65*b725ae77Skettenis fi 66*b725ae77Skettenis fi 67*b725ae77Skettenis fi 68*b725ae77Skettenis echo " FAILED." 69*b725ae77Skettenis echo "(File $notfound was not found.)" 70*b725ae77Skettenis echo "" 71*b725ae77Skettenis echo "You MUST unpack the sources with the DJTAR command, like this:" 72*b725ae77Skettenis echo "" 73*b725ae77Skettenis echo " djtar -x -n fnchange.lst gdb-X.YZ.tar.gz" 74*b725ae77Skettenis echo "" 75*b725ae77Skettenis echo "where X.YZ is the GDB version, and fnchange.lst can be found" 76*b725ae77Skettenis echo "in the gdb/config/djgpp/ directory in the GDB distribution." 77*b725ae77Skettenis echo "" 78*b725ae77Skettenis echo "configure FAILED!" 79*b725ae77Skettenis exit 1 80*b725ae77Sketteniselse 81*b725ae77Skettenis echo " ok." 82*b725ae77Skettenisfi 83*b725ae77Skettenis 84*b725ae77Skettenis# Where is the directory with DJGPP-specific scripts? 85*b725ae77SkettenisDJGPPDIR=${srcdir}/gdb/config/djgpp 86*b725ae77Skettenis 87*b725ae77Skettenisecho "Editing configure scripts for DJGPP..." 88*b725ae77SkettenisTMPFILE="${TMPDIR-.}/cfg.tmp" 89*b725ae77Skettenis 90*b725ae77Skettenis# We need to skip the build directory if it is a subdirectory of $srcdir, 91*b725ae77Skettenis# otherwise we will have an infinite recursion on our hands... 92*b725ae77Skettenisif test "`pwd`" == "${srcdir}" ; then 93*b725ae77Skettenis SKIPDIR="" 94*b725ae77Skettenis SKIPFILES="" 95*b725ae77Sketteniselse 96*b725ae77Skettenis SKIPDIR=`pwd | sed -e "s|${srcdir}|.|"` 97*b725ae77Skettenis SKIPFILES="${SKIPDIR}/*" 98*b725ae77Skettenisfi 99*b725ae77Skettenis 100*b725ae77Skettenis# We use explicit /dev/env/DJDIR/bin/find to avoid catching 101*b725ae77Skettenis# an incompatible DOS/Windows version that might be on their PATH. 102*b725ae77Skettenisfor fix_dir in \ 103*b725ae77Skettenis `cd $srcdir && /dev/env/DJDIR/bin/find . -type d ! -ipath "${SKIPDIR}" ! -ipath "${SKIPFILES}"` 104*b725ae77Skettenisdo 105*b725ae77Skettenis if test ! -f ${fix_dir}/configure.orig ; then 106*b725ae77Skettenis if test -f ${srcdir}/${fix_dir}/configure ; then 107*b725ae77Skettenis mkdir -p ${fix_dir} 108*b725ae77Skettenis cp -p ${srcdir}/${fix_dir}/configure ${fix_dir}/configure.orig 109*b725ae77Skettenis fi 110*b725ae77Skettenis fi 111*b725ae77Skettenis if test -f ${fix_dir}/configure.orig ; then 112*b725ae77Skettenis sed -f ${DJGPPDIR}/config.sed ${fix_dir}/configure.orig > $TMPFILE 113*b725ae77Skettenis update $TMPFILE ${fix_dir}/configure 114*b725ae77Skettenis touch ./${fix_dir}/configure -r ${fix_dir}/configure.orig 115*b725ae77Skettenis rm -f $TMPFILE 116*b725ae77Skettenis fi 117*b725ae77Skettenis if test -f ${fix_dir}/INSTALL ; then 118*b725ae77Skettenis mv ${fix_dir}/INSTALL ${fix_dir}/INSTALL.txt 119*b725ae77Skettenis fi 120*b725ae77Skettenisdone 121*b725ae77Skettenis 122*b725ae77Skettenis# Now set the config shell. It is really needed, that the shell 123*b725ae77Skettenis# points to a shell with full path and also it must conatain the 124*b725ae77Skettenis# .exe suffix. I assume here, that bash is installed. If not, 125*b725ae77Skettenis# install it. Additionally, the pathname must not contain a 126*b725ae77Skettenis# drive letter, so use the /dev/x/foo format supported by versions 127*b725ae77Skettenis# of Bash 2.03 and later, and by all DJGPP programs compiled with 128*b725ae77Skettenis# v2.03 (or later) library. 129*b725ae77Skettenisexport CONFIG_SHELL=/dev/env/DJDIR/bin/sh.exe 130*b725ae77Skettenis 131*b725ae77Skettenis# force to have the ltmain.sh script to be in DOS text format, 132*b725ae77Skettenis# otherwise the resulting ltconfig script will have mixed 133*b725ae77Skettenis# (UNIX/DOS) format and is unusable with Bash ports before v2.03. 134*b725ae77Skettenisutod $srcdir/ltmain.sh 135*b725ae77Skettenis 136*b725ae77Skettenis# Give the configure script some hints: 137*b725ae77Skettenisexport LD=ld 138*b725ae77Skettenisexport NM=nm 139*b725ae77Skettenisexport CC=gcc 140*b725ae77Skettenisexport CFLAGS="-O2 -g" 141*b725ae77Skettenisexport RANLIB=ranlib 142*b725ae77Skettenisexport DEFAULT_YACC="bison -y" 143*b725ae77Skettenisexport YACC="bison -y" 144*b725ae77Skettenisexport DEFAULT_LEX=flex 145*b725ae77Skettenis# Define explicitly the .exe extension because on W95 with LFN=y 146*b725ae77Skettenis# the check might fail 147*b725ae77Skettenisexport am_cv_exeext=.exe 148*b725ae77Skettenis# ltconfig wants to compute the maximum command-line length, but 149*b725ae77Skettenis# Bash 2.04 doesn't like that (it doesn't have any limit ;-), and 150*b725ae77Skettenis# reboots the system. We know our limit in advance, so we don't 151*b725ae77Skettenis# need all that crap. Assuming that the environment size is less 152*b725ae77Skettenis# than 4KB, we can afford 12KB of command-line arguments. 153*b725ae77Skettenisexport lt_cv_sys_max_cmd_len=12288 154*b725ae77Skettenis 155*b725ae77Skettenis# The configure script needs to see the `install-sh' script, otherwise 156*b725ae77Skettenis# it decides the source installation is broken. But "make install" will 157*b725ae77Skettenis# fail on 8+3 filesystems if it finds a file `install-', since there 158*b725ae77Skettenis# are numerous "install-foo" targets in Makefile's. So we rename the 159*b725ae77Skettenis# offending file after the configure step is done. 160*b725ae77Skettenisif test ! -f ${srcdir}/install-sh ; then 161*b725ae77Skettenis if test -f ${srcdir}/install-.sh ; then 162*b725ae77Skettenis mv ${srcdir}/install-.sh ${srcdir}/install-sh 163*b725ae77Skettenis fi 164*b725ae77Skettenisfi 165*b725ae77Skettenis 166*b725ae77Skettenis# Now run the configure script while disabling some things like the NLS 167*b725ae77Skettenis# support, which is nearly impossible to be supported in the current way, 168*b725ae77Skettenis# since it relies on file names which will never work on DOS. 169*b725ae77Skettenisecho "Running the configure script..." 170*b725ae77Skettenis$srcdir/configure --srcdir="$srcdir" --prefix='${DJDIR}' \ 171*b725ae77Skettenis --disable-shared --disable-nls --verbose --enable-build-warnings=\ 172*b725ae77Skettenis-Wimplicit,-Wcomment,-Wformat,-Wparentheses,-Wpointer-arith $* 173*b725ae77Skettenis 174*b725ae77Skettenisif test -f ${srcdir}/install- ; then 175*b725ae77Skettenis mv ${srcdir}/install- ${srcdir}/install-.sh 176*b725ae77Skettenisfi 177