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