1@echo off
2::: Don't set environment variable in batch file other than autoexec.bat
3::: to avoid "Out of environment space" problem on Windows 95/98.
4::: set TMPMAKE=~tmp~.mak
5
6echo> ~tmp~.mak ####
7echo>> ~tmp~.mak conf = %0
8echo>> ~tmp~.mak $(conf:\=/): nul
9echo>> ~tmp~.mak 	@del ~setup~.mak
10echo>> ~tmp~.mak 	@-$(MAKE) -l$(MAKEFLAGS) -f $(@D)setup.mak \
11if exist pathlist.tmp del pathlist.tmp
12if exist confargs.mk del confargs.mk
13:loop
14if "%1" == "" goto :end
15if "%1" == "--prefix" goto :prefix
16if "%1" == "prefix" goto :prefix
17if "%1" == "--srcdir" goto :srcdir
18if "%1" == "srcdir" goto :srcdir
19if "%1" == "--target" goto :target
20if "%1" == "target" goto :target
21if "%1" == "--with-static-linked-ext" goto :extstatic
22if "%1" == "--program-suffix" goto :suffix
23if "%1" == "RUBY_SUFFIX" goto :suffix
24if "%1" == "--program-name" goto :installname
25if "%1" == "--install-name" goto :installname
26if "%1" == "RUBY_INSTALL_NAME" goto :installname
27if "%1" == "--so-name" goto :soname
28if "%1" == "RUBY_SO_NAME" goto :soname
29if "%1" == "--enable-install-doc" goto :enable-rdoc
30if "%1" == "--disable-install-doc" goto :disable-rdoc
31if "%1" == "--extout" goto :extout
32if "%1" == "EXTOUT" goto :extout
33if "%1" == "--with-baseruby" goto :baseruby
34if "%1" == "BASERUBY" goto :baseruby
35if "%1" == "--path" goto :path
36if "%1" == "-h" goto :help
37if "%1" == "--help" goto :help
38  echo>>confargs.tmp 	%1 \
39  shift
40goto :loop
41:srcdir
42  echo>> ~tmp~.mak 	-Dsrcdir=%2 \
43  echo>>confargs.tmp 	--srcdir=%2 \
44  shift
45  shift
46goto :loop
47:prefix
48  echo>> ~tmp~.mak 	-Dprefix=%2 \
49  echo>>confargs.tmp 	%1=%2 \
50  shift
51  shift
52goto :loop
53:suffix
54  echo>>confargs.mk !ifndef RUBY_SUFFIX
55  echo>>confargs.mk RUBY_SUFFIX = %2
56  echo>>confargs.mk !endif
57  echo>>confargs.tmp 	%1=%2 \
58  shift
59  shift
60goto :loop
61:installname
62  echo>>confargs.mk !ifndef RUBY_INSTALL_NAME
63  echo>>confargs.mk RUBY_INSTALL_NAME = %2
64  echo>>confargs.mk !endif
65  echo>>confargs.tmp 	%1=%2 \
66  shift
67  shift
68goto :loop
69:soname
70  echo>>confargs.mk !ifndef RUBY_SO_NAME
71  echo>>confargs.mk RUBY_SO_NAME = %2
72  echo>>confargs.mk !endif
73  echo>>confargs.tmp 	%1=%2 \
74  shift
75  shift
76goto :loop
77:target
78  echo>> ~tmp~.mak 	%2 \
79  echo>>confargs.tmp 	--target=%2 \
80  shift
81  shift
82goto :loop
83:extstatic
84  echo>>confargs.mk !ifndef EXTSTATIC
85  echo>>confargs.mk EXTSTATIC = static
86  echo>>confargs.mk !endif
87  echo>>confargs.tmp 	%1 \
88  shift
89goto :loop
90:enable-rdoc
91  echo>>confargs.mk !ifndef RDOCTARGET
92  echo>>confargs.mk RDOCTARGET = install-doc
93  echo>>confargs.mk !endif
94  echo>>confargs.tmp 	%1 \
95  shift
96goto :loop
97:disable-rdoc
98  echo>>confargs.mk !ifndef RDOCTARGET
99  echo>>confargs.mk RDOCTARGET = install-nodoc
100  echo>>confargs.mk !endif
101  echo>>confargs.tmp 	%1 \
102  shift
103goto :loop
104:extout
105  echo>>confargs.mk !ifndef EXTOUT
106  echo>>confargs.mk EXTOUT = %2
107  echo>>confargs.mk !endif
108  echo>>confargs.tmp 	%1=%2 \
109  shift
110  shift
111goto :loop
112:baseruby
113  echo>>confargs.mk !ifndef BASERUBY
114  echo>>confargs.mk BASERUBY = %2
115  echo>>confargs.mk !endif
116  echo>>confargs.tmp 	%1=%2 \
117  shift
118  shift
119goto :loop
120:path
121  echo>>pathlist.tmp %2;\
122  echo>>confargs.tmp 	%1=%2 \
123  shift
124  shift
125goto :loop
126:help
127  echo Configuration:
128  echo   --help                  display this help
129  echo   --srcdir=DIR            find the sources in DIR [configure dir or `..']
130  echo Installation directories:
131  echo   --prefix=PREFIX         install files in PREFIX (ignored currently)
132  echo System types:
133  echo   --target=TARGET         configure for TARGET [i386-bccwin32]
134  echo Optional Package:
135  echo   --with-baseruby=RUBY    use RUBY as baseruby [ruby]
136  echo   --with-static-linked-ext link external modules statically
137  echo   --enable-install-doc    install rdoc indexes during install
138  del *.tmp
139  del ~tmp~.mak
140goto :exit
141:end
142echo>> ~tmp~.mak 	-Dbcc32dir=$(@D)
143if not exist confargs.tmp goto :noconfargs
144    echo>>confargs.mk configure_args = \
145    type>>confargs.mk confargs.tmp
146    echo.>>confargs.mk
147    echo>>confargs.mk ####
148:noconfargs
149if not exist pathlist.tmp goto :nopathlist
150    echo>>confargs.mk pathlist = \
151    type>>confargs.mk pathlist.tmp
152    echo.>>confargs.mk
153    echo>>confargs.mk ####
154    echo>>confargs.mk PATH = $(pathlist:;=/bin;)$(PATH)
155    echo>>confargs.mk INCLUDE = $(pathlist:;=/include;)
156    echo>>confargs.mk LIB = $(pathlist:;=/lib;)
157:nopathlist
158if exist confargs.mk copy confargs.mk ~setup~.mak > nul
159type>>~setup~.mak ~tmp~.mak
160del *.tmp > nul
161del ~tmp~.mak > nul
162make -s -f ~setup~.mak
163:exit
164