config.bat 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. @echo off
  2. echo Configuring GNU libcharset for DJGPP v2.x...
  3. Rem The SmallEnv tests protect against fixed and too small size
  4. Rem of the environment in stock DOS shell.
  5. Rem Find out if NLS is wanted or not,
  6. Rem if dependency-tracking is wanted or not,
  7. Rem if caching is wanted or not
  8. Rem and where the sources are.
  9. Rem We always default to NLS support,
  10. Rem no dependency tracking
  11. Rem and to in place configuration.
  12. set ARGS=
  13. set NLS=disabled
  14. if not "%NLS%" == "disabled" goto SmallEnv
  15. set CACHING=enabled
  16. if not "%CACHING%" == "enabled" goto SmallEnv
  17. set DEPENDENCY_TRACKING=disabled
  18. if not "%DEPENDENCY_TRACKING%" == "disabled" goto SmallEnv
  19. set LIBICONV_PREFIX=disabled
  20. if not "%LIBICONV_PREFIX%" == "disabled" goto SmallEnv
  21. set LIBINTL_PREFIX=disabled
  22. if not "%LIBINTL_PREFIX%" == "disabled" goto SmallEnv
  23. set HTML=enabled
  24. if not "%HTML%" == "enabled" goto SmallEnv
  25. set XSRC=.
  26. if not "%XSRC%" == "." goto SmallEnv
  27. Rem Loop over all arguments.
  28. Rem Special arguments are: NLS, XSRC, CACHE, STATIC_LIBS, LIBICONV_PREFIX, LIBINTL_PREFIX and DEPS.
  29. Rem All other arguments are stored into ARGS.
  30. :ArgLoop
  31. if "%1" == "nls" goto NextArgument
  32. if "%1" == "NLS" goto NextArgument
  33. if "%1" == "no-nls" goto NoNLS
  34. if "%1" == "no-NLS" goto NoNLS
  35. if "%1" == "NO-NLS" goto NoNLS
  36. goto CachingOption
  37. :NoNLS
  38. if "%1" == "no-nls" set NLS=disabled
  39. if "%1" == "no-NLS" set NLS=disabled
  40. if "%1" == "NO-NLS" set NLS=disabled
  41. if not "%NLS%" == "disabled" goto SmallEnv
  42. goto NextArgument
  43. :CachingOption
  44. if "%1" == "cache" goto NextArgument
  45. if "%1" == "CACHE" goto NextArgument
  46. if "%1" == "no-cache" goto NoCaching
  47. if "%1" == "no-CACHE" goto NoCaching
  48. if "%1" == "NO-CACHE" goto NoCaching
  49. goto DependencyOption
  50. :NoCaching
  51. if "%1" == "no-cache" set CACHING=disabled
  52. if "%1" == "no-CACHE" set CACHING=disabled
  53. if "%1" == "NO-CACHE" set CACHING=disabled
  54. if not "%CACHING%" == "disabled" goto SmallEnv
  55. goto NextArgument
  56. :DependencyOption
  57. if "%1" == "no-dep" goto NextArgument
  58. if "%1" == "no-DEP" goto NextArgument
  59. if "%1" == "NO-DEP" goto NextArgument
  60. if "%1" == "dep" goto DependecyTraking
  61. if "%1" == "DEP" goto DependecyTraking
  62. goto LibiconvPrefixOption
  63. :DependecyTraking
  64. if "%1" == "dep" set DEPENDENCY_TRACKING=enabled
  65. if "%1" == "DEP" set DEPENDENCY_TRACKING=enabled
  66. if not "%DEPENDENCY_TRACKING%" == "enabled" goto SmallEnv
  67. goto NextArgument
  68. :LibiconvPrefixOption
  69. if "%1" == "no-libiconvprefix" goto NextArgument
  70. if "%1" == "no-LIBICONVPREFIX" goto NextArgument
  71. if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
  72. if "%1" == "libiconvprefix" goto WithLibiconvPrefix
  73. if "%1" == "LIBICONVPREFIX" goto WithLibiconvPrefix
  74. goto LibintlPrefixOption
  75. :WithLibiconvPrefix
  76. if "%1" == "libiconvprefix" set LIBICONV_PREFIX=enabled
  77. if "%1" == "LIBICONVPREFIX" set LIBICONV_PREFIX=enabled
  78. if not "%LIBICONV_PREFIX%" == "enabled" goto SmallEnv
  79. goto NextArgument
  80. :LibintlPrefixOption
  81. if "%1" == "no-libiconvprefix" goto NextArgument
  82. if "%1" == "no-LIBICONVPREFIX" goto NextArgument
  83. if "%1" == "NO-LIBICONVPREFIX" goto NextArgument
  84. if "%1" == "libintlprefix" goto _WithLibintlPrefix
  85. if "%1" == "LIBINTLPREFIX" goto _WithLibintlPrefix
  86. goto HTMLOption
  87. :_WithLibintlPrefix
  88. if "%1" == "libintlprefix" set LIBINTL_PREFIX=enabled
  89. if "%1" == "LIBINTLPREFIX" set LIBINTL_PREFIX=enabled
  90. if not "%LIBINTL_PREFIX%" == "enabled" goto SmallEnv
  91. :HTMLOption
  92. if "%1" == "withhtml" goto NextArgument
  93. if "%1" == "withHTML" goto NextArgument
  94. if "%1" == "WITHHTML" goto NextArgument
  95. if "%1" == "withouthtml" goto _WithoutHTML
  96. if "%1" == "withoutHTML" goto _WithoutHTML
  97. if "%1" == "WITHOUTHTML" goto _WithoutHTML
  98. goto SrcDirOption
  99. :_WithoutHTML
  100. if "%1" == "withouthtml" set HTML=disabled
  101. if "%1" == "withoutHTML" set HTML=disabled
  102. if "%1" == "WITHOUTHTML" set HTML=disabled
  103. if not "%HTML%" == "disabled" goto SmallEnv
  104. goto NextArgument
  105. :SrcDirOption
  106. echo %1 | grep -q "/"
  107. if errorlevel 1 goto CollectArgument
  108. set XSRC=%1
  109. if not "%XSRC%" == "%1" goto SmallEnv
  110. goto NextArgument
  111. :CollectArgument
  112. set _ARGS=#%ARGS%#%1#
  113. if not "%_ARGS%" == "#%ARGS%#%1#" goto SmallEnv
  114. echo %_ARGS% | grep -q "###"
  115. if errorlevel 1 set ARGS=%ARGS% %1
  116. set _ARGS=
  117. :NextArgument
  118. shift
  119. if not "%1" == "" goto ArgLoop
  120. Rem Create an arguments file for the configure script.
  121. echo --srcdir=%XSRC% > arguments
  122. if "%CACHING%" == "enabled" echo --cache-file=%XSRC%/djgpp/config.cache >> arguments
  123. if "%DEPENDENCY_TRACKING%" == "enabled" echo --enable-dependency-tracking >> arguments
  124. if "%DEPENDENCY_TRACKING%" == "disabled" echo --disable-dependency-tracking >> arguments
  125. if "%LIBICONV_PREFIX%" == "enabled" echo --with-libiconv-prefix >> arguments
  126. if "%LIBICONV_PREFIX%" == "disabled" echo --without-libiconv-prefix >> arguments
  127. if "%LIBINTL_PREFIX%" == "enabled" echo --with-libintl-prefix >> arguments
  128. if "%LIBINTL_PREFIX%" == "disabled" echo --without-libintl-prefix >> arguments
  129. if "%HTML%" == "enabled" echo --enable-html >> arguments
  130. if "%HTML%" == "disabled" echo --disable-html >> arguments
  131. if not "%ARGS%" == "" echo %ARGS% >> arguments
  132. set ARGS=
  133. set CACHING=
  134. set DEPENDENCY_TRACKING=
  135. set LIBICONV_PREFIX=
  136. set LIBINTL_PREFIX=
  137. set HTML=
  138. Rem Find out where the sources are
  139. if "%XSRC%" == "." goto InPlace
  140. :NotInPlace
  141. redir -e /dev/null update %XSRC%/configure.org ./configure
  142. test -f ./configure
  143. if errorlevel 1 update %XSRC%/configure ./configure
  144. :InPlace
  145. Rem Update configuration files
  146. echo Updating configuration scripts...
  147. test -f ./configure.org
  148. if errorlevel 1 update ./configure ./configure.org
  149. sed -f %XSRC%/djgpp/config.sed ./configure.org > configure
  150. if errorlevel 1 goto SedError
  151. Rem Make sure they have a config.site file
  152. set CONFIG_SITE=%XSRC%/djgpp/config.site
  153. if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto SmallEnv
  154. Rem Make sure crucial file names are not munged by unpacking
  155. test -f %XSRC%/config.h.in
  156. if not errorlevel 1 redir -e /dev/null mv -f %XSRC%/config.h.in %XSRC%/config.h-in
  157. test -f %XSRC%/config.h-in
  158. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/config.h %XSRC%/config.h-in
  159. test -f %XSRC%/config.h-in
  160. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/configh.in %XSRC%/config.h-in
  161. test -f %XSRC%/config.h-in
  162. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/config_h.in %XSRC%/config.h-in
  163. test -f %XSRC%/include/libcharset.h-in
  164. if not errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/libcharset.h-in %XSRC%/include/libcharset.h-in
  165. test -f %XSRC%/include/libcharset.h-in
  166. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/libcharset.h %XSRC%/include/libcharset.h-in
  167. test -f %XSRC%/include/libcharset.h-in
  168. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/libcharseth.in %XSRC%/include/libcharset.h-in
  169. test -f %XSRC%/include/libcharset.h-in
  170. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/libcharset_h.in %XSRC%/include/libcharset.h-in
  171. test -f %XSRC%/include/localcharset.h-in
  172. if not errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharset.h-in %XSRC%/include/localcharset.h-in
  173. test -f %XSRC%/include/localcharset.h-in
  174. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharset.h %XSRC%/include/localcharset.h-in
  175. test -f %XSRC%/include/localcharset.h-in
  176. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharseth.in %XSRC%/include/localcharset.h-in
  177. test -f %XSRC%/include/localcharset.h-in
  178. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharset_h.in %XSRC%/include/localcharset.h-in
  179. test -f %XSRC%/include/localcharset.h.build.in
  180. if not errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharset.h.build.in %XSRC%/include/localcharset.h-build-in
  181. test -f %XSRC%/include/localcharset.h-build-in
  182. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharset.h %XSRC%/include/localcharset.h-build-in
  183. test -f %XSRC%/include/localcharset.h-build-in
  184. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharseth.build %XSRC%/include/localcharset.h-build-in
  185. test -f %XSRC%/include/localcharset.h-build-in
  186. if errorlevel 1 redir -e /dev/null mv -f %XSRC%/include/localcharset_h.build %XSRC%/include/localcharset.h-build-in
  187. Rem This is required because DOS/Windows are case-insensitive
  188. Rem to file names, and "make install" will do nothing if Make
  189. Rem finds a file called `install'.
  190. if exist INSTALL mv -f INSTALL INSTALL.txt
  191. Rem Set SHELL to a sane default or some configure tests stop working
  192. Rem if the package is configured across partitions.
  193. if not "%SHELL%" == "" goto HomeName
  194. set SHELL=/bin/sh
  195. if not "%SHELL%" == "/bin/sh" goto SmallEnv
  196. echo No SHELL found in the environment, using default value
  197. :HomeName
  198. Rem Set HOME to a sane default so configure stops complaining.
  199. if not "%HOME%" == "" goto HostName
  200. set HOME=%XSRC%/djgpp
  201. if not "%HOME%" == "%XSRC%/djgpp" goto SmallEnv
  202. echo No HOME found in the environment, using default value
  203. :HostName
  204. Rem Set HOSTNAME so it shows in config.status
  205. if not "%HOSTNAME%" == "" goto hostdone
  206. if "%windir%" == "" goto msdos
  207. set OS=MS-Windows
  208. if not "%OS%" == "MS-Windows" goto SmallEnv
  209. goto haveos
  210. :msdos
  211. set OS=MS-DOS
  212. if not "%OS%" == "MS-DOS" goto SmallEnv
  213. :haveos
  214. if not "%USERNAME%" == "" goto haveuname
  215. if not "%USER%" == "" goto haveuser
  216. echo No USERNAME and no USER found in the environment, using default values
  217. set HOSTNAME=Unknown PC
  218. if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
  219. goto userdone
  220. :haveuser
  221. set HOSTNAME=%USER%'s PC
  222. if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
  223. goto userdone
  224. :haveuname
  225. set HOSTNAME=%USERNAME%'s PC
  226. if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
  227. :userdone
  228. set _HOSTNAME=%HOSTNAME%, %OS%
  229. if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
  230. set HOSTNAME=%_HOSTNAME%
  231. :hostdone
  232. set _HOSTNAME=
  233. set OS=
  234. Rem install-sh is required by the configure script but clashes with the
  235. Rem various Makefile install-foo targets, so we MUST have it before the
  236. Rem script runs and rename it afterwards
  237. test -f %XSRC%/install-sh
  238. if not errorlevel 1 goto NoRen0
  239. test -f %XSRC%/install-sh.sh
  240. if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
  241. :NoRen0
  242. if "%NLS%" == "disabled" goto WithoutNLS
  243. :WithNLS
  244. test -d %XSRC%/po
  245. if errorlevel 1 goto WithoutNLS
  246. Rem Check for the needed libraries and binaries.
  247. test -x /dev/env/DJDIR/bin/msgfmt.exe
  248. if not errorlevel 0 goto MissingNLSTools
  249. test -x /dev/env/DJDIR/bin/xgettext.exe
  250. if not errorlevel 0 goto MissingNLSTools
  251. test -f /dev/env/DJDIR/include/libcharset.h
  252. if not errorlevel 0 goto MissingNLSTools
  253. test -f /dev/env/DJDIR/lib/libcharset.a
  254. if not errorlevel 0 goto MissingNLSTools
  255. test -f /dev/env/DJDIR/include/iconv.h
  256. if not errorlevel 0 goto MissingNLSTools
  257. test -f /dev/env/DJDIR/lib/libiconv.a
  258. if not errorlevel 0 goto MissingNLSTools
  259. test -f /dev/env/DJDIR/include/libintl.h
  260. if not errorlevel 0 goto MissingNLSTools
  261. test -f /dev/env/DJDIR/lib/libintl.a
  262. if not errorlevel 0 goto MissingNLSTools
  263. Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
  264. redir -e /dev/null rm %XSRC%/po/*.gmo
  265. redir -e /dev/null rm %XSRC%/po/libcharset.pot
  266. redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
  267. redir -e /dev/null rm %XSRC%/po/stamp-cat-id
  268. Rem Update the arguments file for the configure script.
  269. Rem We prefer without-included-gettext because libintl.a from gettext package
  270. Rem is the only one that is garanteed to have been ported to DJGPP.
  271. echo --enable-nls --without-included-gettext >> arguments
  272. goto ConfigurePackage
  273. :MissingNLSTools
  274. echo Needed libs/tools for NLS not found. Configuring without NLS.
  275. :WithoutNLS
  276. Rem Update the arguments file for the configure script.
  277. echo --disable-nls >> arguments
  278. :ConfigurePackage
  279. echo Running the ./configure script...
  280. sh ./configure @arguments
  281. if errorlevel 1 goto CfgError
  282. rm arguments
  283. echo Done.
  284. goto End
  285. :SedError
  286. echo ./configure script editing failed!
  287. goto End
  288. :CfgError
  289. echo ./configure script exited abnormally!
  290. goto End
  291. :SmallEnv
  292. echo Your environment size is too small. Enlarge it and run me again.
  293. echo Configuration NOT done!
  294. :End
  295. test -f %XSRC%/install-sh.sh
  296. if not errorlevel 1 goto NoRen1
  297. test -f %XSRC%/install-sh
  298. if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
  299. :NoRen1
  300. set CONFIG_SITE=
  301. set HOSTNAME=
  302. set XSRC=