Commit | Line | Data |
---|---|---|
3382cd59 RS |
1 | @echo off\r |
2 | rem ----------------------------------------------------------------------\r | |
3 | rem Configuration script for MSDOS\r | |
331fdf1e RS |
4 | rem Copyright (C) 1994 Free Software Foundation, Inc.\r |
5 | \r | |
3382cd59 RS |
6 | rem This file is part of GNU Emacs.\r |
7 | \r | |
8 | rem GNU Emacs is free software; you can redistribute it and/or modify\r | |
9 | rem it under the terms of the GNU General Public License as published by\r | |
10 | rem the Free Software Foundation; either version 2, or (at your option)\r | |
11 | rem any later version.\r | |
12 | \r | |
13 | rem GNU Emacs is distributed in the hope that it will be useful,\r | |
14 | rem but WITHOUT ANY WARRANTY; without even the implied warranty of\r | |
15 | rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r | |
16 | rem GNU General Public License for more details.\r | |
17 | \r | |
18 | rem You should have received a copy of the GNU General Public License\r | |
1fb87c77 KH |
19 | rem along with GNU Emacs; see the file COPYING. If not, write to the\r |
20 | rem Free Software Foundation, Inc., 59 Temple Place - Suite 330,\r | |
21 | rem Boston, MA 02111-1307, USA.\r | |
3382cd59 RS |
22 | rem ----------------------------------------------------------------------\r |
23 | rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r | |
24 | rem\r | |
331fdf1e | 25 | rem + msdos version 3 or better.\r |
f56c5217 | 26 | rem + djgpp version 1.12maint1 or later (version 2.0 or later recommended).\r |
331fdf1e RS |
27 | rem + make utility that allows breaking of the 128 chars limit on\r |
28 | rem command lines. ndmake (as of version 4.5) won't work due to a\r | |
293e5aa6 | 29 | rem line length limit. The make that comes with djgpp does work.\r |
f56c5217 RS |
30 | rem + rm and mv (from GNU file utilities).\r |
31 | rem + sed (you can use the port that comes with DJGPP).\r | |
331fdf1e | 32 | rem\r |
f56c5217 RS |
33 | rem You should be able to get all the above utilities from any SimTel\r |
34 | rem repository, e.g. ftp.coast.net, in the directories\r | |
35 | rem "SimTel/vendors/djgpp" and "SimTel/vendors/gnu/gnuish/dos_only". As\r | |
36 | rem usual, please use your local mirroring site to reduce trans-Atlantic\r | |
37 | rem traffic.\r | |
3382cd59 | 38 | rem ----------------------------------------------------------------------\r |
ddff705b MW |
39 | set X11=\r |
40 | set nodebug=\r | |
b696f860 | 41 | set djgpp_ver=\r |
ddff705b MW |
42 | :again\r |
43 | if "%1" == "" goto usage\r | |
44 | if "%1" == "--with-x" goto withx\r | |
45 | if "%1" == "--no-debug" goto nodebug\r | |
3382cd59 RS |
46 | if "%1" == "msdos" goto msdos\r |
47 | :usage\r | |
ddff705b MW |
48 | echo Usage: config [--with-x] [--no-debug] msdos\r |
49 | echo [Read the script before you run it.]\r | |
3382cd59 RS |
50 | goto end\r |
51 | rem ----------------------------------------------------------------------\r | |
ddff705b MW |
52 | :withx\r |
53 | set X11=Y\r | |
54 | shift\r | |
55 | goto again\r | |
331fdf1e | 56 | rem ----------------------------------------------------------------------\r |
ddff705b MW |
57 | :nodebug\r |
58 | set nodebug=Y\r | |
59 | shift\r | |
60 | goto again\r | |
3382cd59 | 61 | rem ----------------------------------------------------------------------\r |
ddff705b | 62 | :msdos\r |
2f3e7987 RS |
63 | Echo Checking whether 'sed' is available...\r |
64 | sed -e "w junk.$$$" <Nul\r | |
ddff705b | 65 | If Exist junk.$$$ Goto sedOk\r |
2f3e7987 | 66 | Echo To configure 'Emacs' you need to have 'sed'!\r |
ddff705b MW |
67 | Goto End\r |
68 | :sedOk\r | |
2f3e7987 | 69 | Echo Checking whether 'rm' is available...\r |
ddff705b MW |
70 | rm -f junk.$$$\r |
71 | If Not Exist junk.$$$ Goto rmOk\r | |
2f3e7987 | 72 | Echo To configure 'Emacs' you need to have 'rm'!\r |
ddff705b MW |
73 | Goto End\r |
74 | :rmOk\r | |
2f3e7987 | 75 | Echo Checking whether 'mv' is available...\r |
ddff705b MW |
76 | rm -f junk.1 junk.2\r |
77 | echo foo >junk.1\r | |
9663837a | 78 | mv junk.1 ./junk.2\r |
ddff705b | 79 | If Exist junk.2 Goto mvOk\r |
2f3e7987 | 80 | Echo To configure 'Emacs' you need to have 'mv'!\r |
ddff705b MW |
81 | rm -f junk.1\r |
82 | Goto End\r | |
83 | :mvOk\r | |
84 | rm -f junk.2\r | |
2f3e7987 | 85 | Echo Checking whether 'gcc' is available...\r |
ddff705b MW |
86 | echo main(){} >junk.c\r |
87 | gcc -c junk.c\r | |
88 | if exist junk.o goto gccOk\r | |
2f3e7987 | 89 | Echo To configure 'Emacs' you need to have 'gcc'!\r |
ddff705b MW |
90 | rm -f junk.c\r |
91 | Goto End\r | |
92 | :gccOk\r | |
8cdaacaf | 93 | rm -f junk.c junk.o junk junk.exe\r |
f56c5217 RS |
94 | Echo Checking what version of DJGPP is installed...\r |
95 | If Not "%DJGPP%" == "" goto djgppOk\r | |
96 | Echo To compile 'Emacs' under MS-DOS you MUST have DJGPP installed!\r | |
97 | Goto End\r | |
98 | :djgppOk\r | |
99 | echo int main() >junk.c\r | |
100 | echo #ifdef __DJGPP__ >>junk.c\r | |
101 | echo {return (__DJGPP__)*10;} >>junk.c\r | |
102 | echo #else >>junk.c\r | |
103 | echo #ifdef __GO32__ >>junk.c\r | |
104 | echo {return 10;} >>junk.c\r | |
105 | echo #else >>junk.c\r | |
106 | echo {return 0;} >>junk.c\r | |
107 | echo #endif >>junk.c\r | |
108 | echo #endif >>junk.c\r | |
8cdaacaf RS |
109 | gcc -o junk junk.c\r |
110 | if not exist junk.exe coff2exe junk\r | |
f56c5217 RS |
111 | junk\r |
112 | If ErrorLevel 10 Goto go32Ok\r | |
113 | rm -f junk.c junk junk.exe\r | |
114 | Echo To compile 'Emacs' under MS-DOS you MUST have DJGPP installed!\r | |
115 | Goto End\r | |
116 | :go32Ok\r | |
b696f860 RS |
117 | set djgpp_ver=1\r |
118 | If ErrorLevel 20 set djgpp_ver=2\r | |
f56c5217 | 119 | rm -f junk.c junk junk.exe\r |
b696f860 | 120 | Echo Configuring for DJGPP Version %DJGPP_VER% ...\r |
ddff705b | 121 | Rem ----------------------------------------------------------------------\r |
3382cd59 RS |
122 | Echo Configuring the source directory...\r |
123 | cd src\r | |
3382cd59 RS |
124 | \r |
125 | rem Create "paths.h"\r | |
2f3e7987 | 126 | sed -f ../msdos/sed4.inp <paths.in >paths.tmp\r |
ddff705b MW |
127 | update paths.tmp paths.h >nul\r |
128 | rm -f paths.tmp\r | |
3382cd59 RS |
129 | \r |
130 | rem Create "config.h"\r | |
ddff705b | 131 | rm -f config.h2 config.tmp\r |
45cdceb9 | 132 | sed -e '' config.in > config.tmp\r |
331fdf1e | 133 | if "%X11%" == "" goto src4\r |
2f3e7987 | 134 | sed -f ../msdos/sed2x.inp <config.in >config.tmp\r |
331fdf1e | 135 | :src4\r |
ddff705b MW |
136 | sed -f ../msdos/sed2.inp <config.tmp >config.h2\r |
137 | update config.h2 config.h >nul\r | |
138 | rm -f config.tmp config.h2\r | |
3382cd59 RS |
139 | \r |
140 | rem On my system dir.h gets in the way. It's a VMS file so who cares.\r | |
141 | if exist dir.h ren dir.h vmsdir.h\r | |
142 | \r | |
2f3e7987 | 143 | rem Create "makefile" from "makefile.in".\r |
07402863 EZ |
144 | rm -f Makefile junk.c\r |
145 | sed -e "1,/cpp stuff/s@^# .*$@@" <Makefile.in >junk.c\r | |
b696f860 | 146 | If "%DJGPP_VER%" == "1" Goto mfV1\r |
07402863 | 147 | gcc -E junk.c | sed -f ../msdos/sed1v2.inp >Makefile\r |
f56c5217 RS |
148 | goto mfDone\r |
149 | :mfV1\r | |
07402863 | 150 | gcc -E junk.c | sed -f ../msdos/sed1.inp >Makefile\r |
f56c5217 | 151 | :mfDone\r |
dd0d2cf3 | 152 | rm -f junk.c\r |
2f3e7987 | 153 | \r |
ddff705b | 154 | if "%X11%" == "" goto src5\r |
07402863 EZ |
155 | mv Makefile makefile.tmp\r |
156 | sed -f ../msdos/sed1x.inp <makefile.tmp >Makefile\r | |
ddff705b MW |
157 | rm -f makefile.tmp\r |
158 | :src5\r | |
159 | \r | |
160 | if "%nodebug%" == "" goto src6\r | |
07402863 EZ |
161 | sed -e "/^CFLAGS *=/s/ *-g//" <Makefile >makefile.tmp\r |
162 | sed -e "/^LDFLAGS *=/s/=/=-s/" <makefile.tmp >Makefile\r | |
f56c5217 | 163 | rm -f makefile.tmp\r |
ddff705b | 164 | :src6\r |
3382cd59 RS |
165 | cd ..\r |
166 | rem ----------------------------------------------------------------------\r | |
167 | Echo Configuring the library source directory...\r | |
168 | cd lib-src\r | |
169 | rem Create "makefile" from "makefile.in".\r | |
07402863 | 170 | sed -e "1,/cpp stuff/s@^# .*$@@" <Makefile.in >junk.c\r |
2f3e7987 | 171 | gcc -E -I. -I../src junk.c | sed -e "s/^ / /" -e "/^#/d" -e "/^[ \f]*$/d" >makefile.new\r |
b696f860 | 172 | If "%DJGPP_VER%" == "2" goto libsrc-v2\r |
07402863 | 173 | sed -f ../msdos/sed3.inp <makefile.new >Makefile\r |
f56c5217 RS |
174 | Goto libsrc2\r |
175 | :libsrc-v2\r | |
07402863 | 176 | sed -f ../msdos/sed3v2.inp <makefile.new >Makefile\r |
f56c5217 | 177 | :libsrc2\r |
ddff705b | 178 | rm -f makefile.new junk.c\r |
f56c5217 | 179 | if "%nodebug%" == "" goto libsrc3\r |
07402863 EZ |
180 | sed -e "/^CFLAGS *=/s/ *-g//" <Makefile >makefile.tmp\r |
181 | sed -e "/^ALL_CFLAGS *=/s/=/= -s/" <makefile.tmp >Makefile\r | |
f56c5217 RS |
182 | rm -f makefile.tmp\r |
183 | :libsrc3\r | |
ddff705b MW |
184 | cd ..\r |
185 | rem ----------------------------------------------------------------------\r | |
186 | if "%X11%" == "" goto oldx1\r | |
187 | Echo Configuring the oldxmenu directory...\r | |
188 | cd oldxmenu\r | |
07402863 | 189 | sed -f ../msdos/sed5x.inp <Makefile.in >Makefile\r |
ddff705b | 190 | if "%nodebug%" == "" goto oldx2\r |
07402863 EZ |
191 | sed -e "/^CFLAGS *=/s/ *-g//" <Makefile >makefile.tmp\r |
192 | mv -f makefile.tmp Makefile\r | |
ddff705b | 193 | :oldx2\r |
3382cd59 | 194 | cd ..\r |
ddff705b | 195 | :oldx1\r |
3382cd59 | 196 | rem ----------------------------------------------------------------------\r |
07402863 EZ |
197 | Echo Configuring the manual directory...\r |
198 | cd man\r | |
199 | sed -f ../msdos/sed6.inp < Makefile.in > Makefile\r | |
200 | cd ..\r | |
201 | rem ----------------------------------------------------------------------\r | |
3382cd59 | 202 | Echo Configuring the main directory...\r |
809e1789 RS |
203 | If "%DJGPP_VER%" == "1" goto mainv1\r |
204 | Echo Looking for the GDB init file...\r | |
456f382c | 205 | If not Exist src\_gdbinit If Exist src\.gdbinit update src/.gdbinit src/_gdbinit\r |
809e1789 RS |
206 | If Exist src\_gdbinit goto gdbinitOk\r |
207 | Echo ERROR:\r | |
208 | Echo I cannot find the GDB init file. It was called ".gdbinit" in\r | |
209 | Echo the Emacs distribution, but was probably renamed to some other\r | |
210 | Echo name without the leading dot when you untarred the archive.\r | |
211 | Echo It should be in the "src/" subdirectory. Please make sure this\r | |
212 | Echo file exists and is called "_gdbinit" with a leading underscore.\r | |
213 | Echo Then run CONFIG.BAT again with the same arguments you did now.\r | |
214 | goto End\r | |
215 | :gdbinitOk\r | |
216 | Echo Looking for the GDB init file...found\r | |
07402863 | 217 | copy msdos\mainmake.v2 Makefile >nul\r |
809e1789 | 218 | :mainv1\r |
07402863 | 219 | If "%DJGPP_VER%" == "1" copy msdos\mainmake Makefile >nul\r |
3382cd59 RS |
220 | rem ----------------------------------------------------------------------\r |
221 | :end\r | |
331fdf1e | 222 | set X11=\r |
ddff705b | 223 | set nodebug=\r |
b696f860 | 224 | set djgpp_ver=\r |