config.bat 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. @echo off
  2. echo Configuring GNU Texinfo for DJGPP v2.x...
  3. Rem The small_env 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, if dependency-tracking is
  6. Rem wanted or not, if cache is wanted or not, and where the sources are.
  7. set ARGS=
  8. set NLS=disabled
  9. if not "%NLS%" == "disabled" goto small_env
  10. set CACHE=enabled
  11. if not "%CACHE%" == "enabled" goto small_env
  12. set DEPTRAK=disabled
  13. if not "%DEPTRAK%" == "disabled" goto small_env
  14. set XSRC=.
  15. if not "%XSRC%" == "." goto small_env
  16. Rem Loop over all arguments.
  17. Rem Special arguments are: NLS, XSRC CACHE and DEPS.
  18. Rem All other arguments are stored into ARGS.
  19. :arg_loop
  20. set SPECARG=0
  21. if not "%SPECARG%" == "0" goto small_env
  22. if not "%1" == "NLS" if not "%1" == "nls" goto cache_opt
  23. if "%1" == "nls" set NLS=enabled
  24. if "%1" == "NLS" set NLS=enabled
  25. if not "%NLS%" == "enabled" goto small_env
  26. set SPECARG=1
  27. if not "%SPECARG%" == "1" goto small_env
  28. shift
  29. :cache_opt
  30. set SPECARG=0
  31. if not "%SPECARG%" == "0" goto small_env
  32. if "%1" == "no-cache" goto cache_off
  33. if "%1" == "no-CACHE" goto cache_off
  34. if not "%1" == "NO-CACHE" goto dependency_opt
  35. :cache_off
  36. if "%1" == "no-cache" set CACHE=disabled
  37. if "%1" == "no-CACHE" set CACHE=disabled
  38. if "%1" == "NO-CACHE" set CACHE=disabled
  39. if not "%CACHE%" == "disabled" goto small_env
  40. set SPECARG=1
  41. if not "%SPECARG%" == "1" goto small_env
  42. shift
  43. :dependency_opt
  44. set SPECARG=0
  45. if not "%SPECARG%" == "0" goto small_env
  46. if "%1" == "dep" goto dep_off
  47. if not "%1" == "DEP" goto src_dir_opt
  48. :dep_off
  49. if "%1" == "dep" set DEPTRAK=enabled
  50. if "%1" == "DEP" set DEPTRAK=enabled
  51. if not "%DEPTRAK%" == "enabled" goto small_env
  52. set SPECARG=1
  53. if not "%SPECARG%" == "1" goto small_env
  54. shift
  55. :src_dir_opt
  56. set SPECARG=0
  57. if not "%SPECARG%" == "0" goto small_env
  58. echo %1 | grep -q "/"
  59. if errorlevel 1 goto collect_arg
  60. set XSRC=%1
  61. if not "%XSRC%" == "%1" goto small_env
  62. set SPECARG=1
  63. if not "%SPECARG%" == "1" goto small_env
  64. :collect_arg
  65. if "%SPECARG%" == "0" set _ARGS=%ARGS% %1
  66. if "%SPECARG%" == "0" if not "%_ARGS%" == "%ARGS% %1" goto small_env
  67. echo %_ARGS% | grep -q "[^ ]"
  68. if not errorlevel 0 set ARGS=%_ARGS%
  69. set _ARGS=
  70. shift
  71. if not "%1" == "" goto arg_loop
  72. set SPECARG=
  73. Rem Create a response file for the configure script.
  74. echo --srcdir=%XSRC% > args
  75. if "%CACHE%" == "enabled" echo --config-cache >> args
  76. if "%DEPTRAK%" == "enabled" echo --enable-dependency-tracking >> args
  77. if "%DEPTRAK%" == "disabled" echo --disable-dependency-tracking >> args
  78. if not "%ARGS%" == "" echo %ARGS% >> args
  79. set ARGS=
  80. set CACHE=
  81. set DEPTRAK=
  82. if "%XSRC%" == "." goto in_place
  83. :not_in_place
  84. redir -e /dev/null update %XSRC%/configure.org ./configure
  85. test -f ./configure
  86. if errorlevel 1 update %XSRC%/configure ./configure
  87. :in_place
  88. Rem Update configuration files
  89. echo Updating configuration scripts...
  90. test -f ./configure.org
  91. if errorlevel 1 update configure configure.org
  92. sed -f %XSRC%/djgpp/config.sed configure.org > configure
  93. if errorlevel 1 goto sed_error
  94. Rem Make sure they have a config.site file
  95. set CONFIG_SITE=%XSRC%/djgpp/config.site
  96. if not "%CONFIG_SITE%" == "%XSRC%/djgpp/config.site" goto small_env
  97. Rem Make sure crucial file names are not munged by unpacking
  98. test -f %XSRC%/po/Makefile.in.in
  99. if not errorlevel 1 mv -f %XSRC%/po/Makefile.in.in %XSRC%/po/Makefile.in-in
  100. test -f %XSRC%/po/Makefile.am.in
  101. if not errorlevel 1 mv -f %XSRC%/po/Makefile.am.in %XSRC%/po/Makefile.am-in
  102. Rem This is required because DOS/Windows are case-insensitive
  103. Rem to file names, and "make install" will do nothing if Make
  104. Rem finds a file called `install'.
  105. if exist INSTALL ren INSTALL INSTALL.txt
  106. Rem Set HOME to a sane default so configure stops complaining.
  107. if not "%HOME%" == "" goto host_name
  108. set HOME=%XSRC%/djgpp
  109. if not "%HOME%" == "%XSRC%/djgpp" goto small_env
  110. echo No HOME found in the environment, using default value
  111. :host_name
  112. Rem Set HOSTNAME so it shows in config.status
  113. if not "%HOSTNAME%" == "" goto hostdone
  114. if "%windir%" == "" goto msdos
  115. set OS=MS-Windows
  116. if not "%OS%" == "MS-Windows" goto small_env
  117. goto haveos
  118. :msdos
  119. set OS=MS-DOS
  120. if not "%OS%" == "MS-DOS" goto small_env
  121. :haveos
  122. if not "%USERNAME%" == "" goto haveuname
  123. if not "%USER%" == "" goto haveuser
  124. echo No USERNAME and no USER found in the environment, using default values
  125. set HOSTNAME=Unknown PC
  126. if not "%HOSTNAME%" == "Unknown PC" goto small_env
  127. goto userdone
  128. :haveuser
  129. set HOSTNAME=%USER%'s PC
  130. if not "%HOSTNAME%" == "%USER%'s PC" goto small_env
  131. goto userdone
  132. :haveuname
  133. set HOSTNAME=%USERNAME%'s PC
  134. if not "%HOSTNAME%" == "%USERNAME%'s PC" goto small_env
  135. :userdone
  136. set _HOSTNAME=%HOSTNAME%, %OS%
  137. if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto small_env
  138. set HOSTNAME=%_HOSTNAME%
  139. :hostdone
  140. set _HOSTNAME=
  141. set OS=
  142. Rem install-sh is required by the configure script but clashes with the
  143. Rem various Makefile install-foo targets, so we MUST have it before the
  144. Rem script runs and rename it afterwards
  145. test -f %XSRC%/install-sh
  146. if not errorlevel 1 goto no_ren0
  147. test -f %XSRC%/install-sh.sh
  148. if not errorlevel 1 mv -f %XSRC%/install-sh.sh %XSRC%/install-sh
  149. :no_ren0
  150. if "%NLS%" == "disabled" goto without_NLS
  151. :with_NLS
  152. Rem Check for the needed libraries and binaries.
  153. test -x /dev/env/DJDIR/bin/msgfmt.exe
  154. if not errorlevel 0 goto missing_NLS_tools
  155. test -x /dev/env/DJDIR/bin/xgettext.exe
  156. if not errorlevel 0 goto missing_NLS_tools
  157. test -f /dev/env/DJDIR/include/libcharset.h
  158. if not errorlevel 0 goto missing_NLS_tools
  159. test -f /dev/env/DJDIR/lib/libcharset.a
  160. if not errorlevel 0 goto missing_NLS_tools
  161. test -f /dev/env/DJDIR/include/iconv.h
  162. if not errorlevel 0 goto missing_NLS_tools
  163. test -f /dev/env/DJDIR/lib/libiconv.a
  164. if not errorlevel 0 goto missing_NLS_tools
  165. test -f /dev/env/DJDIR/include/libintl.h
  166. if not errorlevel 0 goto missing_NLS_tools
  167. test -f /dev/env/DJDIR/lib/libintl.a
  168. if not errorlevel 0 goto missing_NLS_tools
  169. Rem Recreate the files in the %XSRC%/po subdir with our ported tools.
  170. redir -e /dev/null rm %XSRC%/po/*.gmo
  171. redir -e /dev/null rm %XSRC%/po/texinfo*.pot
  172. redir -e /dev/null rm %XSRC%/po/cat-id-tbl.c
  173. redir -e /dev/null rm %XSRC%/po/stamp-cat-id
  174. Rem Update the arguments file for the configure script.
  175. Rem We prefer without-included-gettext because libintl.a from gettext package
  176. Rem is the only one that is guaranteed to have been ported to DJGPP.
  177. echo --enable-nls --without-included-gettext >> args
  178. goto configure_package
  179. :missing_NLS_tools
  180. echo Needed libs/tools for NLS not found. Configuring without NLS.
  181. :without_NLS
  182. Rem Update the arguments file for the configure script.
  183. echo --disable-nls >> args
  184. :configure_package
  185. echo Running the ./configure script...
  186. sh ./configure @args
  187. if errorlevel 1 goto cfg_error
  188. rm args
  189. echo Done.
  190. goto End
  191. :sed_error
  192. echo ./configure script editing failed!
  193. goto End
  194. :cfg_error
  195. echo ./configure script exited abnormally!
  196. goto End
  197. :small_env
  198. echo Your environment size is too small. Enlarge it and run me again.
  199. echo Configuration NOT done!
  200. :End
  201. test -f %XSRC%/install-sh.sh
  202. if not errorlevel 1 goto no_ren1
  203. test -f %XSRC%/install-sh
  204. if not errorlevel 1 mv -f %XSRC%/install-sh %XSRC%/install-sh.sh
  205. :no_ren1
  206. if "%HOME%" == "%XSRC%/djgpp" set HOME=
  207. set ARGS=
  208. set CONFIG_SITE=
  209. set HOSTNAME=
  210. set NLS=
  211. set CACHE=
  212. set DEPTRAK=
  213. set XSRC=