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