xref: /titanic_41/usr/src/lib/libshell/misc/buildksh93.sh (revision bbb1277b6ec1b0daad4e3ed1a2b891d3e2ece2eb)
1#!/bin/ksh -p
2# (note we use "/bin/ksh -p" for Linux/pdksh support in this script)
3
4#
5# CDDL HEADER START
6#
7# The contents of this file are subject to the terms of the
8# Common Development and Distribution License (the "License").
9# You may not use this file except in compliance with the License.
10#
11# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
12# or http://www.opensolaris.org/os/licensing.
13# See the License for the specific language governing permissions
14# and limitations under the License.
15#
16# When distributing Covered Code, include this CDDL HEADER in each
17# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
18# If applicable, add the following below this CDDL HEADER, with the
19# fields enclosed by brackets "[]" replaced with your own identifying
20# information: Portions Copyright [yyyy] [name of copyright owner]
21#
22# CDDL HEADER END
23#
24
25#
26# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27# Use is subject to license terms.
28#
29
30#
31# buildksh93.sh - ast-ksh standalone build script for the
32# OpenSolaris ksh93-integration project
33#
34
35# ksh93t sources can be downloaded like this from the AT&T site:
36# wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/sw/download/beta/INIT.2009-10-14.tgz'
37# wget --http-user="I accept www.opensource.org/licenses/cpl" --http-passwd="." 'http://www.research.att.com/sw/download/beta/ast-ksh.2009-10-14.tgz'
38
39function fatal_error
40{
41    print -u2 "${progname}: $*"
42    exit 1
43}
44
45set -o errexit
46set -o xtrace
47
48typeset progname="$(basename "${0}")"
49typeset buildmode="$1"
50
51if [[ "${buildmode}" == "" ]] ; then
52    fatal_error "buildmode required."
53fi
54
55# Make sure we use the C locale during building to avoid any unintended
56# side-effects
57export LANG=C
58export LC_ALL=$LANG LC_MONETARY=$LANG LC_NUMERIC=$LANG LC_MESSAGES=$LANG LC_COLLATE=$LANG LC_CTYPE=$LANG
59# Make sure the POSIX/XPG6 tools are in front of /usr/bin (/bin is needed for Linux after /usr/bin)
60export PATH=/usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/bin:/opt/SUNWspro/bin
61
62# Make sure the POSIX/XPG6 packages are installed (mandatory for building
63# our version of ksh93 correctly).
64if [[ "$(uname -s)" == "SunOS" ]] ; then
65    if [[ ! -x "/usr/xpg6/bin/tr" ]] ; then
66        fatal_error "XPG6/4 packages (SUNWxcu6,SUNWxcu4) not installed."
67    fi
68fi
69
70function print_solaris_builtin_header
71{
72# Make sure to use \\ instead of \ for continuations
73cat <<ENDOFTEXT
74/*
75 * CDDL HEADER START
76 *
77 * The contents of this file are subject to the terms of the
78 * Common Development and Distribution License (the "License").
79 * You may not use this file except in compliance with the License.
80 *
81 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
82 * or http://www.opensolaris.org/os/licensing.
83 * See the License for the specific language governing permissions
84 * and limitations under the License.
85 *
86 * When distributing Covered Code, include this CDDL HEADER in each
87 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
88 * If applicable, add the following below this CDDL HEADER, with the
89 * fields enclosed by brackets "[]" replaced with your own identifying
90 * information: Portions Copyright [yyyy] [name of copyright owner]
91 *
92 * CDDL HEADER END
93 */
94
95/*
96 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
97 * Use is subject to license terms.
98 */
99
100#ifndef _SOLARIS_KSH_CMDLIST_H
101#define	_SOLARIS_KSH_CMDLIST_H
102
103#ifdef	__cplusplus
104extern "C" {
105#endif
106
107/*
108 * List builtins for Solaris.
109 * The list here is partially autogenerated and partially hand-picked
110 * based on compatibility with the native Solaris versions of these
111 * tools
112 */
113
114/* POSIX compatible commands */
115#ifdef _NOT_YET
116#define	XPG6CMDLIST(f)	\\
117	{ "/usr/xpg6/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
118#define	XPG4CMDLIST(f)	\\
119	{ "/usr/xpg4/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
120#else
121#define	XPG6CMDLIST(f)
122#define	XPG4CMDLIST(f)
123#endif /* NOT_YET */
124/*
125 * Commands which are 100% compatible with native Solaris versions (/bin is
126 * a softlink to ./usr/bin, ksh93 takes care about the lookup)
127 */
128#define	BINCMDLIST(f)	\\
129	{ "/bin/"	#f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
130#define	USRBINCMDLIST(f)	\\
131	{ "/usr/bin/"	#f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
132#define	SBINCMDLIST(f)	\\
133	{ "/sbin/"	#f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
134#define	SUSRBINCMDLIST(f)	\\
135	{ "/usr/sbin/"	#f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
136/*
137 * Make all ksh93 builtins accessible when /usr/ast/bin was added to
138 * /usr/xpg6/bin:/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:/bin:/opt/SUNWspro/bin
139 */
140#define	ASTCMDLIST(f)	\\
141	{ "/usr/ast/bin/" #f, NV_BLTIN|NV_BLTINOPT|NV_NOFREE, bltin(f) },
142
143/* undo ast_map.h #defines to avoid collision */
144#undef basename
145#undef dirname
146#undef mktemp
147
148/* Generated data, do not edit. */
149XPG4CMDLIST(basename)
150ASTCMDLIST(basename)
151BINCMDLIST(cat)
152ASTCMDLIST(cat)
153XPG4CMDLIST(chgrp)
154ASTCMDLIST(chgrp)
155ASTCMDLIST(chmod)
156XPG4CMDLIST(chown)
157BINCMDLIST(chown)
158ASTCMDLIST(chown)
159BINCMDLIST(cksum)
160ASTCMDLIST(cksum)
161BINCMDLIST(cmp)
162ASTCMDLIST(cmp)
163BINCMDLIST(comm)
164ASTCMDLIST(comm)
165XPG4CMDLIST(cp)
166ASTCMDLIST(cp)
167BINCMDLIST(cut)
168ASTCMDLIST(cut)
169XPG4CMDLIST(date)
170ASTCMDLIST(date)
171ASTCMDLIST(dirname)
172XPG4CMDLIST(expr)
173ASTCMDLIST(expr)
174ASTCMDLIST(fds)
175ASTCMDLIST(fmt)
176BINCMDLIST(fold)
177ASTCMDLIST(fold)
178BINCMDLIST(head)
179ASTCMDLIST(head)
180XPG4CMDLIST(id)
181ASTCMDLIST(id)
182BINCMDLIST(join)
183ASTCMDLIST(join)
184XPG4CMDLIST(ln)
185ASTCMDLIST(ln)
186BINCMDLIST(logname)
187ASTCMDLIST(logname)
188BINCMDLIST(mkdir)
189ASTCMDLIST(mkdir)
190BINCMDLIST(mkfifo)
191ASTCMDLIST(mkfifo)
192BINCMDLIST(mktemp)
193ASTCMDLIST(mktemp)
194XPG4CMDLIST(mv)
195ASTCMDLIST(mv)
196BINCMDLIST(paste)
197ASTCMDLIST(paste)
198BINCMDLIST(pathchk)
199ASTCMDLIST(pathchk)
200BINCMDLIST(rev)
201ASTCMDLIST(rev)
202XPG4CMDLIST(rm)
203ASTCMDLIST(rm)
204BINCMDLIST(rmdir)
205ASTCMDLIST(rmdir)
206XPG4CMDLIST(stty)
207ASTCMDLIST(stty)
208BINCMDLIST(sum)
209ASTCMDLIST(sum)
210SUSRBINCMDLIST(sync)
211SBINCMDLIST(sync)
212BINCMDLIST(sync)
213ASTCMDLIST(sync)
214BINCMDLIST(tail)
215XPG4CMDLIST(tail)
216ASTCMDLIST(tail)
217BINCMDLIST(tee)
218ASTCMDLIST(tee)
219BINCMDLIST(tty)
220ASTCMDLIST(tty)
221ASTCMDLIST(uname)
222BINCMDLIST(uniq)
223ASTCMDLIST(uniq)
224BINCMDLIST(wc)
225ASTCMDLIST(wc)
226
227/* Mandatory for ksh93 test suite and AST scripts */
228BINCMDLIST(getconf)
229
230#ifdef	__cplusplus
231}
232#endif
233
234#endif /* !_SOLARIS_KSH_CMDLIST_H */
235ENDOFTEXT
236}
237
238function build_shell
239{
240    set -o errexit
241    set -o xtrace
242
243    # OS.cputype.XXbit.compiler
244    case "${buildmode}" in
245        *.linux.*)
246            # ksh93+AST config flags
247            bast_flags="-DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_SYSRC -D_map_libc=1"
248
249            # gcc flags
250            bgcc99="gcc -std=gnu99 "
251            bgcc_ccflags="${bon_flags} ${bast_flags} -g"
252
253            case "${buildmode}" in
254                # Linux i386
255                *.i386.32bit.gcc*)  HOSTTYPE="linux.i386" CC="${bgcc99} -fPIC" cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"
256                    ;;
257                *)
258                    fatal_error "build_shell: Illegal Linux type/compiler build mode \"${buildmode}\"."
259                    ;;
260            esac
261            ;;
262        *.solaris.*)
263            # Notes:
264            # 1. Do not remove/modify these flags or their order before either
265            # asking the project leads at
266            # http://www.opensolaris.org/os/project/ksh93-integration/
267            # These flags all have a purpose, even if they look
268            # weird/redundant/etc. at the first look.
269            #
270            # 2. We use -KPIC here since -Kpic is too small on 64bit sparc and
271            # on 32bit it's close to the barrier so we use it for both 32bit and
272            # 64bit to avoid later suprises when people update libast in the
273            # future
274            #
275            # 3. "-D_map_libc=1" is needed to force map.c to add a "_ast_" prefix to all
276            # AST symbol names which may otherwise collide with Solaris/Linux libc
277            #
278            # 4. "-DSHOPT_SYSRC" enables /etc/ksh.kshrc support (AST default is currently
279            # to enable it if /etc/ksh.kshrc or /etc/bash.bashrc are available on the
280            # build machine).
281            #
282            # 5. -D_lib_socket=1 -lsocket -lnsl" was added to make sure ksh93 is compiled
283            # with networking support enabled, the current AST build infratructure has
284            # problems with detecting networking support in Solaris.
285            #
286            # 6. "-xc99=%all -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1" is used to force
287            # the compiler into C99 mode. Otherwise ksh93 will be much slower and lacks
288            # lots of arithmethic functions.
289            #
290            # 7. "-D_TS_ERRNO -D_REENTRANT" are flags taken from the default OS/Net
291            # build system.
292            #
293            # 8. "-xpagesize_stack=64K is used on SPARC to enhance the performace
294            #
295            # 9. -DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\"/home/test001/ksh93/ast_ksh_20070322/solaris_cmdlist.h\\\"
296            # is used to bind all ksh93 builtins to a "virtual" directory
297            # called "/usr/ast/bin/" and to adjust the list of builtins
298            # enabled by default to those defined by PSARC 2006/550
299
300            solaris_builtin_header="${PWD}/tmp_solaris_builtin_header.h"
301            print_solaris_builtin_header >"${solaris_builtin_header}"
302
303            # OS/Net build flags
304            bon_flags="-D_TS_ERRNO -D_REENTRANT"
305
306            # ksh93+AST config flags
307            bast_flags="-DSHOPT_CMDLIB_BLTIN=0 -DSH_CMDLIB_DIR=\\\"/usr/ast/bin\\\" -DSHOPT_CMDLIB_HDR=\\\"${solaris_builtin_header}\\\" -DSHOPT_SYSRC -D_map_libc=1"
308
309            # Sun Studio flags
310            bsunc99="/opt/SUNWspro/bin/cc -xc99=%all -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1"
311            bsuncc_app_ccflags_sparc="-xpagesize_stack=64K" # use bsuncc_app_ccflags_sparc only for final executables
312            bsuncc_ccflags="${bon_flags} -KPIC -g -xs -xspace -Xa -xstrconst -z combreloc -xildoff -xcsi -errtags=yes ${bast_flags} -D_lib_socket=1 -lsocket -lnsl"
313
314            # gcc flags
315            bgcc99="/usr/sfw/bin/gcc -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1"
316            bgcc_warnflags="-Wall -Wextra -Wno-unknown-pragmas -Wno-missing-braces -Wno-sign-compare -Wno-parentheses -Wno-uninitialized -Wno-implicit-function-declaration -Wno-unused -Wno-trigraphs -Wno-char-subscripts -Wno-switch"
317            bgcc_ccflags="${bon_flags} ${bgcc_warnflags} ${bast_flags} -D_lib_socket=1 -lsocket -lnsl"
318
319            case "${buildmode}" in
320	        # for -m32/-m64 flags see usr/src/Makefile.master, makefile symbols *_XARCH/co.
321                *.i386.32bit.suncc*)  HOSTTYPE="sol11.i386" CC="${bsunc99} -m32"                  cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}"  ;;
322                *.i386.64bit.suncc*)  HOSTTYPE="sol11.i386" CC="${bsunc99} -m64 -KPIC"            cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}"  ;;
323                *.sparc.32bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99} -m32"                  cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;;
324                *.sparc.64bit.suncc*) HOSTTYPE="sol11.sun4" CC="${bsunc99} -m64 -dalign -KPIC"    cc_sharedlib="-G" CCFLAGS="${bsuncc_ccflags}" bsuncc_app_ccflags="${bsuncc_app_ccflags_sparc}" ;;
325
326                *.i386.32bit.gcc*)  HOSTTYPE="sol11.i386" CC="${bgcc99} -fPIC"                                            cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"  ;;
327                *.i386.64bit.gcc*)  HOSTTYPE="sol11.i386" CC="${bgcc99} -m64 -mtune=opteron -Ui386 -U__i386 -fPIC"        cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"  ;;
328                *.sparc.32bit.gcc*) HOSTTYPE="sol11.sun4" CC="${bgcc99} -m32 -mcpu=v8 -fPIC"                              cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"  ;;
329                *.sparc.64bit.gcc*) HOSTTYPE="sol11.sun4" CC="${bgcc99} -m64 -mcpu=v9 -fPIC"                              cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"  ;;
330                *.s390.32bit.gcc*)  HOSTTYPE="sol11.s390" CC="${bgcc99} -m32          -fPIC"				  cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"  ;;
331                *.s390.64bit.gcc*)  HOSTTYPE="sol11.s390" CC="${bgcc99} -m64          -fPIC"				  cc_sharedlib="-shared" CCFLAGS="${bgcc_ccflags}"  ;;
332
333                *)
334                    fatal_error "build_shell: Illegal Solaris type/compiler build mode \"${buildmode}\"."
335                    ;;
336            esac
337            ;;
338        *)
339            fatal_error "Illegal OS build mode \"${buildmode}\"."
340            ;;
341    esac
342
343    # some prechecks
344    [[ -z "${CCFLAGS}"  ]] && fatal_error "build_shell: CCFLAGS is empty."
345    [[ -z "${CC}"       ]] && fatal_error "build_shell: CC is empty."
346    [[ -z "${HOSTTYPE}" ]] && fatal_error "build_shell: HOSTTYPE is empty."
347    [[ ! -f "bin/package" ]] && fatal_error "build_shell: bin/package missing."
348    [[ ! -x "bin/package" ]] && fatal_error "build_shell: bin/package not executable."
349
350    export CCFLAGS CC HOSTTYPE
351
352    # build ksh93
353    bin/package make CCFLAGS="${CCFLAGS}" CC="${CC}" HOSTTYPE="${HOSTTYPE}"
354
355    root="${PWD}/arch/${HOSTTYPE}"
356    [[ -d "$root" ]] || fatal_error "build_shell: directory ${root} not found."
357    log="${root}/lib/package/gen/make.out"
358
359    [[ -s $log ]] || fatal_error "build_shell: no make.out log found."
360
361    if [[ -f ${root}/lib/libast-g.a   ]] then link_libast="ast-g"     ; else link_libast="ast"     ; fi
362    if [[ -f ${root}/lib/libdll-g.a   ]] then link_libdll="dll-g"     ; else link_libdll="dll"     ; fi
363    if [[ -f ${root}/lib/libsum-g.a   ]] then link_libsum="sum-g"     ; else link_libsum="sum"     ; fi
364    if [[ -f ${root}/lib/libcmd-g.a   ]] then link_libcmd="cmd-g"     ; else link_libcmd="cmd"     ; fi
365    if [[ -f ${root}/lib/libshell-g.a ]] then link_libshell="shell-g" ; else link_libshell="shell" ; fi
366
367    if [[ "${buildmode}" != *.staticshell* ]] ; then
368        # libcmd causes some trouble since there is a squatter in solaris
369        # This has been fixed in Solaris 11/B48 but may require adjustments
370        # for older Solaris releases
371        for lib in libast libdll libsum libcmd libshell ; do
372            case "$lib" in
373            libshell)
374                base="src/cmd/ksh93/"
375                vers=1
376                link="-L${root}/lib/ -l${link_libcmd} -l${link_libsum} -l${link_libdll} -l${link_libast} -lm"
377                ;;
378            libdll)
379                base="src/lib/${lib}"
380                vers=1
381                link="-ldl"
382                ;;
383            libast)
384                base="src/lib/${lib}"
385                vers=1
386                link="-lm"
387                ;;
388            *)
389                base="src/lib/${lib}"
390                vers=1
391                link="-L${root}/lib/ -l${link_libast} -lm"
392                ;;
393            esac
394
395            (
396            cd "${root}/${base}"
397
398	    if [[ -f ${lib}-g.a ]] ; then lib_a="${lib}-g.a" ; else lib_a="${lib}.a" ; fi
399
400            if [[ "${buildmode}" == *solaris* ]] ; then
401                ${CC} ${cc_sharedlib} ${CCFLAGS} -Bdirect -Wl,-zallextract -Wl,-zmuldefs -o "${root}/lib/${lib}.so.${vers}" "${lib_a}"  $link
402            else
403                ${CC} ${cc_sharedlib} ${CCFLAGS} -Wl,--whole-archive -Wl,-zmuldefs "${lib_a}" -Wl,--no-whole-archive -o "${root}/lib/${lib}.so.${vers}" $link
404            fi
405
406            #rm ${lib}.a
407            mv "${lib_a}" "disabled_${lib_a}_"
408
409            cd "${root}/lib"
410            ln -sf "${lib}.so.${vers}" "${lib}.so"
411            )
412        done
413
414        (
415          base=src/cmd/ksh93
416          cd "${root}/${base}"
417          rm -f \
418	      "${root}/lib/libshell.a" "${root}/lib/libshell-g.a" \
419              "${root}/lib/libsum.a" "${root}/lib/libsum-g.a" \
420              "${root}/lib/libdll.a" "${root}/lib/libdll-g.a" \
421              "${root}/lib/libast.a""${root}/lib/libast-g.a"
422
423          if [[ "${buildmode}" == *solaris* ]] ; then
424              ${CC} ${CCFLAGS} ${bsuncc_app_ccflags} -L${root}/lib/ -Bdirect -o ksh pmain.o -lshell -Bstatic -l${link_libcmd} -Bdynamic -lsum -ldll -last -lm -lmd -lsecdb
425          else
426              ${CC} ${CCFLAGS} ${bsuncc_app_ccflags} -L${root}/lib/ -o ksh pmain.o -lshell -lcmd -lsum -ldll -last -lm
427          fi
428
429	  file ksh
430	  file shcomp
431
432	  export LD_LIBRARY_PATH="${root}/lib:${LD_LIBRARY_PATH}"
433	  export LD_LIBRARY_PATH_32="${root}/lib:${LD_LIBRARY_PATH_32}"
434	  export LD_LIBRARY_PATH_64="${root}/lib:${LD_LIBRARY_PATH_64}"
435	  ldd ksh
436        )
437    fi
438}
439
440function test_builtin_getconf
441{
442(
443    print "# testing getconf builtin..."
444    set +o errexit
445    export PATH=/bin:/usr/bin
446    for lang in ${TEST_LANG} ; do
447        (
448	    printf "## testing LANG=%s\n" "${lang}"
449            export LC_ALL="${lang}" LANG="${lang}"
450            ${SHELL} -c '/usr/bin/getconf -a |
451                         while read i ; do
452                         t="${i%:*}" ; a="$(getconf "$t" 2>/dev/null)" ;
453                         b="$(/usr/bin/getconf "$t" 2>/dev/null)" ; [ "$a" != "$b" ] && print "# |$t|:|$a| != |$b|" ;
454                         done'
455        )
456    done
457    print "# testing getconf done."
458)
459}
460
461function test_shell
462{
463    set -o errexit
464    set -o xtrace
465
466    ulimit -s 65536 # need larger stack on 64bit SPARC to pass all tests
467
468    export SHELL="$(ls -1 $PWD/arch/*/src/cmd/ksh93/ksh)"
469    export LD_LIBRARY_PATH="$(ls -1ad $PWD/arch/*/lib):${LD_LIBRARY_PATH}"
470    export LD_LIBRARY_PATH_32="$(ls -1ad $PWD/arch/*/lib):${LD_LIBRARY_PATH_32}"
471    export LD_LIBRARY_PATH_64="$(ls -1ad $PWD/arch/*/lib):${LD_LIBRARY_PATH_64}"
472    printf "## SHELL is |%s|\n" "${SHELL}"
473    printf "## LD_LIBRARY_PATH is |%s|\n" "${LD_LIBRARY_PATH}"
474
475    [[ ! -f "${SHELL}" ]] && fatal_error "test_shell: |${SHELL}| is not a file."
476    [[ ! -x "${SHELL}" ]] && fatal_error "test_shell: |${SHELL}| is not executable."
477
478    [[ "${TEST_LANG}" == "" ]] && TEST_LANG="C ja_JP.UTF-8"
479
480    case "${buildmode}" in
481            testshell.bcheck*)
482                for lang in ${TEST_LANG} ; do
483                    (
484                        export LC_ALL="${lang}" LANG="${lang}"
485                        for i in ./src/cmd/ksh93/tests/*.sh ; do
486                            bc_logfile="$(basename "$i").$$.bcheck"
487                            rm -f "${bc_logfile}"
488                            /opt/SUNWspro/bin/bcheck -q -access -o "${bc_logfile}" ${SHELL} ./src/cmd/ksh93/tests/shtests \
489                                LD_LIBRARY_PATH_64="$LD_LIBRARY_PATH_64" \
490                                LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
491                                LD_LIBRARY_PATH_32="$LD_LIBRARY_PATH_32"\
492                                LC_ALL="${lang}" LANG="${lang}" \
493                                VMDEBUG=a \
494                                "$i"
495                            cat "${bc_logfile}"
496                        done
497                    )
498                done
499                ;;
500            testshell.builtin.getconf)
501                test_builtin_getconf
502                ;;
503            testshell)
504                for lang in ${TEST_LANG} ; do
505                    (
506                        export LC_ALL="${lang}" LANG="${lang}"
507                        for i in ./src/cmd/ksh93/tests/*.sh ; do
508                            ${SHELL} ./src/cmd/ksh93/tests/shtests -a \
509                                LD_LIBRARY_PATH_64="$LD_LIBRARY_PATH_64" \
510                                LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
511                                LD_LIBRARY_PATH_32="$LD_LIBRARY_PATH_32" \
512                                LC_ALL="${lang}" LANG="${lang}" \
513                                VMDEBUG=a \
514				SHCOMP=$PWD/arch/*/bin/shcomp \
515                                "$i"
516                        done
517                    )
518                done
519                test_builtin_getconf
520                ;;
521    esac
522}
523
524# main
525case "${buildmode}" in
526        build.*) build_shell ;;
527        testshell*)  test_shell  ;;
528        *) fatal_error "Illegal build mode \"${buildmode}\"." ;;
529esac
530# EOF.
531