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