@@ -19,8 +19,7 @@ call set "WIN32DIR=%%WIN32DIR:/%~n0:/:=:/:%%"
1919set " WIN32DIR = %WIN32DIR:~0 ,-3 % "
2020
2121set configure = %~0
22- set XINCFLAGS =
23- set XLDFLAGS =
22+ set optdirs =
2423set pathlist =
2524set config_make = confargs~%RANDOM% .mak
2625set confargs = %config_make:.mak =.sub %
@@ -44,97 +43,97 @@ for /f "delims== tokens=1,*" %%I in ("%~1") do ((set "opt=%%I") && (set "arg=%%J
4443 set " debug_configure = "
4544 goto :loop ;
4645 )
47- if " %opt% " == " --prefix" goto :dir
48- if " %opt% " == " srcdir" set " opt = --srcdir"
49- if " %opt% " == " --srcdir" goto :dir
50- if " %opt% " == " --target" goto :target
51- if " %opt% " == " target" goto :target
52- if " %opt:~0 ,10 % " == " --program-" goto :program_name
53- if " %opt% " == " --install-name" (set " var=RUBY_INSTALL_NAME" & goto :name)
54- if " %opt% " == " --so-name" (set " var=RUBY_SO_NAME" & goto :name)
46+ if " %opt% " == " --prefix" goto :dir
47+ if " %opt% " == " srcdir" set " opt = --srcdir"
48+ if " %opt% " == " --srcdir" goto :dir
49+ if " %opt% " == " --target" goto :target
50+ if " %opt% " == " target" goto :target
51+ if " %opt:~0 ,10 % " == " --program-" goto :program_name
52+ if " %opt% " == " --install-name" (set " var=RUBY_INSTALL_NAME" & goto :name)
53+ if " %opt% " == " --so-name" (set " var=RUBY_SO_NAME" & goto :name)
5554 if " %opt% " == " --extout" goto :extout
5655 if " %opt% " == " --path" goto :path
57- if " %opt:~0 ,9 % " == " --enable-" (set " enable=yes" & goto :enable)
58- if " %opt:~0 ,10 % " == " --disable-" (set " enable=no" & goto :enable)
59- if " %opt:~0 ,10 % " == " --without-" goto :withoutarg
60- if " %opt:~0 ,7 % " == " --with-" goto :witharg
61- if " %opt% " == " -h" goto :help
62- if " %opt% " == " --help" goto :help
63- if " %opt:~0 ,1 % " == " -" (
64- goto :unknown_opt
65- )
66- if " %eq% " == " =" (
67- set " var = %opt% "
68- goto :name
69- )
70- set " eq = ="
71- :target
72- if " %eq% " == " " (set " arg=%~1 " & shift)
73- echo>> %config_make% target = %arg%
74- echo>> %confargs% " --target=%arg:$ =$$ % " \
75- if " %arg% " == " x64-mswin64" (
76- echo>> %config_make% TARGET_OS = mswin64
77- )
78- goto :loop
79- :program_name
80- if " %eq% " == " " (set " arg=%~1 " & shift)
81- for /f " delims=- tokens=1,*" %I in ("% opt%") do set "var=%%J "
82- if " %var% " == " prefix" (set " var=PROGRAM_PREFIX" & goto :name)
83- if " %var% " == " suffix" (set " var=PROGRAM_SUFFIX" & goto :name)
84- if " %var% " == " name" (set " var=RUBY_INSTALL_NAME" & goto :name)
85- if " %var% " == " transform-name" (
86- echo .1>& 2 %configure% : --program-transform-name option is not supported
87- exit /b 1
88- )
89- goto :unknown_opt
90- :name
91- if " %eq% " == " " (set " arg=%~1 " & shift)
92- echo>> %config_make% %var% = %arg%
93- echo>> %confargs% " %opt% =%arg:$ =$$ % " \
94- goto :loop ;
95- :dir
96- if " %eq% " == " " (set " arg=%~1 " & shift)
97- echo>> %config_make% %opt:~2 % = %arg:\ =/ %
98- echo>> %confargs% " %opt% =%arg:$ =$$ % " \
99- goto :loop ;
100- :enable
101- echo>> %confargs% " %opt% " \
102- if %enable% == yes (set " opt=%opt:~9 % " ) else (set " opt=%opt:~10 % " )
103- if " %opt% " == " rdoc" (
104- echo>> %config_make% RDOCTARGET = %enable:yes =r % doc
105- )
106- if " %opt% " == " install-static-library" (
107- echo>> %config_make% INSTALL_STATIC_LIBRARY = %enable%
108- )
109- if " %opt% " == " debug-env" (
110- echo>> %config_make% ENABLE_DEBUG_ENV = %enable%
111- )
112- if " %opt% " == " devel" (
113- echo>> %config_make% RUBY_DEVEL = %enable%
114- )
115- if " %opt% " == " rubygems" (
116- echo>> %config_make% USE_RUBYGEMS = %enable%
117- )
118- goto :loop ;
119- :withoutarg
120- echo>> %confargs% " %opt% " \
56+ if " %opt:~0 ,9 % " == " --enable-" (set " enable=yes" & goto :enable)
57+ if " %opt:~0 ,10 % " == " --disable-" (set " enable=no" & goto :enable)
58+ if " %opt:~0 ,10 % " == " --without-" goto :withoutarg
59+ if " %opt:~0 ,7 % " == " --with-" goto :witharg
60+ if " %opt% " == " -h" goto :help
61+ if " %opt% " == " --help" goto :help
62+ if " %opt:~0 ,1 % " == " -" (
63+ goto :unknown_opt
64+ )
65+ if " %eq% " == " =" (
66+ set " var = %opt% "
67+ goto :name
68+ )
69+ set " eq = ="
70+ :target
71+ if " %eq% " == " " (set " arg=%~1 " & shift)
72+ echo>> %config_make% target = %arg%
73+ echo>> %confargs% " --target=%arg:$ =$$ % " \
74+ if " %arg% " == " x64-mswin64" (
75+ echo>> %config_make% TARGET_OS = mswin64
76+ )
77+ goto :loop
78+ :program_name
79+ if " %eq% " == " " (set " arg=%~1 " & shift)
80+ for /f " delims=- tokens=1,*" %I in ("% opt%") do set "var=%%J "
81+ if " %var% " == " prefix" (set " var=PROGRAM_PREFIX" & goto :name)
82+ if " %var% " == " suffix" (set " var=PROGRAM_SUFFIX" & goto :name)
83+ if " %var% " == " name" (set " var=RUBY_INSTALL_NAME" & goto :name)
84+ if " %var% " == " transform-name" (
85+ echo .1>& 2 %configure% : --program-transform-name option is not supported
86+ exit /b 1
87+ )
88+ goto :unknown_opt
89+ :name
90+ if " %eq% " == " " (set " arg=%~1 " & shift)
91+ echo>> %config_make% %var% = %arg%
92+ echo>> %confargs% " %opt% =%arg:$ =$$ % " \
93+ goto :loop ;
94+ :dir
95+ if " %eq% " == " " (set " arg=%~1 " & shift)
96+ echo>> %config_make% %opt:~2 % = %arg:\ =/ %
97+ echo>> %confargs% " %opt% =%arg:$ =$$ % " \
98+ goto :loop ;
99+ :enable
100+ echo>> %confargs% " %opt% " \
101+ if %enable% == yes (set " opt=%opt:~9 % " ) else (set " opt=%opt:~10 % " )
102+ if " %opt% " == " rdoc" (
103+ echo>> %config_make% RDOCTARGET = %enable:yes =r % doc
104+ )
105+ if " %opt% " == " install-static-library" (
106+ echo>> %config_make% INSTALL_STATIC_LIBRARY = %enable%
107+ )
108+ if " %opt% " == " debug-env" (
109+ echo>> %config_make% ENABLE_DEBUG_ENV = %enable%
110+ )
111+ if " %opt% " == " devel" (
112+ echo>> %config_make% RUBY_DEVEL = %enable%
113+ )
114+ if " %opt% " == " rubygems" (
115+ echo>> %config_make% USE_RUBYGEMS = %enable%
116+ )
117+ goto :loop ;
118+ :withoutarg
119+ echo>> %confargs% " %opt% " \
121120 if " %opt% " == " --without-baseruby" goto :nobaseruby
122121 if " %opt% " == " --without-git" goto :nogit
123122 if " %opt% " == " --without-ext" goto :witharg
124123 if " %opt% " == " --without-extensions" goto :witharg
125- goto :loop ;
126- :witharg
127- if " %opt% " == " --with-static-linked-ext" goto :extstatic
128- if " %eq% " == " " (set " arg=%~1 " & shift)
129- echo>> %confargs% " %opt% =%arg:$ =$$ % " \
130- if " %opt% " == " --with-baseruby" goto :baseruby
131- if " %opt% " == " --with-ntver" goto :ntver
132- if " %opt% " == " --with-libdir" goto :libdir
133- if " %opt% " == " --with-git" goto :git
124+ goto :loop ;
125+ :witharg
126+ if " %opt% " == " --with-static-linked-ext" goto :extstatic
127+ if " %eq% " == " " (set " arg=%~1 " & shift)
128+ echo>> %confargs% " %opt% =%arg:$ =$$ % " \
129+ if " %opt% " == " --with-baseruby" goto :baseruby
130+ if " %opt% " == " --with-ntver" goto :ntver
131+ if " %opt% " == " --with-libdir" goto :libdir
132+ if " %opt% " == " --with-git" goto :git
134133 if " %opt% " == " --with-opt-dir" goto :opt-dir
135- if " %opt% " == " --with-gmp-dir" goto :opt-dir
134+ if " %opt% " == " --with-gmp-dir" goto :opt-dir
136135 if " %opt% " == " --with-gmp" goto :gmp
137- if " %opt% " == " --with-destdir" goto :destdir
136+ if " %opt% " == " --with-destdir" goto :destdir
138137goto :loop ;
139138:ntver
140139 :: - For version constants, see
@@ -156,14 +155,14 @@ goto :loop ;
156155goto :loop ;
157156:path
158157 if " %eq% " == " " (set " arg=%~1 " & shift)
159- set pathlist = %pathlist%%a rg% ;
158+ set " pathlist = %pathlist%%a rg:\ =/ % ;"
159+ echo>> %confargs% " %opt% =%arg:$ =$$ % " \
160+ goto :loop ;
161+ :extstatic
162+ if " %eq% " == " " (set " arg=static" & shift)
163+ echo>> %config_make% EXTSTATIC = %arg%
160164 echo>> %confargs% " %opt% =%arg:$ =$$ % " \
161165goto :loop ;
162- :extstatic
163- if " %eq% " == " " (set " arg=static" & shift)
164- echo>> %config_make% EXTSTATIC = %arg%
165- echo>> %confargs% " %opt% =%arg:$ =$$ % " \
166- goto :loop ;
167166:baseruby
168167 echo>> %config_make% HAVE_BASERUBY = yes
169168 echo>> %config_make% BASERUBY = %arg%
@@ -185,22 +184,21 @@ goto :loop ;
185184:gmp
186185 echo>> %config_make% WITH_GMP = yes
187186goto :loop ;
188- :destdir
189- echo>> %config_make% DESTDIR = %arg%
190- goto :loop ;
187+ :destdir
188+ echo>> %config_make% DESTDIR = %arg%
189+ goto :loop ;
191190:opt-dir
192- if " %arg% " == " " (
193- echo 1 >& 2 %configure% : missing argument for %opt%
194- exit /b 1
195- )
196- for %%I in (%arg:; = % ) do (
197- set d = %%I
198- call pushd %%d :/=\%% && (
199- call set XINCFLAGS = %%X INCFLAGS%% -I%%C D:\=/%% /include
200- call set XLDFLAGS = %%X LDFLAGS%% -libpath:%%C D:\=/%% /lib
191+ if " %arg% " == " " (
192+ echo 1 >& 2 %configure% : missing argument for %opt%
193+ exit /b 1
194+ )
195+ :optdir-loop
196+ for /f " delims=; tokens=1,*" %%I in (" %arg% " ) do (set " d=%%I " & set " arg = %%J " )
197+ pushd %d:/ =\ % && (
198+ set " optdirs = %optdirs% ;%CD:\ =/ % "
201199 popd
202200 )
203- )
201+ if not " %arg% " == " " goto : optdir-loop
204202goto :loop ;
205203:help
206204 echo Configuration:
@@ -223,26 +221,36 @@ goto :loop ;
223221 echo Note that '[1m=,;[m' need to be enclosed within double quotes in batch file command line.
224222 del %confargs% %config_make%
225223goto :exit
226- :unknown_opt
227- (
228- echo %configure% : unknown option %opt%
229- echo Try --help option.
230- ) 1 >& 2
231- exit /b 1
224+ :unknown_opt
225+ (
226+ echo %configure% : unknown option %opt%
227+ echo Try --help option.
228+ ) 1 >& 2
229+ exit /b 1
232230:end
233231if " %debug_configure% " == " yes" (type %confargs% )
232+ if not " %optdirs% " == " " (echo>> %config_make% optdirs = %optdirs:~1 % )
234233(
234+ echo .
235235 echo configure_args = \
236236 type %confargs%
237237 echo # configure_args
238- if NOT " %XINCFLAGS% " == " " echo XINCFLAGS = %XINCFLAGS%
239- if NOT " %XLDFLAGS% " == " " echo XLDFLAGS = %XLDFLAGS%
240- if NOT " %pathlist% " == " " (
238+
239+ echo .
240+ echo !if "$(optdirs)" ! = " "
241+ for %%I in (" $(optdirs:\=/)" " $(optdirs:/;=;)" ) do @ echo optdirs = %%~I
242+ echo XINCFLAGS = -I" $(optdirs:;=/include" -I" )/include"
243+ echo XLDFLAGS = -libpath:" $(optdirs:;=/lib" -libpath:" )/lib"
244+ echo !endif
245+
246+ if not " %pathlist% " == " " (
247+ echo .
241248 call echo PATH = %%p athlist:;=/bin;%% $^ (PATH^ )
242249 call echo INCLUDE = %%p athlist:;=/include;%% $^ (INCLUDE^ )
243250 call echo LIB = %%p athlist:;=/lib;%% $^ (LIB^ )
244251 )
245252) >> %config_make%
253+
246254del %confargs%
247255if " %debug_configure% " == " yes" (type %config_make% )
248256
0 commit comments