config.bat 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. @echo off
  2. rem ----------------------------------------------------------------------
  3. rem Configuration script for MSDOS
  4. rem Copyright (C) 1994-1999, 2001-2017 Free Software Foundation, Inc.
  5. rem This file is part of GNU Emacs.
  6. rem GNU Emacs is free software: you can redistribute it and/or modify
  7. rem it under the terms of the GNU General Public License as published by
  8. rem the Free Software Foundation, either version 3 of the License, or
  9. rem (at your option) any later version.
  10. rem GNU Emacs is distributed in the hope that it will be useful,
  11. rem but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. rem GNU General Public License for more details.
  14. rem You should have received a copy of the GNU General Public License
  15. rem along with GNU Emacs. If not, see http://www.gnu.org/licenses/.
  16. rem ----------------------------------------------------------------------
  17. rem YOU'LL NEED THE FOLLOWING UTILITIES TO MAKE EMACS:
  18. rem
  19. rem + msdos version 3 or better.
  20. rem + DJGPP version 2.02 or later (version 2.03 or later recommended).
  21. rem + make utility that allows breaking of the 128 chars limit on
  22. rem command lines. ndmake (as of version 4.5) won't work due to a
  23. rem line length limit. The DJGPP port of make works (and is
  24. rem recommended).
  25. rem + rm, mv, and cp (from GNU file utilities).
  26. rem + sed (you can use the port that comes with DJGPP).
  27. rem
  28. rem You should be able to get all the above utilities from the DJGPP FTP
  29. rem site, ftp.delorie.com, in the directory "pub/djgpp/current/v2gnu".
  30. rem ----------------------------------------------------------------------
  31. set X11=
  32. set nodebug=
  33. set djgpp_ver=
  34. set sys_malloc=
  35. set libxml=
  36. if "%1" == "" goto usage
  37. rem ----------------------------------------------------------------------
  38. rem See if their environment is large enough. We need 28 bytes.
  39. set $foo$=789012345678901234567
  40. if not "%$foo$%" == "789012345678901234567" goto SmallEnv
  41. set $foo$=
  42. :again
  43. if "%1" == "" goto usage
  44. if "%1" == "--with-x" goto withx
  45. if "%1" == "--no-debug" goto nodebug
  46. if "%1" == "msdos" goto msdos
  47. if "%1" == "--with-system-malloc" goto sysmalloc
  48. :usage
  49. echo Usage: config [--no-debug] [--with-system-malloc] [--with-x] msdos
  50. echo [Read the script before you run it.]
  51. goto end
  52. rem ----------------------------------------------------------------------
  53. :withx
  54. set X11=Y
  55. shift
  56. goto again
  57. rem ----------------------------------------------------------------------
  58. :nodebug
  59. set nodebug=Y
  60. shift
  61. goto again
  62. rem ----------------------------------------------------------------------
  63. :sysmalloc
  64. set sys_malloc=Y
  65. shift
  66. goto again
  67. rem ----------------------------------------------------------------------
  68. :msdos
  69. Echo Checking whether 'sed' is available...
  70. sed -e "w junk.$$$" <Nul
  71. If Exist junk.$$$ Goto sedOk
  72. Echo To configure 'Emacs' you need to have 'sed'!
  73. Goto End
  74. :sedOk
  75. Echo Checking whether 'rm' is available...
  76. rm -f junk.$$$
  77. If Not Exist junk.$$$ Goto rmOk
  78. Echo To configure 'Emacs' you need to have 'rm'!
  79. Goto End
  80. :rmOk
  81. Echo Checking whether 'mv' is available...
  82. rm -f junk.1 junk.2
  83. echo foo >junk.1
  84. mv junk.1 ./junk.2
  85. If Exist junk.2 Goto mvOk
  86. Echo To configure 'Emacs' you need to have 'mv'!
  87. rm -f junk.1
  88. Goto End
  89. :mvOk
  90. rm -f junk.2
  91. Echo Checking whether 'gcc' is available...
  92. echo main(){} >junk.c
  93. gcc -c junk.c
  94. if exist junk.o goto gccOk
  95. Echo To configure 'Emacs' you need to have 'gcc'!
  96. rm -f junk.c
  97. Goto End
  98. :gccOk
  99. rm -f junk.c junk.o junk junk.exe
  100. Echo Checking what version of DJGPP is installed...
  101. If Not "%DJGPP%" == "" goto djgppOk
  102. Echo To compile 'Emacs' under MS-DOS you MUST have DJGPP installed!
  103. Goto End
  104. :djgppOk
  105. echo int main() >junk.c
  106. echo #ifdef __DJGPP__ >>junk.c
  107. echo {return (__DJGPP__)*10 + (__DJGPP_MINOR__);} >>junk.c
  108. echo #else >>junk.c
  109. echo #ifdef __GO32__ >>junk.c
  110. echo {return 10;} >>junk.c
  111. echo #else >>junk.c
  112. echo {return 0;} >>junk.c
  113. echo #endif >>junk.c
  114. echo #endif >>junk.c
  115. gcc -o junk junk.c
  116. if not exist junk.exe coff2exe junk
  117. junk
  118. If ErrorLevel 10 Goto go32Ok
  119. rm -f junk.c junk junk.exe
  120. Echo To compile 'Emacs' under MS-DOS you MUST have DJGPP installed!
  121. Goto End
  122. :go32Ok
  123. set djgpp_ver=2
  124. If Not ErrorLevel 22 Echo To build 'Emacs' you need DJGPP v2.02 or later!
  125. If Not ErrorLevel 22 Goto End
  126. rm -f junk.c junk junk.exe
  127. rem DJECHO is used by the top-level Makefile in the v2.x build
  128. Echo Checking whether 'djecho' is available...
  129. redir -o Nul -eo djecho -o junk.$$$ foo
  130. If Exist junk.$$$ Goto djechoOk
  131. Echo To build 'Emacs' you need the 'djecho.exe' program!
  132. Echo 'djecho.exe' is part of 'djdevNNN.zip' basic DJGPP development kit.
  133. Echo Either unpack 'djecho.exe' from the 'djdevNNN.zip' archive,
  134. Echo or, if you have 'echo.exe', copy it to 'djecho.exe'.
  135. Echo Then run CONFIG.BAT again with the same arguments you did now.
  136. Goto End
  137. :djechoOk
  138. rm -f junk.$$$
  139. Echo Configuring for DJGPP Version %DJGPP_VER% ...
  140. Rem ----------------------------------------------------------------------
  141. Echo Configuring the source directory...
  142. cd src
  143. rem Create "epaths.h"
  144. sed -f ../msdos/sed4.inp <epaths.in >epaths.tmp
  145. update epaths.tmp epaths.h >nul
  146. rm -f epaths.tmp
  147. rem Create "config.h"
  148. rm -f config.h2 config.tmp
  149. if exist config.in sed -e '' config.in > config.tmp
  150. if exist ..\msdos\autogen\config.in sed -e '' ../msdos/autogen/config.in > config.tmp
  151. if "%X11%" == "" goto src4
  152. if exist config.in sed -f ../msdos/sed2x.inp < config.in > config.tmp
  153. if exist ..\msdos\autogen\config.in sed -f ../msdos/sed2x.inp < ..\msdos\autogen\config.in > config.tmp
  154. :src4
  155. sed -f ../msdos/sed2v2.inp <config.tmp >config.h2
  156. Rem See if they have libxml2 later than v2.2.0 installed
  157. Echo Checking whether libxml2 v2.2.1 or later is installed ...
  158. rm -f junk.c junk.o junk junk.exe
  159. rem Use djecho here because we need to quote brackets
  160. djecho "#include <libxml/xmlversion.h>" >junk.c
  161. djecho "int main()" >>junk.c
  162. djecho "{return (LIBXML_VERSION > 20200 ? 0 : 1);}" >>junk.c
  163. redir -o Nul -eo gcc -I/dev/env/DJDIR/include/libxml2 -o junk junk.c
  164. if not exist junk Goto xmlDone
  165. if not exist junk.exe coff2exe junk
  166. junk
  167. If ErrorLevel 1 Goto xmlDone
  168. Echo Configuring with libxml2 ...
  169. sed -e "/#undef HAVE_LIBXML2/s/^.*$/#define HAVE_LIBXML2 1/" <config.h2 >config.h3
  170. sed -e "/#define EMACS_CONFIG_FEATURES/s/^.*$/#define EMACS_CONFIG_FEATURES \"LIBXML2\"/" <config.h3 >config.h2
  171. set libxml=1
  172. :xmlDone
  173. rm -f junk.c junk junk.exe
  174. Rem See if they requested a SYSTEM_MALLOC build
  175. if "%sys_malloc%" == "" Goto cfgDone
  176. rm -f config.tmp
  177. ren config.h2 config.tmp
  178. sed -f ../msdos/sedalloc.inp <config.tmp >config.h2
  179. :cfgDone
  180. rm -f junk.c junk junk.exe
  181. update config.h2 config.h >nul
  182. rm -f config.tmp config.h2
  183. rem On my system dir.h gets in the way. It's a VMS file so who cares.
  184. if exist dir.h ren dir.h vmsdir.h
  185. rem Create "makefile" from "makefile.in".
  186. rm -f Makefile makefile.tmp
  187. copy Makefile.in+deps.mk makefile.tmp
  188. sed -f ../msdos/sed1v2.inp <makefile.tmp >Makefile
  189. rm -f makefile.tmp
  190. if "%X11%" == "" goto src5
  191. mv Makefile makefile.tmp
  192. sed -f ../msdos/sed1x.inp <makefile.tmp >Makefile
  193. rm -f makefile.tmp
  194. :src5
  195. if "%sys_malloc%" == "" goto src5a
  196. sed -e "/^GMALLOC_OBJ *=/s/gmalloc.o//" <Makefile >makefile.tmp
  197. sed -e "/^VMLIMIT_OBJ *=/s/vm-limit.o//" <makefile.tmp >makefile.tmp2
  198. sed -e "/^RALLOC_OBJ *=/s/ralloc.o//" <makefile.tmp2 >Makefile
  199. rm -f makefile.tmp makefile.tmp2
  200. :src5a
  201. if "%nodebug%" == "" goto src6
  202. sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp
  203. sed -e "/^LDFLAGS *=/s/=/=-s/" <makefile.tmp >Makefile
  204. rm -f makefile.tmp
  205. :src6
  206. if "%libxml%" == "" goto src7
  207. sed -e "/^LIBXML2_LIBS *=/s/=/= -lxml2 -lz -liconv/" <Makefile >makefile.tmp
  208. sed -e "/^LIBXML2_CFLAGS *=/s|=|= -I/dev/env/DJDIR/include/libxml2|" <makefile.tmp >Makefile
  209. rm -f makefile.tmp
  210. :src7
  211. cd ..
  212. rem ----------------------------------------------------------------------
  213. Echo Configuring the library source directory...
  214. cd lib-src
  215. sed -f ../msdos/sed3v2.inp <Makefile.in >Makefile
  216. mv Makefile makefile.tmp
  217. sed -n -e "/^AC_INIT/s/[^,]*, \([^,]*\).*/@set emver=\1/p" ../configure.ac > emver.bat
  218. call emver.bat
  219. sed -e "s/@version@/%emver%/g" <makefile.tmp >Makefile
  220. if "%X11%" == "" goto libsrc2a
  221. mv Makefile makefile.tmp
  222. sed -f ../msdos/sed3x.inp <makefile.tmp >Makefile
  223. rm -f makefile.tmp
  224. :libsrc2a
  225. if "%nodebug%" == "" goto libsrc3
  226. sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp
  227. sed -e "/^ALL_CFLAGS *=/s/=/= -s/" <makefile.tmp >Makefile
  228. rm -f makefile.tmp
  229. :libsrc3
  230. cd ..
  231. rem ----------------------------------------------------------------------
  232. if "%X11%" == "" goto oldx1
  233. Echo Configuring the oldxmenu directory...
  234. cd oldxmenu
  235. sed -f ../msdos/sed5x.inp <Makefile.in >Makefile
  236. if "%nodebug%" == "" goto oldx2
  237. sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp
  238. mv -f makefile.tmp Makefile
  239. :oldx2
  240. cd ..
  241. :oldx1
  242. rem ----------------------------------------------------------------------
  243. Echo Configuring the doc directory, expect one "File not found" message...
  244. cd doc
  245. Rem Rename files like djtar on plain DOS filesystem would.
  246. If Exist emacs\emacsver.texi.in update emacs/emacsver.texi.in emacs/emacsver.in
  247. If Exist man\emacs.1.in update man/emacs.1.in man/emacs.in
  248. If Exist ..\etc\refcards\emacsver.tex.in update ../etc/refcards/emacsver.tex.in ../etc/refcards/emacsver.in
  249. Rem The two variants for lispintro below is for when the shell
  250. Rem supports long file names but DJGPP does not
  251. for %%d in (emacs lispref lispintro lispintr misc) do sed -e "s/@version@/%emver%/g" -f ../msdos/sed6.inp < %%d\Makefile.in > %%d\Makefile
  252. Rem produce emacs.1 from emacs.in
  253. If Exist man\emacs.1 goto manOk
  254. sed -e "s/@version@/%emver%/g" -e "s/@PACKAGE_BUGREPORT@/bug-gnu-emacs@gnu.org/g" < man\emacs.in > man\emacs.1
  255. :manOk
  256. cd ..
  257. rem ----------------------------------------------------------------------
  258. Echo Configuring the lib directory...
  259. If Exist build-aux\snippet\c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h
  260. cd lib
  261. Rem Rename files like djtar on plain DOS filesystem would.
  262. If Exist alloca.in.h update alloca.in.h alloca.in-h
  263. If Exist byteswap.in.h update byteswap.in.h byteswap.in-h
  264. If Exist dirent.in.h update dirent.in.h dirent.in-h
  265. If Exist errno.in.h update errno.in.h errno.in-h
  266. If Exist execinfo.in.h update execinfo.in.h execinfo.in-h
  267. If Exist fcntl.in.h update fcntl.in.h fcntl.in-h
  268. If Exist getopt.in.h update getopt.in.h getopt.in-h
  269. If Exist inttypes.in.h update inttypes.in.h inttypes.in-h
  270. If Exist stdarg.in.h update stdarg.in.h stdarg.in-h
  271. If Exist stdalign.in.h update stdalign.in.h stdalign.in-h
  272. If Exist stdbool.in.h update stdbool.in.h stdbool.in-h
  273. If Exist signal.in.h update signal.in.h signal.in-h
  274. If Exist stdalign.in.h update stdalign.in.h stdalign.in-h
  275. If Exist stddef.in.h update stddef.in.h stddef.in-h
  276. If Exist stdint.in.h update stdint.in.h stdint.in-h
  277. If Exist stdio.in.h update stdio.in.h stdio.in-h
  278. If Exist stdlib.in.h update stdlib.in.h stdlib.in-h
  279. If Exist string.in.h update string.in.h string.in-h
  280. If Exist sys_select.in.h update sys_select.in.h sys_select.in-h
  281. If Exist sys_stat.in.h update sys_stat.in.h sys_stat.in-h
  282. If Exist sys_types.in.h update sys_types.in.h sys_types.in-h
  283. If Exist sys_time.in.h update sys_time.in.h sys_time.in-h
  284. If Exist time.in.h update time.in.h time.in-h
  285. If Exist unistd.in.h update unistd.in.h unistd.in-h
  286. Rem Only repository has the msdos/autogen directory
  287. If Exist Makefile.in sed -f ../msdos/sedlibcf.inp < Makefile.in > makefile.tmp
  288. If Exist ..\msdos\autogen\Makefile.in sed -f ../msdos/sedlibcf.inp < ..\msdos\autogen\Makefile.in > makefile.tmp
  289. sed -f ../msdos/sedlibmk.inp < makefile.tmp > Makefile
  290. rm -f makefile.tmp
  291. Rem Create .Po files for new files in lib/
  292. If Not Exist deps\stamp mkdir deps
  293. for %%f in (*.c) do @call ..\msdos\depfiles.bat %%f
  294. echo deps-stamp > deps\stamp
  295. cd ..
  296. rem ----------------------------------------------------------------------
  297. Echo Configuring the lisp directory...
  298. cd lisp
  299. If Exist gnus\.dir-locals.el update gnus/.dir-locals.el gnus/_dir-locals.el
  300. sed -f ../msdos/sedlisp.inp < Makefile.in > Makefile
  301. cd ..
  302. rem ----------------------------------------------------------------------
  303. Echo Configuring the leim directory...
  304. cd leim
  305. sed -f ../msdos/sedleim.inp < Makefile.in > Makefile
  306. cd ..
  307. rem ----------------------------------------------------------------------
  308. If Not Exist admin\unidata goto noadmin
  309. Echo Configuring the admin/unidata directory...
  310. cd admin\unidata
  311. sed -f ../../msdos/sedadmin.inp < Makefile.in > Makefile
  312. Echo Configuring the admin/charsets directory...
  313. cd ..\charsets
  314. sed -f ../../msdos/sedadmin.inp < Makefile.in > Makefile
  315. Echo Configuring the admin/grammars directory...
  316. cd ..\grammars
  317. sed -f ../../msdos/sedadmin.inp < Makefile.in > Makefile
  318. cd ..\..
  319. :noadmin
  320. rem ----------------------------------------------------------------------
  321. Echo Configuring the main directory...
  322. If Exist .dir-locals.el update .dir-locals.el _dir-locals.el
  323. If Exist src\.dbxinit update src/.dbxinit src/_dbxinit
  324. Echo Looking for the GDB init file...
  325. If Exist src\.gdbinit update src/.gdbinit src/_gdbinit
  326. If Exist src\_gdbinit goto gdbinitOk
  327. Echo ERROR:
  328. Echo I cannot find the GDB init file. It was called ".gdbinit" in
  329. Echo the Emacs distribution, but was probably renamed to some other
  330. Echo name without the leading dot when you untarred the archive.
  331. Echo It should be in the "src/" subdirectory. Please make sure this
  332. Echo file exists and is called "_gdbinit" with a leading underscore.
  333. Echo Then run CONFIG.BAT again with the same arguments you did now.
  334. goto End
  335. :gdbinitOk
  336. Echo Looking for the GDB init file...found
  337. rem GNUMakefile is not appropriate for MS-DOS so move it out of the way
  338. If Exist GNUmakefile mv -f GNUmakefile GNUmakefile.unix
  339. copy msdos\mainmake.v2 Makefile >nul
  340. rem ----------------------------------------------------------------------
  341. goto End
  342. :SmallEnv
  343. echo Your environment size is too small. Please enlarge it and run me again.
  344. echo For example, type "command.com /e:2048" to have 2048 bytes available.
  345. set $foo$=
  346. :end
  347. set X11=
  348. set nodebug=
  349. set djgpp_ver=
  350. set sys_malloc=
  351. set libxml=
  352. set emver=