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