1 /* OS/2 REXX : The top level configure.cmd; Don't delete this comment. */
2 call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
9 parse arg option1 option2 option3 gabbages
10 if (option1='--disable-nls')|(option2='--disable-nls')|(option3='--disable-nls') then
12 optionsread=optionsread+1
15 if (option1='--with-extra-optimize')|(option2='--with-extra-optimize')|(option3='--with-extra-optimize') then
17 optionsread=optionsread+1
18 '@gcc -v 2>&1|grep 2.7'
20 extraopt='-malign-loops=2 -malign-jumps=2 -malign-functions=2 -ffast-math'
22 if (option1='--link-static-xforms')|(option2='--link-static-xforms')|(option3='--link-static-xforms') then
24 optionsread=optionsread+1
27 if \(gabbages='')|(\(option3='')&(optionsread<3))|(\(option2='')&(optionsread<2))|(\(option1='')&(optionsread<1)) then
29 say 'Unknown option! Use only: --with-extra-optimize --disable-nls --link-static-xforms'
34 X11ROOT=value('X11ROOT',,env)
36 /* I don't think I know how to substitute all the occurences *
37 * of a substring to something else with REXX comes with Warp3. *
38 * Of course Object REXX has ANSI function changestr */
40 do until pos('\',curdir)=0
41 parse var curdir tmp1 '\' tmp2
44 curdir=translate(curdir,'\','#')
46 os2config.1='@prefix@ 'X11ROOT'\/XFree86'
47 os2config.2='@exec_prefix@ 'subword(os2config.1,2)
48 os2config.3='@srcdir@ 'curdir
49 os2config.4='@top_srcdir@ 'subword(os2config.3,2)
50 os2config.5='@bindir@ 'subword(os2config.2,2)'\/bin'
51 os2config.6='@libdir@ 'subword(os2config.2,2)'\/lib'
52 os2config.7='@datadir@ 'subword(os2config.2,2)'\/lib'
53 os2config.8='@mandir@ 'subword(os2config.1,2)'\/man'
54 os2config.9='@CPPIMPLFLAGS@ -I'subword(os2config.1,2)'\/include'
55 os2config.10='@program_suffix@'
56 os2config.11='@lyx_devel_version@ $(lyx_devel_version)'
57 os2config.12='@PACKAGE@ lyx'
58 os2config.13='@DATADIRNAME@ lib'
62 testversion=linein('src/version.h')
63 contains=pos('#define LYX_VERSION', testversion)
65 os2config.14='@LYX_VERSION@ 'strip(subword(testversion,3,1),,'"')
66 os2config.15='@VERSION@ 'subword(os2config.14,2)
68 CXXFLAGS=value('CXXFLAGS',,env)
71 CXXFLAGS='-g -m486 -O -fno-strength-reduce -Zmtd -Zsysv-signals -D__ST_MT_ERRNO__ -Wall -Wno-unused'
72 '@gcc -v 2>&1|grep 2.8'
74 CXXFLAGS=CXXFLAGS' -fno-exceptions -fno-rtti'
76 CFLAGS=value('CFLAGS',,env)
78 CFLAGS='-g -m486 -O2 -fno-strength-reduce -Zmtd -Zsysv-signals -D__ST_MT_ERRNO__ -Wall -Wno-unused'
79 /* extraopt is added to CXXFLAGS/CFLAGS even if the environment variable is set */
80 CXXFLAGS=CXXFLAGS' 'extraopt
81 CFLAGS=CFLAGS' 'extraopt
82 os2config.16='@CXXFLAGS@ 'CXXFLAGS
83 os2config.17='@CFLAGS@ 'CFLAGS
85 os2config.18='@CC@ gcc'
86 os2config.19='@CXX@ gcc' /* os2config.12='@CXX@ g++' */
87 os2config.20='@RANLIB@ ar s'
89 os2config.21='@LYX_LIBS@ -lforms_s -lulib -lXpm'
91 os2config.21='@LYX_LIBS@ -lforms -lXpm'
92 os2config.22='@LIBS@ -lSM -lICE -lX11 -lsocket'
96 os2config.23='@LDFLAGS@ -Zmtd -Zsysv-signals -Zbin-files -s -lwrap -L'subword(os2config.6,2)
100 os2config.23='@LDFLAGS@ -Zmtd -Zsysv-signals -Zbin-files -L'subword(os2config.6,2)
103 os2config.24='@CPPFLAGS@ -I'subword(os2config.1,2)'\/include -I..\/intl'
104 os2config.25='@SET_MAKE@' /* ??? */
105 os2config.26='@CXX_COMMAND@ gcc.exe'
107 /* Full path is given in order to distinguish it from IBM install. */
108 os2config.27='@INSTALL@ 'subword(os2config.5,2)'\/install'
109 os2config.28='@INSTALL_DATA@ 'subword(os2config.5,2)'\/install'
110 os2config.29='@INSTALL_PROGRAM@ 'subword(os2config.5,2)'\/install'
111 os2config.30='@INSTALL_TARGET@ install-os2'
112 os2config.31='@LIBOBJS@'
115 os2config.32='@INTLLIBS@ ..\/intl\/libintl.a'
116 os2config.33='@INTLSUB@ intl'
117 os2config.34='@POSUB@' /* os2config.27='@POSUB@ po' */
118 os2config.35='@USE_INCLUDED_LIBINTL@ yes'
122 os2config.32='@INTLLIBS@'
123 os2config.33='@INTLSUB@'
124 os2config.34='@POSUB@'
125 os2config.35='@USE_INCLUDED_LIBINTL@'
127 os2config.36='@INTLOBJS@'
128 os2config.37='@DEFS@'
129 os2config.38='@program_transform_name@'
131 os2config.40='@EXEEXT@ .exe'
132 os2config.41='@PERL@ perl'
133 os2config.42='@LYX_DIR@ $ENV{X11ROOT}\/XFree86\/lib\/X11\/lyx'
136 rc=SysFileDelete('os2config.sed')
137 do i=1 to os2config.0
138 parse var os2config.i from_string to_string
139 rc=lineout('os2config.sed','s/'from_string'/'to_string'/g')
142 rc=lineout('os2config.sed','s/lyx_devel_version = yes/lyx_devel_version = no/')
143 rc=lineout('os2config.sed','s/#undef HAVE_ALLOCA$/#define HAVE_ALLOCA 1/')
144 rc=lineout('os2config.sed','s/#undef HAVE_ALLOCA_H/#define HAVE_ALLOCA_H 1/')
145 rc=lineout('os2config.sed','s/#undef STDC_HEADERS/#define STDC_HEADERS 1/')
146 rc=lineout('os2config.sed','s/#undef PACKAGE/#define PACKAGE \"lyx\"/')
147 rc=lineout('os2config.sed','s/#undef VERSION/#define VERSION \"'subword(os2config.14,2)'\"/')
148 rc=lineout('os2config.sed','s/#undef HAVE_GETCWD/#define HAVE_GETCWD 1/')
149 rc=lineout('os2config.sed','s/#undef HAVE_GETPAGESIZE/#define HAVE_GETPAGESIZE 1/')
150 rc=lineout('os2config.sed','s/#undef HAVE_MEMMOVE/#define HAVE_MEMMOVE 1/')
151 rc=lineout('os2config.sed','s/#undef HAVE_MEMSET/#define HAVE_MEMSET 1/')
152 rc=lineout('os2config.sed','s/#undef HAVE_PUTENV/#define HAVE_PUTENV 1/')
153 rc=lineout('os2config.sed','s/#undef HAVE_SETLOCALE/#define HAVE_SETLOCALE 1/')
154 rc=lineout('os2config.sed','s/#undef HAVE_XOPENIM/#define HAVE_XOPENIM 1/')
155 rc=lineout('os2config.sed','s/#undef HAVE_STRCHR/#define HAVE_STRCHR 1/')
156 rc=lineout('os2config.sed','s/#undef HAVE_STRERROR/#define HAVE_STRERROR 1/')
157 rc=lineout('os2config.sed','s/#undef HAVE_DIRENT_H/#define HAVE_DIRENT_H 1/')
158 rc=lineout('os2config.sed','s/#undef HAVE_ERRNO_H/#define HAVE_ERRNO_H 1/')
159 rc=lineout('os2config.sed','s/#undef HAVE_LIMITS_H/#define HAVE_LIMITS_H 1/')
160 rc=lineout('os2config.sed','s/#undef HAVE_LOCALE_H/#define HAVE_LOCALE_H 1/')
161 rc=lineout('os2config.sed','s/#undef HAVE_MALLOC_H/#define HAVE_MALLOC_H 1/')
162 rc=lineout('os2config.sed','s/#undef HAVE_STRING_H/#define HAVE_STRING_H 1/')
163 rc=lineout('os2config.sed','s/#undef HAVE_SYS_DIR_H/#define HAVE_SYS_DIR_H 1/')
164 rc=lineout('os2config.sed','s/#undef HAVE_SYS_SELECT_H/#define HAVE_SYS_SELECT_H 1/')
165 rc=lineout('os2config.sed','s/#undef HAVE_SYS_TIME_H/#define HAVE_SYS_TIME_H 1/')
166 rc=lineout('os2config.sed','s/#undef HAVE_UNISTD_H/#define HAVE_UNISTD_H 1/')
167 rc=lineout('os2config.sed','s/#undef XPM_H_LOCATION/#define XPM_H_LOCATION <X11\/xpm.h>/')
168 rc=lineout('os2config.sed','s/#undef FORMS_H_LOCATION/#define FORMS_H_LOCATION <forms.h>/')
169 rc=lineout('os2config.sed','s/#undef SIZEOF_INT/#define SIZEOF_INT 4/')
170 rc=lineout('os2config.sed','s/#undef SIZEOF_VOID_P/#define SIZEOF_VOID_P 4/')
171 rc=lineout('os2config.sed','s/#undef HAVE_bool/#define HAVE_bool 1/')
172 rc=lineout('os2config.sed','s/#undef SELECT_TYPE_ARG1/#define SELECT_TYPE_ARG1 (int)/')
173 rc=lineout('os2config.sed','s/#undef SELECT_TYPE_ARG234/#define SELECT_TYPE_ARG234 (fd_set *)/')
174 rc=lineout('os2config.sed','s/#undef SELECT_TYPE_ARG5/#define SELECT_TYPE_ARG5 (struct timeval *)/')
175 rc=lineout('os2config.sed','s/#undef WITH_WARNINGS/#define WITH_WARNINGS 1/')
177 rc=lineout('os2config.sed','s/#undef DEVEL_VERSION/#define DEVEL_VERSION 1/')
178 rc=lineout('os2config.sed','s/SHELL/#SHELL/')
179 rc=lineout('os2config.sed','s/SCRIPT_SUFFIX=/SCRIPT_SUFFIX=.cmd/')
180 rc=lineout('os2config.sed','s/^DEFS = -DLOCALEDIR/DEFS = -DHAVE_CONFIG_H=1 -DLOCALEDIR/')
182 rc=lineout('os2config.sed','s/#undef ENABLE_NLS/#define ENABLE_NLS 1/')
184 rc=lineout('os2config.sed','s/ for [^ ]* in / -for %1 in (/')
185 rc=lineout('os2config.sed','s/; do /) do /')
187 rc=lineout('os2config.sed','s/(cd lib && $(MAKE) install)/(cd lib && $(MAKE) os2install)/')
188 rc=lineout('os2config.sed','s/ln -s/cp/g')
189 rc=lineout('os2config.sed','s/-o lyx /-o lyx.exe /')
190 rc=lineout('os2config.sed','s/$(INSTALL_PROGRAM) reLyX\/reLyX $(bindir)\/reLyX/$(INSTALL_PROGRAM) reLyX\/reLyX.cmd $(bindir)\/reLyX.cmd/')
191 rc=lineout('os2config.sed','s/"reLyX /"reLyX.cmd /')
192 rc=lineout('os2config.sed') /* Close the file */
194 /* Test if xforms and Xpm are available. */
195 rc=SysFileTree(X11ROOT'\XFree86\lib\forms.a',found,'F')
197 say "Can't find forms.a. Please check that the xforms library is correctly installed on your system."
198 rc=SysFileTree(X11ROOT'\XFree86\lib\Xpm.a',found,'F')
200 say "Can't find Xpm.a. Please check that the Xpm library is correctly installed on your system."
202 'touch config.status'
203 'touch config/stamp-h.in'
204 'sed -f os2config.sed Makefile.in > Makefile'
205 'sed -f os2config.sed lib/Makefile.in > lib\Makefile'
206 'sed -f os2config.sed src/Makefile.in > src\Makefile'
207 'sed -f os2config.sed src/config.h.in > src\config.h'
209 call SysFileTree 'intl\intlh.inst','patched','F'
210 if patched.0 = 0 then
211 /* Figure out how GNU patch program is called here */
212 /* If run without arguments,
213 GNU patch emits "usage" into stderr and none into stdout, and
214 IBM patch emits nothing into stderr and an error message "SYS1575..." into stdout
218 '@patch 2>&1 | grep SYS1575 >nul'
221 say 'configure tries to run GNU patch with the command "patch"'
222 say 'and detects IBM patch instead. Please type the collect'
223 say 'name to invoke GNU patch:'
227 patch' -d intl<development\OS2\gnugettext.diff'
228 'touch intl/intlh.inst'
229 'cp intl/libgettext.h intl/libintl.h'
230 'sed -f os2config.sed intl/Makefile.in > intl\Makefile'
234 /* Check if perl 5.002 or later is available */
235 PERL=SysSearchPath('PATH', 'perl.exe')
236 if PERL='' then PERL=SysSearchPath('PATH', 'perl_.exe')
237 if PERL='' then PERL=SysSearchPath('PATH', 'perl__.exe')
238 if PERL='' then PERL=SysSearchPath('PATH', 'perl___.exe')
239 PERL ' -e "require 5.002"'
242 call SysFileDelete 'reLyX\reLyX.cmd'
243 rc=lineout('reLyX\reLyX.cmd','extproc 'filespec("name",PERL)' -S')
244 rc=lineout('reLyX\reLyX.cmd')
245 'sed -f ../os2config.sed reLyX/reLyX.in >> reLyX\reLyX.cmd'
246 rc=SysFileTree('reLyX\reLyXmain.pl.in',found,'F')
248 'cmd /c copy reLyX\reLyXmain.pl reLyX\reLyXmain.pl.in'
249 'sed -e "s/noweb2lyx/noweb2lyx.cmd/" reLyX/reLyXmain.pl.in > reLyX\reLyXmain.pl'
250 call SysFileDelete 'reLyX\noweb2lyx.cmd'
251 rc=lineout('reLyX\noweb2lyx.cmd','extproc 'filespec("name",PERL)' -S')
252 rc=lineout('reLyX\noweb2lyx.cmd')
253 'sed -f ../os2config.sed reLyX/noweb2lyx.in >> reLyX\noweb2lyx.cmd'
255 /* The extension ".cmd" is added to distinguish it from sh-script */
256 /* On single-user OS/2, system wide configuration is normally not necessary */
257 'cmd /c configure.cmd --without-latex-config & cd ..'