1@echo off
2echo Configuring GNU Groff for DJGPP v2.x...
3
4Rem The SmallEnv tests protect against fixed and too small size
5Rem of the environment in stock DOS shell.
6
7Rem Find out where the sources are
8set XSRC=.
9if not "%XSRC%" == "." goto SmallEnv
10if "%1" == "" goto InPlace
11set XSRC=%1
12if not "%XSRC%" == "%1" goto SmallEnv
13redir -e /dev/null update %XSRC%/configure.orig ./configure
14if not exist configure update %XSRC%/configure ./configure
15
16:InPlace
17Rem Update configuration files
18echo Updating configuration scripts...
19if not exist configure.orig update configure configure.orig
20sed -f %XSRC%/arch/djgpp/config.sed configure.orig > configure
21if errorlevel 1 goto SedError
22
23Rem Make sure they have a config.site file
24set CONFIG_SITE=%XSRC%/arch/djgpp/config.site
25if not "%CONFIG_SITE%" == "%XSRC%/arch/djgpp/config.site" goto SmallEnv
26
27Rem This is required because DOS/Windows are case-insensitive
28Rem to file names, and "make install" will do nothing if Make
29Rem finds a file called `install'.
30if exist INSTALL ren INSTALL INSTALL.txt
31
32Rem Set HOSTNAME so it shows in config.status
33if not "%HOSTNAME%" == "" goto hostdone
34if "%windir%" == "" goto msdos
35set OS=MS-Windows
36if not "%OS%" == "MS-Windows" goto SmallEnv
37goto haveos
38:msdos
39set OS=MS-DOS
40if not "%OS%" == "MS-DOS" goto SmallEnv
41:haveos
42if not "%USERNAME%" == "" goto haveuname
43if not "%USER%" == "" goto haveuser
44echo No USERNAME and no USER found in the environment, using default values
45set HOSTNAME=Unknown PC
46if not "%HOSTNAME%" == "Unknown PC" goto SmallEnv
47:haveuser
48set HOSTNAME=%USER%'s PC
49if not "%HOSTNAME%" == "%USER%'s PC" goto SmallEnv
50goto userdone
51:haveuname
52set HOSTNAME=%USERNAME%'s PC
53if not "%HOSTNAME%" == "%USERNAME%'s PC" goto SmallEnv
54:userdone
55set _HOSTNAME=%HOSTNAME%, %OS%
56if not "%_HOSTNAME%" == "%HOSTNAME%, %OS%" goto SmallEnv
57set HOSTNAME=%_HOSTNAME%
58:hostdone
59set _HOSTNAME=
60set OS=
61
62Rem install-sh is required by the configure script but clashes with the
63Rem various Makefile install-foo targets, so we MUST have it before the
64Rem script runs and rename it afterwards
65test -f install-sh
66if not errorlevel 1 goto noren1
67test -f install-sh.sh
68if not errorlevel 1 mv -f install-sh.sh install-sh
69:noren1
70echo Running the ./configure script...
71sh ./configure --src=%XSRC% --disable-nls --without-x
72if errorlevel 1 goto CfgError
73test -f install-sh.sh
74if not errorlevel 1 goto noren2
75test -f install-sh
76if not errorlevel 1 mv -f install-sh install-sh.sh
77:noren2
78echo Done.
79goto End
80
81:SedError
82echo ./configure script editing failed!
83goto End
84
85:CfgError
86echo ./configure script exited abnormally!
87goto End
88
89:SmallEnv
90echo Your environment size is too small.  Enlarge it and run me again.
91echo Configuration NOT done!
92:End
93set XSRC=
94set CONFIG_SITE=
95set HOSTNAME=
96