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