Commit | Line | Data |
---|---|---|
ded59a1e EZ |
1 | #!/bin/sh |
2 | # | |
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 | # | |
7 | # Originally written by Robert Hoehne, revised by Eli Zaretskii. | |
8 | # | |
9 | # Call it like the main configure script with one exception. If you | |
10 | # want to pass parameters to configure, you have to pass as the first | |
11 | # argument the srcdir, even when it is `.' !!!!! | |
12 | ||
13 | # Where are the sources? If you are used to having the sources | |
14 | # in a separate directory and the objects in another, then set | |
15 | # here the full path to the source directory and run this script | |
16 | # in the directory where you want to build gdb!! | |
17 | # You might give the source directory on commandline, but use | |
18 | # then only forward slashes (/) in the directories. It should be | |
19 | # an absolute path. | |
20 | ||
21 | if [ x$1 = x ]; then | |
22 | srcdir=`pwd` | |
23 | else | |
24 | srcdir=`cd $1 && pwd` | |
25 | shift | |
26 | fi | |
27 | ||
28 | # Make sure they don't have some file names mangled by untarring. | |
29 | echo -n "Checking the unpacked distribution..." | |
30 | if ( ! test -f ${srcdir}/intl/po2tblsed.in || \ | |
31 | ! test -d ${srcdir}/gdb/testsuite/gdb.cxx || \ | |
32 | ! test -f ${srcdir}/readline/config.h-in ) ; then | |
33 | echo " FAILED." | |
34 | echo "" | |
35 | echo "You MUST unpack the sources with the DJTAR command, like this:" | |
36 | echo "" | |
37 | echo " djtar -x -n fnchange.lst gdb-X.YZ.tar.gz" | |
38 | echo "" | |
39 | echo "where X.YZ is the GDB version, and fnchange.lst can be found" | |
40 | echo "in the gdb/config/djgpp/ directory in the GDB distribution." | |
41 | echo "configure FAILED!" | |
42 | exit 1 | |
43 | else | |
44 | echo " ok." | |
45 | fi | |
46 | ||
47 | # Where is the directory with DJGPP-specific scripts? | |
48 | DJGPPDIR=${srcdir}/gdb/config/djgpp | |
49 | ||
50 | echo "Editing configure scripts for DJGPP..." | |
51 | TMPFILE="${TMPDIR-.}/cfg.tmp" | |
52 | ||
53 | # We need to skip the build directory if it is a subdirectory of $srcdir, | |
54 | # otherwise we will have an infinite recursion on our hands... | |
55 | if test "`pwd`" == "${srcdir}" ; then | |
56 | SKIPDIR="" | |
57 | SKIPFILES="" | |
58 | else | |
59 | SKIPDIR=`pwd | sed -e "s|${srcdir}|.|"` | |
60 | SKIPFILES="${SKIPDIR}/*" | |
61 | fi | |
619cbaf7 EZ |
62 | |
63 | # We use explicit /dev/env/DJDIR/bin/find to avoid catching | |
64 | # an incompatible DOS/Windows version that might be on their PATH. | |
ded59a1e | 65 | for fix_dir in \ |
619cbaf7 | 66 | `cd $srcdir && /dev/env/DJDIR/bin/find . -type d ! -ipath "${SKIPDIR}" ! -ipath "${SKIPFILES}"` |
ded59a1e EZ |
67 | do |
68 | if test ! -f ${fix_dir}/configure.orig ; then | |
69 | if test -f ${srcdir}/${fix_dir}/configure ; then | |
70 | mkdir -p ${fix_dir} | |
71 | cp -p ${srcdir}/${fix_dir}/configure ${fix_dir}/configure.orig | |
72 | fi | |
73 | fi | |
74 | if test -f ${fix_dir}/configure.orig ; then | |
75 | sed -f ${DJGPPDIR}/config.sed ${fix_dir}/configure.orig > $TMPFILE | |
76 | update $TMPFILE ${fix_dir}/configure | |
77 | touch ./${fix_dir}/configure -r ${fix_dir}/configure.orig | |
78 | rm -f $TMPFILE | |
79 | fi | |
80 | if test -f ${fix_dir}/INSTALL ; then | |
81 | mv ${fix_dir}/INSTALL ${fix_dir}/INSTALL.txt | |
82 | fi | |
83 | done | |
84 | ||
85 | # Now set the config shell. It is really needed, that the shell | |
86 | # points to a shell with full path and also it must conatain the | |
87 | # .exe suffix. I assume here, that bash is installed. If not, | |
88 | # install it. Additionally, the pathname must not contain a | |
89 | # drive letter, so use the /dev/x/foo format supported by versions | |
90 | # of Bash 2.03 and later, and by all DJGPP programs compiled with | |
91 | # v2.03 (or later) library. | |
92 | export CONFIG_SHELL=/dev/env/DJDIR/bin/sh.exe | |
93 | ||
94 | # force to have the ltmain.sh script to be in DOS text format, | |
95 | # otherwise the resulting ltconfig script will have mixed | |
96 | # (UNIX/DOS) format and is unusable with Bash ports before v2.03. | |
97 | utod $srcdir/ltmain.sh | |
98 | ||
99 | # Give the configure script some hints: | |
100 | export LD=ld | |
101 | export CC=gcc | |
102 | export RANLIB=ranlib | |
103 | export DEFAULT_YACC="bison -y" | |
104 | export YACC="bison -y" | |
105 | export DEFAULT_LEX=flex | |
106 | # Define explicitly the .exe extension because on W95 with LFN=y | |
107 | # the check might fail | |
108 | export am_cv_exeext=.exe | |
109 | ||
110 | # The configure script needs to see the `install-sh' script, otherwise | |
111 | # it decides the source installation is broken. But "make install" will | |
112 | # fail on 8+3 filesystems if it finds a file `install-', since there | |
113 | # are numerous "install-foo" targets in Makefile's. So we rename the | |
114 | # offending file after the configure step is done. | |
115 | if test ! -f ${srcdir}/install-sh ; then | |
116 | if test -f ${srcdir}/install-.sh ; then | |
117 | mv ${srcdir}/install-.sh ${srcdir}/install-sh | |
118 | fi | |
119 | fi | |
120 | ||
121 | # Now run the configure script while disabling some things like the NLS | |
122 | # support, which is nearly impossible to be supported in the current way, | |
123 | # since it relies on file names which will never work on DOS. | |
124 | echo "Running the configure script..." | |
125 | $srcdir/configure --srcdir="$srcdir" --prefix='${DJDIR}' \ | |
ed0a91a5 EZ |
126 | --disable-shared --disable-nls --verbose --enable-build-warnings=\ |
127 | -Wimplicit,-Wcomment,-Wformat,-Wparentheses,-Wpointer-arith $* | |
ded59a1e EZ |
128 | |
129 | if test -f ${srcdir}/install- ; then | |
130 | mv ${srcdir}/install- ${srcdir}/install-.sh | |
131 | fi |