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