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