(ex-unix-type-shell): Fix customize type.
[emacs.git] / config.bat
blob08b3d0030beb0e7db360f40008b732c223b2e43c
1 @echo off\r
2 rem   ----------------------------------------------------------------------\r
3 rem   Configuration script for MSDOS\r
4 rem   Copyright (C) 1994 Free Software Foundation, Inc.\r
5 \r
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
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
18 rem   You should have received a copy of the GNU General Public License\r
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
22 rem   ----------------------------------------------------------------------\r
23 rem   YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:\r
24 rem\r
25 rem   + msdos version 3 or better.\r
26 rem   + djgpp version 1.12maint1 or later (version 2.0 or later recommended).\r
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
29 rem     line length limit.  The make that comes with djgpp does work.\r
30 rem   + rm and mv (from GNU file utilities).\r
31 rem   + sed (you can use the port that comes with DJGPP).\r
32 rem\r
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
38 rem   ----------------------------------------------------------------------\r
39 set X11=\r
40 set nodebug=\r
41 set djgpp_ver=\r
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
46 if "%1" == "msdos" goto msdos\r
47 :usage\r
48 echo Usage: config [--with-x] [--no-debug] msdos\r
49 echo [Read the script before you run it.]\r
50 goto end\r
51 rem   ----------------------------------------------------------------------\r
52 :withx\r
53 set X11=Y\r
54 shift\r
55 goto again\r
56 rem   ----------------------------------------------------------------------\r
57 :nodebug\r
58 set nodebug=Y\r
59 shift\r
60 goto again\r
61 rem   ----------------------------------------------------------------------\r
62 :msdos\r
63 Echo Checking whether 'sed' is available...\r
64 sed -e "w junk.$$$" <Nul\r
65 If Exist junk.$$$ Goto sedOk\r
66 Echo To configure 'Emacs' you need to have 'sed'!\r
67 Goto End\r
68 :sedOk\r
69 Echo Checking whether 'rm' is available...\r
70 rm -f junk.$$$\r
71 If Not Exist junk.$$$ Goto rmOk\r
72 Echo To configure 'Emacs' you need to have 'rm'!\r
73 Goto End\r
74 :rmOk\r
75 Echo Checking whether 'mv' is available...\r
76 rm -f junk.1 junk.2\r
77 echo foo >junk.1\r
78 mv junk.1 ./junk.2\r
79 If Exist junk.2 Goto mvOk\r
80 Echo To configure 'Emacs' you need to have 'mv'!\r
81 rm -f junk.1\r
82 Goto End\r
83 :mvOk\r
84 rm -f junk.2\r
85 Echo Checking whether 'gcc' is available...\r
86 echo main(){} >junk.c\r
87 gcc -c junk.c\r
88 if exist junk.o goto gccOk\r
89 Echo To configure 'Emacs' you need to have 'gcc'!\r
90 rm -f junk.c\r
91 Goto End\r
92 :gccOk\r
93 rm -f junk.c junk.o junk junk.exe\r
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
109 gcc -o junk junk.c\r
110 if not exist junk.exe coff2exe junk\r
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
117 set djgpp_ver=1\r
118 If ErrorLevel 20 set djgpp_ver=2\r
119 rm -f junk.c junk junk.exe\r
120 Echo Configuring for DJGPP Version %DJGPP_VER% ...\r
121 Rem   ----------------------------------------------------------------------\r
122 Echo Configuring the source directory...\r
123 cd src\r
125 rem   Create "paths.h"\r
126 sed -f ../msdos/sed4.inp <paths.in >paths.tmp\r
127 update paths.tmp paths.h >nul\r
128 rm -f paths.tmp\r
130 rem   Create "config.h"\r
131 rm -f config.h2 config.tmp\r
132 sed -e '' config.in > config.tmp\r
133 if "%X11%" == "" goto src4\r
134 sed -f ../msdos/sed2x.inp <config.in >config.tmp\r
135 :src4\r
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
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
143 rem   Create "makefile" from "makefile.in".\r
144 rm -f makefile junk.c\r
145 sed -e "1,/cpp stuff/s@^# .*$@@" <makefile.in >junk.c\r
146 If "%DJGPP_VER%" == "1" Goto mfV1\r
147 gcc -E junk.c | sed -f ../msdos/sed1v2.inp >makefile\r
148 goto mfDone\r
149 :mfV1\r
150 gcc -E junk.c | sed -f ../msdos/sed1.inp >makefile\r
151 :mfDone\r
152 rm -f junk.c\r
154 if "%X11%" == "" goto src5\r
155 mv makefile makefile.tmp\r
156 sed -f ../msdos/sed1x.inp <makefile.tmp >makefile\r
157 rm -f makefile.tmp\r
158 :src5\r
160 if "%nodebug%" == "" goto src6\r
161 sed -e "/^CFLAGS *=/s/ *-g//" <makefile >makefile.tmp\r
162 sed -e "/^LDFLAGS *=/s/=/=-s/" <makefile.tmp >makefile\r
163 rm -f makefile.tmp\r
164 :src6\r
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
170 sed -e "1,/cpp stuff/s@^# .*$@@" <makefile.in >junk.c\r
171 gcc -E -I. -I../src junk.c | sed -e "s/^ /      /" -e "/^#/d" -e "/^[   \f]*$/d" >makefile.new\r
172 If "%DJGPP_VER%" == "2" goto libsrc-v2\r
173 sed -f ../msdos/sed3.inp <makefile.new >makefile\r
174 Goto libsrc2\r
175 :libsrc-v2\r
176 sed -f ../msdos/sed3v2.inp <makefile.new >makefile\r
177 :libsrc2\r
178 rm -f makefile.new junk.c\r
179 if "%nodebug%" == "" goto libsrc3\r
180 sed -e "/^CFLAGS *=/s/ *-g//" <makefile >makefile.tmp\r
181 sed -e "/^ALL_CFLAGS *=/s/=/= -s/" <makefile.tmp >makefile\r
182 rm -f makefile.tmp\r
183 :libsrc3\r
184 cd ..\r
185 rem   ----------------------------------------------------------------------\r
186 if "%X11%" == "" goto oldx1\r
187 Echo Configuring the oldxmenu directory...\r
188 cd oldxmenu\r
189 sed -f ../msdos/sed5x.inp <makefile.in >makefile\r
190 if "%nodebug%" == "" goto oldx2\r
191 sed -e "/^CFLAGS *=/s/ *-g//" <makefile >makefile.tmp\r
192 mv -f makefile.tmp makefile\r
193 :oldx2\r
194 cd ..\r
195 :oldx1\r
196 rem   ----------------------------------------------------------------------\r
197 Echo Configuring the main directory...\r
198 If "%DJGPP_VER%" == "1" goto mainv1\r
199 Echo Looking for the GDB init file...\r
200 If not Exist src\_gdbinit If Exist src\.gdbinit update src/.gdbinit src/_gdbinit\r
201 If Exist src\_gdbinit goto gdbinitOk\r
202 Echo ERROR:\r
203 Echo I cannot find the GDB init file.  It was called ".gdbinit" in\r
204 Echo the Emacs distribution, but was probably renamed to some other\r
205 Echo name without the leading dot when you untarred the archive.\r
206 Echo It should be in the "src/" subdirectory.  Please make sure this\r
207 Echo file exists and is called "_gdbinit" with a leading underscore.\r
208 Echo Then run CONFIG.BAT again with the same arguments you did now.\r
209 goto End\r
210 :gdbinitOk\r
211 Echo Looking for the GDB init file...found\r
212 copy msdos\mainmake.v2 makefile >nul\r
213 :mainv1\r
214 If "%DJGPP_VER%" == "1" copy msdos\mainmake makefile >nul\r
215 rem   ----------------------------------------------------------------------\r
216 :end\r
217 set X11=\r
218 set nodebug=\r
219 set djgpp_ver=\r