]> code.delx.au - gnu-emacs/blob - config.bat
With DJGPP v1.x, use `COFF2EXE' to produce JUNK.EXE test program.
[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 junk junk.exe
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 junk.c
109 if not exist junk.exe coff2exe junk
110 junk
111 If ErrorLevel 10 Goto go32Ok
112 rm -f junk.c junk junk.exe
113 Echo To compile 'Emacs' under MS-DOS you MUST have DJGPP installed!
114 Goto End
115 :go32Ok
116 set djgpp_ver=1
117 If ErrorLevel 20 set djgpp_ver=2
118 rm -f junk.c junk junk.exe
119 Echo Configuring for DJGPP Version %DJGPP_VER% ...
120 Rem ----------------------------------------------------------------------
121 Echo Configuring the source directory...
122 cd src
123
124 rem Create "paths.h"
125 sed -f ../msdos/sed4.inp <paths.in >paths.tmp
126 update paths.tmp paths.h >nul
127 rm -f paths.tmp
128
129 rem Create "config.h"
130 rm -f config.h2 config.tmp
131 cp config.in config.tmp
132 if "%X11%" == "" goto src4
133 sed -f ../msdos/sed2x.inp <config.in >config.tmp
134 :src4
135 sed -f ../msdos/sed2.inp <config.tmp >config.h2
136 update config.h2 config.h >nul
137 rm -f config.tmp config.h2
138
139 rem On my system dir.h gets in the way. It's a VMS file so who cares.
140 if exist dir.h ren dir.h vmsdir.h
141
142 rem Create "makefile" from "makefile.in".
143 rm -f makefile junk.c
144 sed -e "1,/cpp stuff/s@^# .*$@@" <makefile.in >junk.c
145 If "%DJGPP_VER%" == "1" Goto mfV1
146 gcc -E junk.c | sed -f ../msdos/sed1v2.inp >makefile
147 goto mfDone
148 :mfV1
149 gcc -E junk.c | sed -f ../msdos/sed1.inp >makefile
150 :mfDone
151 rm -f junk.c
152
153 if "%X11%" == "" goto src5
154 mv makefile makefile.tmp
155 sed -f ../msdos/sed1x.inp <makefile.tmp >makefile
156 rm -f makefile.tmp
157 :src5
158
159 if "%nodebug%" == "" goto src6
160 sed -e "/^CFLAGS *=/s/ *-g//" <makefile >makefile.tmp
161 sed -e "/^LDFLAGS *=/s/=/=-s/" <makefile.tmp >makefile
162 rm -f makefile.tmp
163 :src6
164 cd ..
165 rem ----------------------------------------------------------------------
166 Echo Configuring the library source directory...
167 cd lib-src
168 rem Create "makefile" from "makefile.in".
169 sed -e "1,/cpp stuff/s@^# .*$@@" <makefile.in >junk.c
170 gcc -E -I. -I../src junk.c | sed -e "s/^ / /" -e "/^#/d" -e "/^[ \f]*$/d" >makefile.new
171 If "%DJGPP_VER%" == "2" goto libsrc-v2
172 sed -f ../msdos/sed3.inp <makefile.new >makefile
173 Goto libsrc2
174 :libsrc-v2
175 sed -f ../msdos/sed3v2.inp <makefile.new >makefile
176 :libsrc2
177 rm -f makefile.new junk.c
178 if "%nodebug%" == "" goto libsrc3
179 sed -e "/^CFLAGS *=/s/ *-g//" <makefile >makefile.tmp
180 sed -e "/^ALL_CFLAGS *=/s/=/= -s/" <makefile.tmp >makefile
181 rm -f makefile.tmp
182 :libsrc3
183 cd ..
184 rem ----------------------------------------------------------------------
185 if "%X11%" == "" goto oldx1
186 Echo Configuring the oldxmenu directory...
187 cd oldxmenu
188 sed -f ../msdos/sed5x.inp <makefile.in >makefile
189 if "%nodebug%" == "" goto oldx2
190 sed -e "/^CFLAGS *=/s/ *-g//" <makefile >makefile.tmp
191 mv -f makefile.tmp makefile
192 :oldx2
193 cd ..
194 :oldx1
195 rem ----------------------------------------------------------------------
196 Echo Configuring the main directory...
197 If "%DJGPP_VER%" == "2" copy msdos\mainmake.v2 makefile >nul
198 If "%DJGPP_VER%" == "1" copy msdos\mainmake makefile >nul
199 rem ----------------------------------------------------------------------
200 :end
201 set X11=
202 set nodebug=
203 set djgpp_ver=