config.bat 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. @echo off
  2. rem ----------------------------------------------------------------------
  3. rem Configuration script for MSDOS
  4. rem Copyright (C) 1994-1999, 2001-2012 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.0 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 make that comes with DJGPP does work (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;} >>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 20 Echo To build 'Emacs' you need DJGPP v2.0 or later!
  125. If Not ErrorLevel 20 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 Versions of DJGPP before 2.02 called this program 'echo.exe'.
  134. Echo Either unpack 'djecho.exe' from the 'djdevNNN.zip' archive,
  135. Echo or, if you have 'echo.exe', copy it to 'djecho.exe'.
  136. Echo Then run CONFIG.BAT again with the same arguments you did now.
  137. Goto End
  138. :djechoOk
  139. rm -f junk.$$$
  140. Echo Configuring for DJGPP Version %DJGPP_VER% ...
  141. Rem ----------------------------------------------------------------------
  142. Echo Configuring the source directory...
  143. cd src
  144. rem Create "epaths.h"
  145. sed -f ../msdos/sed4.inp <epaths.in >epaths.tmp
  146. update epaths.tmp epaths.h >nul
  147. rm -f epaths.tmp
  148. rem Create "config.h"
  149. rm -f config.h2 config.tmp
  150. if exist config.in sed -e '' config.in > config.tmp
  151. if exist ..\autogen\config.in sed -e '' ../autogen/config.in > config.tmp
  152. if "%X11%" == "" goto src4
  153. if exist config.in sed -f ../msdos/sed2x.inp < config.in > config.tmp
  154. if exist ..\autogen\config.in sed -f ../msdos/sed2x.inp < ..\autogen\config.in > config.tmp
  155. :src4
  156. sed -f ../msdos/sed2v2.inp <config.tmp >config.h2
  157. Rem See if DECL_ALIGN can be supported with this GCC
  158. rm -f junk.c junk.o junk junk.exe
  159. echo struct { int i; char *p; } __attribute__((__aligned__(8))) foo; >junk.c
  160. rem Two percent signs because it is a special character for COMMAND.COM/CMD
  161. rem Filter thru Sed because "&" is special for CMD.EXE
  162. echo int main(void) { return (unsigned long)"&"foo %% 8; } | sed "s/.&./\&/" >>junk.c
  163. gcc -o junk junk.c
  164. if not exist junk.exe coff2exe junk
  165. junk
  166. If Not ErrorLevel 1 Goto alignOk
  167. Echo WARNING: Your GCC does not support 8-byte aligned variables.
  168. Echo WARNING: Therefore Emacs cannot support buffers larger than 128MB.
  169. rem The following line disables DECL_ALIGN which in turn disables USE_LSB_TAG
  170. rem For details see lisp.h where it defines USE_LSB_TAG
  171. echo #define NO_DECL_ALIGN >>config.h2
  172. :alignOk
  173. Rem See if they have libxml2 later than v2.2.0 installed
  174. Echo Checking whether libxml2 v2.2.1 or later is installed ...
  175. rm -f junk.c junk.o junk junk.exe
  176. rem Use djecho here because we need to quote brackets
  177. djecho "#include <libxml/xmlversion.h>" >junk.c
  178. djecho "int main()" >>junk.c
  179. djecho "{return (LIBXML_VERSION > 20200 ? 0 : 1);}" >>junk.c
  180. redir -o Nul -eo gcc -I/dev/env/DJDIR/include/libxml2 -o junk junk.c
  181. if not exist junk Goto xmlDone
  182. if not exist junk.exe coff2exe junk
  183. junk
  184. If ErrorLevel 1 Goto xmlDone
  185. Echo Configuring with libxml2 ...
  186. sed -e "/#undef HAVE_LIBXML2/s/^.*$/#define HAVE_LIBXML2 1/" <config.h2 >config.h3
  187. mv config.h3 config.h2
  188. set libxml=1
  189. :xmlDone
  190. rm -f junk.c junk junk.exe
  191. Rem See if they requested a SYSTEM_MALLOC build
  192. if "%sys_malloc%" == "" Goto cfgDone
  193. rm -f config.tmp
  194. ren config.h2 config.tmp
  195. sed -f ../msdos/sedalloc.inp <config.tmp >config.h2
  196. :cfgDone
  197. rm -f junk.c junk junk.exe
  198. update config.h2 config.h >nul
  199. rm -f config.tmp config.h2
  200. rem On my system dir.h gets in the way. It's a VMS file so who cares.
  201. if exist dir.h ren dir.h vmsdir.h
  202. rem Create "makefile" from "makefile.in".
  203. rm -f Makefile makefile.tmp
  204. copy Makefile.in+lisp.mk+deps.mk makefile.tmp
  205. sed -f ../msdos/sed1v2.inp <makefile.tmp >Makefile
  206. rm -f makefile.tmp
  207. if "%X11%" == "" goto src5
  208. mv Makefile makefile.tmp
  209. sed -f ../msdos/sed1x.inp <makefile.tmp >Makefile
  210. rm -f makefile.tmp
  211. :src5
  212. if "%sys_malloc%" == "" goto src5a
  213. sed -e "/^GMALLOC_OBJ *=/s/gmalloc.o//" <Makefile >makefile.tmp
  214. sed -e "/^VMLIMIT_OBJ *=/s/vm-limit.o//" <makefile.tmp >makefile.tmp2
  215. sed -e "/^RALLOC_OBJ *=/s/ralloc.o//" <makefile.tmp2 >Makefile
  216. rm -f makefile.tmp makefile.tmp2
  217. :src5a
  218. if "%nodebug%" == "" goto src6
  219. sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp
  220. sed -e "/^LDFLAGS *=/s/=/=-s/" <makefile.tmp >Makefile
  221. rm -f makefile.tmp
  222. :src6
  223. if "%libxml%" == "" goto src7
  224. sed -e "/^LIBXML2_LIBS *=/s/=/= -lxml2 -lz -liconv/" <Makefile >makefile.tmp
  225. sed -e "/^LIBXML2_CFLAGS *=/s|=|= -I/dev/env/DJDIR/include/libxml2|" <makefile.tmp >Makefile
  226. rm -f makefile.tmp
  227. :src7
  228. cd ..
  229. rem ----------------------------------------------------------------------
  230. Echo Configuring the library source directory...
  231. cd lib-src
  232. sed -f ../msdos/sed3v2.inp <Makefile.in >Makefile
  233. if "%X11%" == "" goto libsrc2a
  234. mv Makefile makefile.tmp
  235. sed -f ../msdos/sed3x.inp <makefile.tmp >Makefile
  236. rm -f makefile.tmp
  237. :libsrc2a
  238. if "%nodebug%" == "" goto libsrc3
  239. sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp
  240. sed -e "/^ALL_CFLAGS *=/s/=/= -s/" <makefile.tmp >Makefile
  241. rm -f makefile.tmp
  242. :libsrc3
  243. cd ..
  244. rem ----------------------------------------------------------------------
  245. if "%X11%" == "" goto oldx1
  246. Echo Configuring the oldxmenu directory...
  247. cd oldxmenu
  248. sed -f ../msdos/sed5x.inp <Makefile.in >Makefile
  249. if "%nodebug%" == "" goto oldx2
  250. sed -e "/^CFLAGS *=/s/ *-gcoff//" <Makefile >makefile.tmp
  251. mv -f makefile.tmp Makefile
  252. :oldx2
  253. cd ..
  254. :oldx1
  255. rem ----------------------------------------------------------------------
  256. Echo Configuring the doc directory, expect one "File not found" message...
  257. cd doc
  258. Rem The two variants for lispintro below is for when the shell
  259. Rem supports long file names but DJGPP does not
  260. for %%d in (emacs lispref lispintro lispintr misc) do sed -f ../msdos/sed6.inp < %%d\Makefile.in > %%d\Makefile
  261. cd ..
  262. rem ----------------------------------------------------------------------
  263. Echo Configuring the lib directory...
  264. If Exist build-aux\snippet\c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h
  265. cd lib
  266. Rem Rename files like djtar on plain DOS filesystem would.
  267. If Exist build-aux\snippet\c++defs.h update build-aux/snippet/c++defs.h build-aux/snippet/cxxdefs.h
  268. If Exist alloca.in.h update alloca.in.h alloca.in-h
  269. If Exist getopt.in.h update getopt.in.h getopt.in-h
  270. If Exist stdbool.in.h update stdbool.in.h stdbool.in-h
  271. If Exist signal.in.h update signal.in.h signal.in-h
  272. If Exist stddef.in.h update stddef.in.h stddef.in-h
  273. If Exist stdint.in.h update stdint.in.h stdint.in-h
  274. If Exist stdio.in.h update stdio.in.h stdio.in-h
  275. If Exist stdlib.in.h update stdlib.in.h stdlib.in-h
  276. If Exist sys_stat.in.h update sys_stat.in.h sys_stat.in-h
  277. If Exist time.in.h update time.in.h time.in-h
  278. If Exist unistd.in.h update unistd.in.h unistd.in-h
  279. If Exist Makefile.in sed -f ../msdos/sedlibcf.inp < Makefile.in > makefile.tmp
  280. If Exist ..\autogen\Makefile.in sed -f ../msdos/sedlibcf.inp < ..\autogen\Makefile.in > makefile.tmp
  281. sed -f ../msdos/sedlibmk.inp < makefile.tmp > Makefile
  282. rm -f makefile.tmp
  283. Rem Create .Po files for new files in lib/
  284. If Not Exist deps\stamp mkdir deps
  285. for %%f in (*.c) do @call ..\msdos\depfiles.bat %%f
  286. echo deps-stamp > deps\stamp
  287. cd ..
  288. rem ----------------------------------------------------------------------
  289. Echo Configuring the lisp directory...
  290. cd lisp
  291. If Exist gnus\.dir-locals.el update gnus/.dir-locals.el gnus/_dir-locals.el
  292. sed -f ../msdos/sedlisp.inp < Makefile.in > Makefile
  293. cd ..
  294. rem ----------------------------------------------------------------------
  295. If not Exist leim\quail\latin-pre.el goto maindir
  296. Echo Configuring the leim directory...
  297. cd leim
  298. sed -f ../msdos/sedleim.inp < Makefile.in > Makefile
  299. cd ..
  300. rem ----------------------------------------------------------------------
  301. :maindir
  302. Echo Configuring the main directory...
  303. If Exist .dir-locals.el update .dir-locals.el _dir-locals.el
  304. If Exist src\.dbxinit update src/.dbxinit src/_dbxinit
  305. Echo Looking for the GDB init file...
  306. If Exist src\.gdbinit update src/.gdbinit src/_gdbinit
  307. If Exist src\_gdbinit goto gdbinitOk
  308. Echo ERROR:
  309. Echo I cannot find the GDB init file. It was called ".gdbinit" in
  310. Echo the Emacs distribution, but was probably renamed to some other
  311. Echo name without the leading dot when you untarred the archive.
  312. Echo It should be in the "src/" subdirectory. Please make sure this
  313. Echo file exists and is called "_gdbinit" with a leading underscore.
  314. Echo Then run CONFIG.BAT again with the same arguments you did now.
  315. goto End
  316. :gdbinitOk
  317. Echo Looking for the GDB init file...found
  318. rem GNUMakefile is not appropriate for MS-DOS so move it out of the way
  319. If Exist GNUmakefile mv -f GNUmakefile GNUmakefile.unix
  320. copy msdos\mainmake.v2 Makefile >nul
  321. rem ----------------------------------------------------------------------
  322. goto End
  323. :SmallEnv
  324. echo Your environment size is too small. Please enlarge it and run me again.
  325. echo For example, type "command.com /e:2048" to have 2048 bytes available.
  326. set $foo$=
  327. :end
  328. set X11=
  329. set nodebug=
  330. set djgpp_ver=
  331. set sys_malloc=
  332. set libxml=