source: trunk/Configure @ 869

Last change on this file since 869 was 869, checked in by garnier, 16 years ago

add Configure

  • Property svn:executable set to *
File size: 127.6 KB
Line 
1#! /bin/sh
2#
3# If these # comments don't work, trim them. Don't worry about any other
4# shell scripts, Configure will trim # comments from them for you.
5#
6# (If you are trying to port this package to a machine without sh,
7# I would suggest you have a look at the prototypical config_h.SH file
8# and edit it to reflect your system. Some packages may include samples
9# of config.h for certain machines, so you might look for one of those.)
10#
11# Yes, you may rip this off to use in other distribution packages. This
12# script belongs to the public domain and cannot be copyrighted.
13#
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.
16# The dist-3.0 package (which contains metaconfig) was posted in
17# comp.sources.misc and is available on CPAN under authors/id/RAM so
18# you may fetch it yourself from your nearest archive site.)
19#
20
21# $Id: Configure,v 1.104 2008/07/03 14:17:16 bmorgan Exp $
22#
23# Generated on Thu Jul  3 14:50:17 BST 2008 [metaconfig 3.0 PL70]
24
25cat >/tmp/c1$$ <<EOF
26WARNING!!!!!
27
28SCO csh still thinks true is false!  /bin/csh needs to be updated.
29EOF
30cat >/tmp/c2$$ <<EOF
31
32You didn't run Configure with sh!
33I'll attempt to run sh for you...
34EOF
35
36true || cat /tmp/c1$$ /tmp/c2$$
37true || exec sh $0 $argv:q
38
39(exit $?0) || cat /tmp/c2$$
40(exit $?0) || exec sh $0 $argv:q
41rm -f /tmp/c1$$ /tmp/c2$$
42
43: compute my invocation name
44me=$0
45case "$0" in
46*/*)
47        me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
48        test "$me" || me=$0
49        ;;
50esac
51
52: Proper PATH separator
53p_=:
54: On OS/2 this directory should exist if this is not floppy only system :-]
55#if test -d c:/.; then
56#       p_=\;
57#       PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
58#?X: That's a bug in ksh5.22
59#       OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
60#fi
61
62: Proper PATH setting
63paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
64paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
65paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
66paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
67paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
68paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
69paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
70paths="$paths /sbin /usr/sbin /usr/libexec"
71
72for p in $paths
73do
74        case "$p_$PATH$p_" in
75        *$p_$p$p_*) ;;
76        *) test -d $p && PATH=$PATH$p_$p ;;
77        esac
78done
79
80PATH=.$p_$PATH
81export PATH
82
83: shall we be using ksh?
84inksh=''
85needksh=''
86avoidksh=''
87newsh=/bin/ksh
88changesh=''
89if (PATH=.; alias -x) >/dev/null 2>&1; then
90                inksh=true
91fi
92if test -f /hp-ux -a -f /bin/ksh; then
93        needksh='to avoid sh bug in "here document" expansion'
94fi
95if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
96        if test X`/usr/bin/uname -v` = X4; then
97                avoidksh="to avoid AIX 4's /bin/sh"
98                newsh=/usr/bin/bsh
99        fi
100fi
101case "$inksh/$needksh" in
102/[a-z]*)
103                unset ENV
104                changesh=true
105                reason="$needksh"
106        ;;
107esac
108case "$inksh/$avoidksh" in
109true/[a-z]*)
110        changesh=true
111        reason="$avoidksh"
112        ;;
113esac
114case "$inksh/$needksh-$avoidksh-" in
115true/--)
116                cat <<EOM
117(I see you are using the Korn shell.  In case of problems
118 try the Bourne shell instead.)
119EOM
120        ;;
121esac
122case "$changesh" in
123true)
124        echo "(Feeding myself to $newsh $reason.)"
125        case "$0" in
126        Configure|*/Configure) exec $newsh $0 "$@";;
127        *) exec $newsh Configure "$@";;
128        esac
129        ;;
130esac
131
132: Configure runs within the UU subdirectory
133test -d .config/UU || mkdir -p .config/UU
134unset CDPATH
135cd .config/UU && rm -f ./*
136
137eunicefix=''
138g4compiler=''
139g4osname=''
140g4system=''
141hint=''
142myuname=''
143osname=''
144osvers=''
145Author=''
146Date=''
147Header=''
148Id=''
149Locker=''
150Log=''
151RCSfile=''
152Revision=''
153Source=''
154State=''
155cf_by=''
156cf_time=''
157contains=''
158d_portable=''
159g4base=''
160g4conf=''
161g4final_install=''
162g4include=''
163g4includes_flag=''
164g4install=''
165g4workdir=''
166g4bin=''
167g4lib=''
168g4tmp=''
169g4abladata=''
170g4data=''
171g4elasticdata=''
172g4ledata=''
173g4levelgammadata=''
174g4neutronhpcrosssections=''
175g4radioactivedata=''
176g4clhep_base_dir=''
177g4clhep_include_dir=''
178g4clhep_lib=''
179g4clhep_lib_dir=''
180g4lib_build_shared=''
181g4lib_build_static=''
182g4lib_use_dll=''
183g4lib_use_dyn=''
184g4lib_use_shared=''
185g4lib_use_static=''
186g4global=''
187g4granular=''
188g4lib_use_granular=''
189g4debug=''
190g4ui_build_gag_session=''
191g4ui_build_terminal_session=''
192g4ui_build_win32_session=''
193g4ui_build_xaw_session=''
194g4ui_build_xm_session=''
195g4ui_none=''
196g4ui_use_gag=''
197g4ui_use_tcsh=''
198g4ui_use_terminal=''
199g4ui_use_win32=''
200g4ui_use_xaw=''
201g4ui_use_xm=''
202g4ui_xawflags=''
203g4ui_xawhome=''
204g4ui_xawlibs=''
205g4vis_xmflags=''
206g4vis_xmhome=''
207g4vis_xmlibs=''
208g4_qthome=''
209g4ui_build_qt_session=''
210g4ui_use_qt=''
211g4vis_build_asciitree_driver=''
212g4vis_build_dawn_driver=''
213g4vis_build_dawnfile_driver=''
214g4vis_build_oiwin32_driver=''
215g4vis_build_oix_driver=''
216g4vis_build_openglwin32_driver=''
217g4vis_build_openglx_driver=''
218g4vis_build_openglxm_driver=''
219g4vis_build_raytracer_driver=''
220g4vis_build_raytracerx_driver=''
221g4vis_build_vrml_driver=''
222g4vis_build_vrmlfile_driver=''
223g4vis_oglhome=''
224g4vis_oivhome=''
225g4vis_use_asciitree=''
226g4vis_use_dawn=''
227g4vis_use_dawnfile=''
228g4vis_use_oiwin32=''
229g4vis_use_oix=''
230g4vis_use_openglwin32=''
231g4vis_use_openglx=''
232g4vis_use_openglxm=''
233g4vis_use_raytracer=''
234g4vis_use_raytracerx=''
235g4vis_use_vrml=''
236g4vis_use_vrmlfile=''
237g4vis_xmflags=''
238g4vis_xmhome=''
239g4vis_xmlibs=''
240g4vis_build_openglqt_driver=''
241g4vis_use_openglqt=''
242g4gdml_xercesc_root=''
243g4lib_build_gdml=''
244g4wanalysis_build=''
245g4wanalysis_build_jas=''
246g4wanalysis_build_lab=''
247g4wanalysis_build_lizard=''
248g4wanalysis_use=''
249g4wanalysis_use_jas=''
250g4wanalysis_use_lab=''
251g4wanalysis_use_lizard=''
252g4_gmake=''
253g4_gmake_version=''
254g4_make=''
255g4_make_version=''
256g4make=''
257g4w_use_g3tog4=''
258g4wlib_build_g3tog4=''
259g4w_use_zlib=''
260g4wlib_build_zlib=''
261lns=''
262c=''
263n=''
264package=''
265spackage=''
266sh=''
267sharpbang=''
268shsharp=''
269spitshell=''
270src=''
271startsh=''
272CONFIG=''
273
274define='define'
275undef='undef'
276smallmach='pdp11 i8086 z8000 i80286 iAPX286'
277rmlist=''
278
279: We must find out about Eunice early
280eunicefix=':'
281if test -f /etc/unixtovms; then
282        eunicefix=/etc/unixtovms
283fi
284if test -f /etc/unixtovms.exe; then
285        eunicefix=/etc/unixtovms.exe
286fi
287
288#INITIALIZE QT UI OPTIONS
289g4ui_build_qt_session='n'
290g4ui_use_qt='n'
291g4_qthome=''
292#END QT UI OPTIONS
293#INITIALIZE QT UI OPTIONS
294g4ui_build_qt_session='n'
295g4ui_use_qt='n'
296g4_qthome=''
297#END QT UI OPTIONS
298#INITIALIZE QT VIS DRIVER OPTIONS
299g4vis_build_openglqt_driver='n'
300g4ui_use_openglqt='n'
301#END QT VIS DRIVER OPTIONS
302
303: Find the basic shell for Bourne shell scripts
304case "$sh" in
305'')
306        case "$SYSTYPE" in
307        *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
308        *) xxx='/bin/sh';;
309        esac
310        if test -f "$xxx"; then
311                sh="$xxx"
312        else
313                : Build up a list and do a single loop so we can 'break' out.
314                pth=`echo $PATH | sed -e "s/$p_/ /g"`
315                for xxx in sh bash ksh pdksh ash; do
316                        for p in $pth; do
317                                try="$try ${p}/${xxx}"
318                        done
319                done
320                for xxx in $try; do
321                        if test -f "$xxx"; then
322                                sh="$xxx";
323                                break
324                        elif test -f "$xxx.exe"; then
325                                sh="$xxx";
326                                break
327                        fi
328                done
329        fi
330        ;;
331esac
332
333case "$sh" in
334'')     cat <<EOM >&2
335$me:  Fatal Error:  I can't find a Bourne Shell anywhere. 
336
337Usually it's in /bin/sh.
338Please contact Serguei.Sadilov@cern.ch and
339we'll try to straighten this all out.
340EOM
341        exit 1
342        ;;
343esac
344
345: see if sh knows # comments
346if `$sh -c '#' >/dev/null 2>&1`; then
347        shsharp=true
348        spitshell=cat
349        xcat=/bin/cat
350        test -f $xcat || xcat=/usr/bin/cat
351        echo "#!$xcat" >try
352        $eunicefix try
353        chmod +x try
354#
355# $xcat is wrong on WIN32: there is no /bin/cat and /usr/bin/cat by default.
356# But we are sure that sharpbang is to be '#!' and let 'today' will be !=0.
357#
358#       ./try > today
359        echo "#!$xcat" >today
360
361        if test -s today; then
362                sharpbang='#!'
363        else
364                echo "#! $xcat" > try
365                $eunicefix try
366                chmod +x try
367#
368# $xcat is wrong on WIN32: there is no /bin/cat and /usr/bin/cat by default.
369# But we are sure that sharpbang is to be '#!' and let 'today' will be !=0.
370#
371#       ./try > today
372        echo "#!$xcat" >today
373
374                if test -s today; then
375                        sharpbang='#! '
376                else
377                        sharpbang=': use '
378                fi
379        fi
380else
381        echo " "
382        echo "Your $sh doesn't grok # comments--I will strip them later on."
383        shsharp=false
384        cd ..
385        echo "exec grep -v '^[  ]*#'" >spitshell
386        chmod +x spitshell
387        $eunicefix spitshell
388        spitshell=`pwd`/spitshell
389        cd UU
390        echo "I presume that if # doesn't work, #! won't work either!"
391        sharpbang=': use '
392fi
393rm -f try today
394
395: figure out how to guarantee sh startup
396case "$startsh" in
397'') startsh=${sharpbang}${sh} ;;
398*)
399esac
400cat >try <<EOSS
401$startsh
402set abc
403test "$?abc" != 1
404EOSS
405
406chmod +x try
407$eunicefix try
408if ./try; then
409        : echo "Yup, it does."
410else
411        echo "Hmm... '$startsh' does not guarantee sh startup..."
412        echo "You may have to fix up the shell scripts to make sure $sh runs them."
413fi
414rm -f try
415
416: produce awk script to parse command line options
417cat >options.awk <<'EOF'
418BEGIN {
419        optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
420
421        len = length(optstr);
422        for (i = 1; i <= len; i++) {
423                c = substr(optstr, i, 1);
424                if (i < len) a = substr(optstr, i + 1, 1); else a = "";
425                if (a == ":") {
426                        arg[c] = 1;
427                        i++;
428                }
429                opt[c] = 1;
430        }
431}
432{
433        expect = 0;
434        str = $0;
435        if (substr(str, 1, 1) != "-") {
436                printf("'%s'\n", str);
437                next;
438        }
439        len = length($0);
440        for (i = 2; i <= len; i++) {
441                c = substr(str, i, 1);
442                if (!opt[c]) {
443                        printf("-%s\n", substr(str, i));
444                        next;
445                }
446                printf("-%s\n", c);
447                if (arg[c]) {
448                        if (i < len)
449                                printf("'%s'\n", substr(str, i + 1));
450                        else
451                                expect = 1;
452                        next;
453                }
454        }
455}
456END {
457        if (expect)
458                print "?";
459}
460EOF
461
462: process the command line options
463set X `for arg in "$@"; do echo "X$arg"; done |
464        sed -e s/X// | awk -f options.awk`
465eval "set $*"
466shift
467rm -f options.awk
468
469: set up default values
470fastread=''
471reuseval=false
472config_sh=''
473alldone=''
474error=''
475silent=''
476extractsh=''
477override=''
478knowitall=''
479rm -f optdef.sh
480cat >optdef.sh <<EOS
481$startsh
482EOS
483
484
485: option parsing
486while test $# -gt 0; do
487        case "$1" in
488        -d) shift; fastread=yes;;
489        -e) shift; alldone=cont;;
490        -build) shift; g4build=yes;;
491        -incflags) shift; g4incflags=yes;;
492        -install) shift; install=yes;;
493        -cppflags) shift; g4cppflags=yes;;
494        -cxxflags) shift; g4cxxflags=yes;;
495        -ldlibs) shift; g4ldlibs=yes;;
496        -ldflags) shift; g4ldflags=yes;;
497        -f)
498                shift
499                cd ../..
500                if test -r "$1"; then
501                        config_sh="$1"
502                else
503                        echo "$me: cannot read config file $1." >&2
504                        error=true
505                fi
506                cd .config/UU
507                shift;;
508        -h) shift; error=true;;
509        -r) shift; reuseval=true;;
510        -s) shift; silent=true; realsilent=true;;
511        -E) shift; alldone=exit;;
512        -K) shift; knowitall=true;;
513        -O) shift; override=true;;
514        -S) shift; silent=true; extractsh=true;;
515        -D)
516                shift
517                case "$1" in
518                *=)
519                        echo "$me: use '-U symbol=', not '-D symbol='." >&2
520                        echo "$me: ignoring -D $1" >&2
521                        ;;
522                *=*) echo "$1" | \
523                                sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
524                *) echo "$1='define'" >> optdef.sh;;
525                esac
526                shift
527                ;;
528        -U)
529                shift
530                case "$1" in
531                *=) echo "$1" >> optdef.sh;;
532                *=*)
533                        echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
534                        echo "$me: ignoring -U $1" >&2
535                        ;;
536                *) echo "$1='undef'" >> optdef.sh;;
537                esac
538                shift
539                ;;
540        -V) echo "$me generated by metaconfig 3.0 PL70." >&2
541                exit 0;;
542        --) break;;
543        -*) echo "$me: unknown option $1" >&2; shift; error=true;;
544        *) break;;
545        esac
546done
547
548case "$error" in
549true)
550        cat >&2 <<EOM
551Usage: $me [-dehrsEKOSV] [-install] [-build] [-libs] [-f config.sh] [-D symbol] [-D symbol=value]
552                 [-U symbol] [-U symbol=]
553  -d : use defaults for all answers.
554  -e : go on without questioning past the production of config.sh.
555  -build : start configuration AND build of Geant4 libraries.
556  -cppflags : retrieve the list of cppflags
557  -cxxflags : retrieve the list of cxxflags
558  -incflags : retrieve the list of incflags
559  -install : start installation of Geant4 libraries.
560  -ldflags : retrieve the list of directories where libraries are placed
561  -ldlibs : retrieve the list of libraries to link
562  -f : specify an alternate default configuration file.
563  -h : print this help message and exit (with an error status).
564  -r : reuse C symbols value if possible (skips costly nm extraction).
565  -s : silent mode, only echoes questions and essential information.
566  -D : define symbol to have some value:
567         -D symbol         symbol gets the value 'define'
568         -D symbol=value   symbol gets the value 'value'
569  -E : stop at the end of questions, after having produced config.sh.
570  -K : do not use unless you know what you are doing.
571  -O : let -D and -U override definitions from loaded configuration file.
572  -S : perform variable substitutions on all .SH files (can mix with -f)
573  -U : undefine symbol:
574         -U symbol    symbol gets the value 'undef'
575         -U symbol=   symbol gets completely empty
576  -V : print version number and exit (with a zero status).
577EOM
578        exit 1
579        ;;
580esac
581
582: Sanity checks
583case "$fastread$alldone" in
584yescont|yesexit) ;;
585*)
586        if test ! -t 0; then
587                echo "Say 'sh Configure', not 'sh <Configure'"
588                exit 1
589        fi
590        ;;
591esac
592
593exec 4>&1
594case "$silent" in
595true) exec 1>/dev/null;;
596esac
597
598: run the defines and the undefines, if any, but leave the file out there...
599touch optdef.sh
600. ./optdef.sh
601
602: set package name
603package=g4conf
604
605: Some greps do not return status, grrr.
606echo "grimblepritz" >grimble
607if grep blurfldyick grimble >/dev/null 2>&1 ; then
608        contains=contains
609elif grep grimblepritz grimble >/dev/null 2>&1 ; then
610        contains=grep
611else
612        contains=contains
613fi
614rm -f grimble
615: the following should work in any shell
616case "$contains" in
617contains*)
618        echo " "
619        echo "Grep doesn't return a status!!  Attempting remedial action."
620        cat >contains <<'EOSS'
621grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
622EOSS
623chmod +x contains
624esac
625
626: first determine how to suppress newline on echo command
627#echo " "
628#echo "Checking echo to see how to suppress newlines..."
629(echo "hi there\c" ; echo " ") >.echotmp
630if $contains c .echotmp >/dev/null 2>&1 ; then
631#       echo "...using -n."
632        n='-n'
633        c=''
634else
635#       cat <<'EOM'
636#...using \c
637#EOM
638        n=''
639        c='\c'
640fi
641#echo $n "The star should be here-->$c"
642#echo '*'
643rm -f .echotmp
644
645: compute the number of columns on the terminal for proper question formatting
646case "$COLUMNS" in
647'') COLUMNS='80';;
648esac
649
650: set up the echo used in my read
651myecho="case \"\$xxxm\" in
652'') echo $n \"\$rp $c\" >&4;;
653*) case \"\$rp\" in
654        '') echo $n \"[\$xxxm] $c\";;
655        *)
656                if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
657                        echo \"\$rp\" >&4
658                        echo $n \"[\$xxxm] $c\" >&4
659                else
660                        echo $n \"\$rp [\$xxxm] $c\" >&4
661                fi
662                ;;
663        esac;;
664esac"
665
666: now set up to do reads with possible shell escape and default assignment
667cat <<EOSC >myread
668$startsh
669xxxm=\$dflt
670$myecho
671ans='!'
672case "\$fastread" in
673yes) case "\$dflt" in
674        '') ;;
675        *) ans='';
676                case "\$silent-\$rp" in
677                true-) ;;
678                *) echo " " >&4;;
679                esac;;
680        esac;;
681*) case "\$silent" in
682        true) case "\$rp" in
683                '') ans='';;
684                esac;;
685        esac;;
686esac
687while expr "X\$ans" : "X!" >/dev/null; do
688        read answ
689        set x \$xxxm
690        shift
691        aok=''; eval "ans=\\"\$answ\\"" && aok=y
692        case  "\$answ" in
693        "!")
694                sh 1>&4
695                echo " "
696                $myecho
697                ;;
698        !*)
699                set x \`expr "X\$ans" : "X!\(.*\)\$"\`
700                shift
701                sh 1>&4 -c "\$*"
702                echo " "
703                $myecho
704                ;;
705        "\$ans")
706                case "\$ans" in
707                \\&*)
708                        set x \`expr "X\$ans" : "X&\(.*\)\$"\`
709                        shift
710                        case "\$1" in
711                        -d)
712                                fastread=yes
713                                echo "(OK, I'll run with -d after this question.)" >&4
714                                ;;
715                        -*)
716                                echo "*** Sorry, \$1 not supported yet." >&4
717                                ;;
718                        esac
719                        $myecho
720                        ans=!
721                        ;;
722                esac;;
723        *)
724                case "\$aok" in
725                y)
726                        echo "*** Substitution done -- please confirm."
727                        xxxm="\$ans"
728                        ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
729                        xxxm="\$ans"
730                        ans=!
731                        ;;
732                *)
733                        echo "*** Error -- try again."
734                        ans=!
735                        ;;
736                esac
737                $myecho
738                ;;
739        esac
740        case "\$ans\$xxxm\$nostick" in
741        '')
742                ans=!
743                $myecho
744                ;;
745        esac
746done
747case "\$ans" in
748'') ans="\$xxxm";;
749esac
750EOSC
751
752: Find the path to the source tree
753case "$src" in
754'') src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
755#echo "src=$src"
756;;
757esac
758case "$src" in
759'')
760        src=.
761        rsrc=..
762        ;;
763/*) rsrc="$src/.."
764#echo "rsrc=$rsrc"
765;;
766./*)    cur_dir=`pwd`
767        cd ../../$src
768        src=`pwd`
769        cd $cur_dir
770        rsrc="$src/.."
771rsrc="$src/.."
772#echo "src=$src"
773#echo "rsrc=$rsrc"
774;;
775*) rsrc="../../$src"
776#echo "rsrc=$rsrc"
777;;
778esac
779#cur_dir=`pwd`
780#echo "cur_dir=$cur_dir"
781if test -f $src/Configure && \
782        $contains "^package=$package" $src/Configure >/dev/null 2>&1
783then
784   : found it, so we are ok.
785else
786        rsrc=''
787        for src in . .. ../.. ../../.. ../../../..; do
788                if test -f ../../$src/Configure && \
789                        $contains "^package=$package" ../../$src/Configure >/dev/null 2>&1
790                then
791                        rsrc=../../$src
792                        break
793                fi
794        done
795fi
796case "$rsrc" in
797'')
798        echo " "
799#       dflt=
800#       rp="Directory where sources for $package are located?"
801#       . ./myread
802#       src="$ans"
803        rsrc="$src"
804#echo "src=$src"
805#echo "rsrc=$rsrc"
806        if test -f $rsrc/Configure && \
807                $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1
808        then
809                echo "Ok, I've found them under $src"
810        else
811                echo "Sorry, I can't seem to be able to locate $package sources." >&4
812                echo "Please, use absolute path or relative with './' to Configure." >&4
813                exit 1
814        fi
815        ;;
816../../.) ;;
817*)
818#       echo " "
819#       echo "Sources for $package found in $src" >&4
820        ;;
821esac
822
823: script used to extract .SH files with variable substitutions
824cat >extract <<'EOS'
825CONFIG=true
826#echo "Doing variable substitutions on .SH files..."
827if test -f $src/MANIFEST; then
828        set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
829else
830#       echo "(Looking for .SH files under the source directory.)"
831        set x `(cd $src; find ./config/scripts -name "*.SH" -print)`
832fi
833shift
834case $# in
8350) set x `(cd $src; echo *.SH)`; shift;;
836esac
837if test ! -f $src/$1; then
838        shift
839fi
840mkdir_p='
841name=$1;
842create="";
843while test $name; do
844        if test ! -d "$name"; then
845                create="$name $create";
846                name=`echo $name | sed -e "s|^[^/]*$||"`;
847                name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
848        else
849                name="";
850        fi;
851done;
852for file in $create; do
853        mkdir $file;
854done
855'
856for file in $*; do
857        case "$src" in
858        ".")
859                case "$file" in
860                */*)
861                        dir=`expr X$file : 'X\(.*\)/'`
862                        file_SH=`expr X$file : 'X.*/\(.*\)'`
863                        file_EX=`expr X$file : 'X.*/\(.*\).SH'`
864                        (cd $dir && . ./$file_SH && mkdir -p $abssrc/.config/bin/$g4system && mv $file_EX $abssrc/.config/bin/$g4system)
865#                       echo Sergei_1
866#                       echo "file_SH=$file_SH"
867#                       echo "file_EX=$file_EX"
868#                       echo "file=$file"
869#                       echo "dir=$dir"
870#                       echo "src=$src"
871#                       echo "g4system=$g4system"
872#                       echo Sergei_1
873                        ;;
874                *)
875                        file_SH=`expr X$file : 'X.*/\(.*\)'`
876                        file_EX=`expr X$file : 'X.*/\(.*\).SH'`
877                        (. ./$file && mkdir -p $abssrc/.config/bin/$g4system && mv file-SH $abssrc/.config/bin/$g4system)
878#                       echo Sergei_2
879#                       echo "file_SH=$file_SH"
880#                       echo "file_EX=$file_EX"
881#                       echo "file=$file"
882#                       echo "dir=$dir"
883#                       echo "src=$src"
884#                       echo "g4system=$g4system"
885#                       echo Sergei_2
886                        ;;
887                esac
888                ;;
889        *)
890                case "$file" in
891                */*)
892                        dir=`expr X$file : 'X\(.*\)/'`
893                        file_SH=`expr X$file : 'X.*/\(.*\)'`
894                        file_EX=`expr X$file : 'X.*/\(.*\)\.SH'`
895                        (set x $dir; shift; eval $mkdir_p)
896
897                        (sh <$src/$dir/$file_SH && mkdir -p $src/.config/bin/$g4system && mv $file_EX $src/.config/bin/$g4system)
898
899#                       echo Sergei_3
900#                       echo "dir=$dir"
901#                       echo "file=$file"
902
903#                       echo Sergei_3
904                        ;;
905                *)
906                        file_SH=`expr X$file : 'X.*/\(.*\)'`
907                        file_EX=`expr X$file : 'X.*/\(.*\)\.SH'`
908                        (sh <$src/$file && mkdir -p $src/.config/bin/$g4system && mv $file_EX $src/.config/bin/$g4system)
909                        echo Sergei_4
910                        ;;
911                esac
912                ;;
913        esac
914done
915if test -f $src/config_h.SH; then
916        if test ! -f config.h; then
917        : oops, they left it out of MANIFEST, probably, so do it anyway.
918        . $src/config_h.SH
919        fi
920fi
921EOS
922
923: extract files and exit if asked to do so
924case "$extractsh" in
925true)
926        case "$realsilent" in
927        true) ;;
928        *) exec 1>&4;;
929        esac
930        case "$config_sh" in
931        '') config_sh='$g4conf/config.sh'; config="$g4conf/config.sh";;
932        /*) config="$g4conf/$config_sh";;
933        *) config="$g4conf/$config_sh";;
934        esac
935        echo " "
936        echo "Fetching answers from $config_sh..."
937        . $config
938        test "$override" && . ./optdef.sh
939        echo " "
940        cd ../..
941        . .config/UU/extract
942        rm -rf .config/UU
943        echo "Done."
944        exit 0
945        ;;
946esac
947
948: Eunice requires " " instead of "", can you believe it
949#echo " "
950: Here we go...
951#if [ X$install = Xyes ] ; then
952#echo " "
953#echo " "
954#echo " "
955#echo "                --- Geant4 Toolkit Installation  ---"
956#echo " "
957#echo " "
958#echo " "
959#echo " "
960#else
961#echo " "
962#echo " "
963#echo " "
964#echo "                --- Geant4 Toolkit Installation  ---"
965#echo "                  (setting environments for USER )"
966#echo " "
967#echo " "
968#echo " "
969#fi
970
971trap 'echo " ";rm -rf ../../.config/UU; test -d ../../.config/UU && rm -rf X $rmlist; exit 1' 1 2 3 15
972
973: create .config dir to save info across Configure sessions
974test -d ../.config || mkdir ../.config
975cat >../.config/README <<EOF
976This directory created by Configure to save information that should
977persist across sessions for $package.
978
979You may safely delete it if you wish.
980EOF
981
982: general instructions
983needman=true
984firsttime=true
985user=`(logname) 2>/dev/null`
986case "$user" in
987'') user=`whoami 2>&1`;;
988esac
989
990#if [ X$install = Xyes ] ; then
991#
992#echo " "
993#echo " "
994#echo " "
995#echo "                --- Geant4 Toolkit Installation  ---"
996#echo " "
997#echo " "
998#echo " "
999#echo " "
1000#
1001##if $contains "^$user\$" ../../.config/instruct >/dev/null 2>&1; then
1002##      firsttime=false
1003##      echo " "
1004##      rp='Would you like to see the instructions?'
1005##      dflt=n
1006##      . ./myread
1007##      case "$ans" in
1008##      [yY]*) ;;
1009##      *) needman=false;;
1010##      esac
1011##fi
1012#fi
1013
1014if [ X$g4build = Xyes ] ; then
1015
1016echo " "
1017echo " "
1018echo " "
1019echo "                --- Geant4 Toolkit Build  ---"
1020echo " "
1021echo " "
1022echo " "
1023echo " "
1024
1025if $contains "^$user\$" ../../.config/instruct >/dev/null 2>&1; then
1026        firsttime=false
1027        echo " "
1028        rp='Would you like to see the instructions?'
1029        dflt=n
1030        . ./myread
1031        case "$ans" in
1032        [yY]*) ;;
1033        *) needman=false;;
1034        esac
1035fi
1036fi
1037
1038if [ X$install = Xyes ] ; then
1039needman=false
1040fi
1041
1042if [ X$install = X -a X$g4build = X ] ; then
1043needman=false
1044fi
1045
1046if $needman; then
1047        cat <<EOH
1048 
1049This installation shell script will examine your system and ask you questions
1050to determine how the Geant4 Toolkit should be installed.  If you get stuck on
1051a question, you may use a ! shell escape to start a subshell or execute a
1052command.  Many of the questions will have default answers in square brackets;
1053typing carriage return will set the default.
1054
1055On AFS it is allowed to specify either absolute or relative
1056paths (i.e. starting with the ~username construct).
1057
1058EOH
1059        rp=''
1060        dflt='Type carriage return to continue'
1061        . ./myread
1062        cat <<'EOH'
1063
1064The prompt used in this script allows you to use shell variables and backticks
1065in your answers. You may use $1, $2, etc...  to refer to the words in the
1066default answer, as if the default line was a set of arguments given to a
1067script shell. This means you may also use $* to repeat the whole default line.
1068
1069Everytime there is a substitution, you will have to confirm.  If there is an
1070error (e.g. an unmatched backtick), the default answer will remain unchanged
1071and you will be prompted again.
1072
1073Running 'Configure -d' will bypass nearly all the questions and
1074use the computed defaults (or answers saved in a configuration
1075previously generated).
1076
1077Type 'Configure -h' for a list of options.
1078
1079You may also start interactively and then answer '& -d' at any prompt to turn
1080on the non-interactive behaviour for the rest of the execution.
1081
1082EOH
1083        . ./myread
1084        cat <<EOH
1085
1086Much effort has been spent to ensure that this shell script will run on any
1087Unix system. If despite that you can't run Configure for some reason, you'll
1088have to set the proper environment variables by hand and follow the "manual"
1089installation as specified in the Geant4 Installation Guide.
1090
1091EOH
1092        dflt='Type carriage return to continue'
1093        . ./myread
1094        case "$firsttime" in
1095        true) echo $user >>../../.config/instruct;;
1096        esac
1097fi
1098
1099: find out where common programs are
1100#echo " "
1101#echo "Locating common programs..." >&4
1102cat <<EOSC >loc
1103$startsh
1104case \$# in
11050) exit 1;;
1106esac
1107thing=\$1
1108shift
1109dflt=\$1
1110shift
1111for dir in \$*; do
1112        case "\$thing" in
1113        .)
1114        if test -d \$dir/\$thing; then
1115                echo \$dir
1116                exit 0
1117        fi
1118        ;;
1119        *)
1120        for thisthing in \$dir/\$thing; do
1121                : just loop through to pick last item
1122        done
1123        if test -f \$thisthing; then
1124                echo \$thisthing
1125                exit 0
1126        elif test -f \$dir/\$thing.exe; then
1127                : on Eunice apparently
1128                echo \$dir/\$thing
1129                exit 0
1130        fi
1131        ;;
1132        esac
1133done
1134echo \$dflt
1135exit 1
1136EOSC
1137chmod +x loc
1138$eunicefix loc
1139loclist="
1140awk
1141cat
1142expr
1143grep
1144rm
1145sed
1146touch
1147tr
1148"
1149trylist="
1150date
1151gcc
1152ln
1153test
1154uname
1155"
1156pth=`echo $PATH | sed -e "s/$p_/ /g"`
1157pth="$pth /lib /usr/lib"
1158for file in $loclist; do
1159        eval xxx=\$$file
1160        case "$xxx" in
1161        /*|?:[\\/]*)
1162                if test -f "$xxx"; then
1163                        : ok
1164                else
1165                        echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1166                        xxx=`./loc $file $file $pth`
1167                fi
1168                ;;
1169        '') xxx=`./loc $file $file $pth`;;
1170        *) xxx=`./loc $xxx $xxx $pth`;;
1171        esac
1172        eval $file=$xxx
1173        eval _$file=$xxx
1174        case "$xxx" in
1175        /*)
1176                echo "$file is in $xxx." > /dev/null
1177                ;;
1178        ?:[\\/]*)
1179                echo "$file is in $xxx." > /dev/null
1180                ;;
1181        *)
1182                echo "I don't know where '$file' is." >&4
1183                echo "Please, install it or fix your PATH settings!" >&4
1184                exit 1
1185                ;;
1186        esac
1187done
1188#echo " "
1189#echo "Don't worry if any of the following aren't found..."
1190say=offhand
1191for file in $trylist; do
1192        eval xxx=\$$file
1193        case "$xxx" in
1194        /*|?:[\\/]*)
1195                if test -f "$xxx"; then
1196                        : ok
1197                else
1198                        echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1199                        xxx=`./loc $file $file $pth`
1200                fi
1201                ;;
1202        '') xxx=`./loc $file $file $pth`;;
1203        *) xxx=`./loc $xxx $xxx $pth`;;
1204        esac
1205        eval $file=$xxx
1206        eval _$file=$xxx
1207        case "$xxx" in
1208        /*)
1209                echo "$file is in $xxx." > /dev/null
1210                ;;
1211        ?:[\\/]*)
1212                echo "$file is in $xxx." > /dev/null
1213                ;;
1214        *)
1215                echo "I don't see $file out there, $say."
1216                say=either
1217                ;;
1218        esac
1219done
1220case "$egrep" in
1221egrep)
1222#       echo "Substituting grep for egrep."
1223        egrep=$grep
1224        ;;
1225esac
1226case "$ln" in
1227ln)
1228#       echo "Substituting cp for ln."
1229        ln=$cp
1230        ;;
1231esac
1232case "$test" in
1233test)
1234        echo "Hopefully test is built into your sh." > /dev/null
1235        ;;
1236*)
1237        if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1238                echo "Using the test built into your sh." > /dev/null
1239                test=test
1240                _test=test
1241        fi
1242        ;;
1243esac
1244case "$echo" in
1245echo)
1246        echo "Hopefully echo is built into your sh." > /dev/null
1247        ;;
1248'') ;;
1249*)
1250#       echo " "
1251#echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1252        $echo $n "hi there$c" >foo1
1253        echo $n "hi there$c" >foo2
1254        if cmp foo1 foo2 >/dev/null 2>&1; then
1255                echo "They are compatible.  In fact, they may be identical." > /dev/null
1256        else
1257                case "$n" in
1258                '-n') n='' c='\c';;
1259                *) n='-n' c='';;
1260                esac
1261                cat <<FOO
1262They are not compatible!  You are probably running ksh on a non-USG system.
1263I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1264have echo built in and we may have to run some Bourne shell scripts.  That
1265means I'll have to use '$n$c' to suppress newlines now.
1266
1267FOO
1268                $echo $n "The star should be here-->$c"
1269                $echo "*"
1270        fi
1271        $rm -f foo1 foo2
1272        ;;
1273esac
1274
1275: determine whether symbolic links are supported
1276#echo " "
1277$touch blurfl
1278if $ln -s blurfl sym > /dev/null 2>&1 ; then
1279#       echo "Symbolic links are supported." >&4
1280        lns="$ln -s"
1281else
1282#       echo "Symbolic links are NOT supported." >&4
1283        lns="$ln"
1284fi
1285$rm -f blurfl sym
1286
1287: see whether [:lower:] and [:upper:] are supported character classes
1288#echo " "
1289up='[A-Z]'
1290low='[a-z]'
1291case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1292ABYZ)
1293#       echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1294        up='[:upper:]'
1295        low='[:lower:]'
1296        ;;
1297*)
1298#       echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1299        ;;
1300esac
1301: set up the translation script tr, must be called with ./tr of course
1302cat >tr <<EOSC
1303$startsh
1304case "\$1\$2" in
1305'[A-Z][a-z]') exec $tr '$up' '$low';;
1306'[a-z][A-Z]') exec $tr '$low' '$up';;
1307esac
1308exec $tr "\$@"
1309EOSC
1310chmod +x tr
1311$eunicefix tr
1312
1313: Try to determine whether config.sh was made on this system
1314case "$config_sh" in
1315'')
1316myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1317
1318mygcc=`( ($g++ -v) 2>/dev/null) 2>&1`
1319myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1320        ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1321newmyuname="$myuname"
1322dflt=n
1323case "$knowitall" in
1324'')
1325        if test -f ../config.sh; then
1326                if $contains myuname= ../config.sh >/dev/null 2>&1; then
1327                        eval "`grep myuname= ../config.sh`"
1328                fi
1329                if test "X$myuname" = "X$newmyuname"; then
1330                        dflt=y
1331                fi
1332        fi
1333        ;;
1334*) dflt=y;;
1335esac
1336
1337: Get old answers from old config file if Configure was run on the
1338: same system, otherwise use the hints.
1339hint=default
1340cd ../..
1341
1342        if $test -d $src/hints ; then
1343        (cd $src/hints; ls -C *.sh 2> /dev/null) | $sed 's/\.sh/   /g' >&4
1344        fi
1345        dflt=''
1346        : Half the following guesses are probably wrong... If you have better
1347        : tests or hints, please send them to Serguei.Sadilov@cern.ch
1348        : The metaconfig authors would also appreciate a copy...
1349        $test -f /irix && osname=irix
1350        $test -f /xenix && osname=sco_xenix
1351        $test -f /dynix && osname=dynix
1352        $test -f /dnix && osname=dnix
1353        $test -f /lynx.os && osname=lynxos
1354        $test -f /unicos && osname=unicos && osvers=`$uname -r`
1355        $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
1356        $test -f /bin/mips && /bin/mips && osname=mips
1357        $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1358                $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1359        $test -d /usr/apollo/bin && osname=apollo
1360        $test -f /etc/saf/_sactab && osname=svr4
1361        $test -d /usr/include/minix && osname=minix
1362        if $test -d /MachTen; then
1363                osname=machten
1364                if $test -x /sbin/version; then
1365                        osvers=`/sbin/version | $awk '{print $2}' |
1366                        $sed -e 's/[A-Za-z]$//'`
1367                elif $test -x /usr/etc/version; then
1368                        osvers=`/usr/etc/version | $awk '{print $2}' |
1369                        $sed -e 's/[A-Za-z]$//'`
1370                else
1371                        osvers="$2.$3"
1372                fi
1373        fi
1374        if $test -f $uname; then
1375                set X $myuname
1376                shift
1377
1378                case "$5" in
1379                fps*) osname=fps ;;
1380                mips*)
1381                        case "$4" in
1382                        umips) osname=umips ;;
1383                        *) osname=mips ;;
1384                        esac;;
1385                [23]100) osname=mips ;;
1386                next*) osname=next ;;
1387                news*) osname=news ;;
1388                i386*)
1389                        if $test -f /etc/kconfig; then
1390                                osname=isc
1391                                if test "$lns" = "ln -s"; then
1392                                        osvers=4
1393                                elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1394                                        osvers=3
1395                                elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1396                                        osvers=2
1397                                fi
1398                        fi
1399                        ;;
1400                esac
1401
1402                case "$1" in
1403                aix) osname=aix
1404                        tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1405                        case "$tmp" in
1406                        'not found') osvers="$4"."$3" ;;
1407                        '<3240'|'<>3240') osvers=3.2.0 ;;
1408                        '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1409                        '=3250'|'>3250') osvers=3.2.5 ;;
1410                        *) osvers=$tmp;;
1411                        esac
1412                        ;;
1413                *dc.osx) osname=dcosx
1414                        osvers="$3"
1415                        ;;
1416                dnix) osname=dnix
1417                        osvers="$3"
1418                        ;;
1419                cygwin*) osname=win32
1420                        ;;
1421                darwin*) osname=darwin
1422                        ;;
1423                domainos) osname=apollo
1424                        osvers="$3"
1425                        ;;
1426                dgux) osname=dgux
1427                        osvers="$3"
1428                        ;;
1429                dynixptx*) osname=dynixptx
1430                        osvers="$3"
1431                        ;;
1432                freebsd) osname=freebsd
1433                        osvers="$3" ;;
1434                genix) osname=genix ;;
1435                hp*) osname=hpux
1436                        case "$3" in
1437                        *.08.*) osvers=9 ;;
1438                        *.09.*) osvers=9 ;;
1439                        *.10.*) osvers=10 ;;
1440                        *)      osvers="$3" ;;
1441                        esac
1442                        ;;
1443                irix*) osname=irix
1444                        case "$3" in
1445                        4*) osvers=4 ;;
1446                        5*) osvers=5 ;;
1447                        *)      osvers="$3" ;;
1448                        esac
1449                        ;;
1450                linux) osname=linux
1451                        case "$3" in
1452                        1*) osvers=1 ;;
1453                        *)      osvers="$3" ;;
1454                        esac
1455                        ;;
1456                netbsd*) osname=netbsd
1457                        osvers="$3"
1458                        ;;
1459                bsd386) osname=bsd386
1460                        osvers=`$uname -r`
1461                        ;;
1462                next*) osname=next ;;
1463                solaris) osname=solaris
1464                        case "$3" in
1465                        5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1466                        *)      osvers="$3" ;;
1467                        esac
1468                        ;;
1469                sunos) osname=sunos
1470                        case "$3" in
1471                        5*) osname=solaris
1472                                osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1473                        *)      osvers="$3" ;;
1474                        esac
1475                        ;;
1476                titanos) osname=titanos
1477                        case "$3" in
1478                        1*) osvers=1 ;;
1479                        2*) osvers=2 ;;
1480                        3*) osvers=3 ;;
1481                        4*) osvers=4 ;;
1482                        *)      osvers="$3" ;;
1483                        esac
1484                        ;;
1485                ultrix) osname=ultrix
1486                        osvers="$3"
1487                        ;;
1488                osf1|mls+)      case "$5" in
1489                                alpha)
1490                                        osname=dec_osf
1491                                        osvers=`echo "$3" | sed 's/^[vt]//'`
1492                                        ;;
1493                        hp*)    osname=hp_osf1  ;;
1494                        mips)   osname=mips_osf1 ;;
1495                        esac
1496                        ;;
1497                uts) osname=uts
1498                        osvers="$3"
1499                        ;;
1500                qnx) osname=qnx
1501                        osvers="$4"
1502                        ;;
1503                $2) case "$osname" in
1504                        *isc*) ;;
1505                        *freebsd*) ;;
1506                        svr*)
1507                                : svr4.x or possibly later
1508                                case "svr$3" in
1509                                ${osname}*)
1510                                        osname=svr$3
1511                                        osvers=$4
1512                                        ;;
1513                                esac
1514                                case "$osname" in
1515                                svr4.0)
1516                                        : Check for ESIX
1517                                        if test -f /stand/boot ; then
1518                                                eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1519                                                if test -n "$INITPROG" -a -f "$INITPROG"; then
1520                        isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1521                                                        if test -n "$isesix"; then
1522                                                                osname=esix4
1523                                                        fi
1524                                                fi
1525                                        fi
1526                                        ;;
1527                                esac
1528                                ;;
1529                        *)      if test -f /etc/systemid; then
1530                                        osname=sco
1531                                        set `echo $3 | $sed 's/\./ /g'` $4
1532                                        if $test -f sco_$1_$2_$3.sh; then
1533                                                osvers=$1.$2.$3
1534                                        elif $test -f sco_$1_$2.sh; then
1535                                                osvers=$1.$2
1536                                        elif $test -f sco_$1.sh; then
1537                                                osvers=$1
1538                                        fi
1539                                else
1540                                        case "$osname" in
1541                                        '') : Still unknown.  Probably a generic Sys V.
1542                                                osname="sysv"
1543                                                osvers="$3"
1544                                                ;;
1545                                        esac
1546                                fi
1547                                ;;
1548                        esac
1549                        ;;
1550                *)      case "$osname" in
1551                        '') : Still unknown.  Probably a generic BSD.
1552                                osname="$1"
1553                                osvers="$3"
1554                                ;;
1555                        esac
1556                        ;;
1557                esac
1558        else
1559                if test -f /vmunix -a -f $src/hints/news_os.sh; then
1560                        (what /vmunix | .config/UU/tr '[A-Z]' '[a-z]') > .config/UU/kernel.what 2>&1
1561                        if $contains news-os .config/UU/kernel.what >/dev/null 2>&1; then
1562                                osname=news_os
1563                        fi
1564                        $rm -f .config/UU/kernel.what
1565                elif test -d c:/.; then
1566                        set X $myuname
1567                        osname=os2
1568                        osvers="$5"
1569                fi
1570        fi
1571        : Now look for a hint file osname_osvers, unless one has been
1572        : specified already.
1573        case "$hintfile" in
1574        ''|' ')
1575                file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
1576                : Also try without trailing minor version numbers.
1577                xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
1578                xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
1579                xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
1580                xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
1581                case "$file" in
1582                '') dflt=none ;;
1583                *)  case "$osvers" in
1584                        '') dflt=$file
1585                                ;;
1586                        *)  if $test -f $src/hints/$file.sh ; then
1587                                        dflt=$file
1588                                elif $test -f $src/hints/$xfile.sh ; then
1589                                        dflt=$xfile
1590                                elif $test -f $src/hints/$xxfile.sh ; then
1591                                        dflt=$xxfile
1592                                elif $test -f $src/hints/$xxxfile.sh ; then
1593                                        dflt=$xxxfile
1594                                elif $test -f $src/hints/$xxxxfile.sh ; then
1595                                        dflt=$xxxxfile
1596                                elif $test -f "$src/hints/${osname}.sh" ; then
1597                                        dflt="${osname}"
1598                                else
1599                                        dflt=none
1600                                fi
1601                                ;;
1602                        esac
1603                        ;;
1604                esac
1605                ;;
1606        *)
1607                dflt=`echo $hintfile | $sed 's/\.sh$//'`
1608                ;;
1609        esac
1610
1611if [ X$install = Xnever ] ; then
1612        $cat <<EOM
1613
1614You may give one or more space-separated answers, or "none" if appropriate.
1615If your OS version has no hints, DO NOT give a wrong version -- say "none".
1616
1617EOM
1618        rp="Which of these apply, if any?"
1619        . .config/UU/myread
1620        tans=$ans
1621        for file in $tans; do
1622                if $test -f $src/hints/$file.sh; then
1623                        . $src/hints/$file.sh
1624                        $cat $src/hints/$file.sh >> .config/UU/config.sh
1625                elif $test X$tans = X -o X$tans = Xnone ; then
1626                        : nothing
1627                else
1628                        : Give one chance to correct a possible typo.
1629                        echo "$file.sh does not exist"
1630                        dflt=$file
1631                        rp="hint to use instead?"
1632                        . .config/UU/myread
1633                        for file in $ans; do
1634                                if $test -f "$src/hints/$file.sh"; then
1635                                        . $src/hints/$file.sh
1636                                        $cat $src/hints/$file.sh >> .config/UU/config.sh
1637                                elif $test X$ans = X -o X$ans = Xnone ; then
1638                                        : nothing
1639                                else
1640                                        echo "$file.sh does not exist -- ignored."
1641                                fi
1642                        done
1643                fi
1644        done
1645fi
1646
1647        hint=recommended
1648        : Remember our hint file for later.
1649        if $test -f "$src/hints/$file.sh" ; then
1650                hintfile="$file"
1651        else
1652                hintfile=''
1653        fi
1654        : Sadilov: g4system.U - inserted here.
1655        : 'current' directory is where 'Configure' is started
1656#echo " "
1657case "$g4osname" in
1658
1659'')
1660        case "$osname" in
1661                'aix')          g4osname=AIX
1662                                ;;
1663                'dec_osf')      g4osname=DEC
1664                                ;;
1665                'hpux')         g4osname=HP
1666                                ;;
1667                'linux')        g4osname=Linux
1668                                ;;
1669                'irix')         g4osname=SGI
1670                                ;;
1671                'sunos')        g4osname=SUN
1672                                ;;
1673                'solaris')      g4osname=SUN
1674                                ;;
1675                'win32')        g4osname=WIN32
1676                                ;;
1677                'darwin')       g4osname=Darwin
1678                                ;;
1679        esac
1680esac
1681
1682#echo " "
1683
1684case  "$g4compiler" in
1685
1686'')     
1687        case "$g4osname" in
1688                'AIX')
1689                                g4compiler=xlC
1690                                ;;
1691                'DEC')
1692                                g4compiler=cxx
1693                                ;;
1694                'HP')
1695                                g4compiler=aCC
1696                                ;;
1697                'Linux')
1698#                               g4compiler=g++
1699# Assume if "gcc" is in place then "g++" is here
1700        gcccompiler=`( ($gcc -v) 1>/dev/null || echo "ERROR: There is no 'gcc' ('g++'?) compiler.") 2>&1`
1701                                case $gcccompiler in
1702                                *egcs*) g4compiler=egcs
1703                                ;;
1704                                *2.96*)
1705                                echo "WARNING: Found version of 'g++' (2.96.XXX) is known to be buggy!"
1706                                g4compiler="g++"
1707                                ;;
1708                                *) g4compiler="g++"
1709                                ;;
1710                                esac                           
1711
1712                                ;;
1713                'SGI')
1714                                g4compiler=CC
1715                                ;;
1716                'SUN')
1717                                g4compiler=CC
1718                                ;;
1719                'WIN32')
1720                                g4compiler=VC
1721        clcompiler=`( cl 1>/dev/null || echo "ERROR: There is no 'cl' compiler.") 2>&1`
1722                                case $clcompiler in
1723                                *"Version 12"*) g4compiler=VC6
1724                                ;;
1725                                *"Version 13"*) g4compiler=VC
1726                                ;;
1727                                *) g4compiler=VC
1728                                ;;
1729                                esac                           
1730                                ;;
1731                'Darwin')
1732                                g4compiler=g++
1733                                ;;
1734        esac
1735esac
1736
1737if [ X$g4system = X ] ; then
1738
1739if [ X$g4build = Xyes ] ; then
1740while test 1 = 1  ; do
1741
1742g4message=`cat << EOM
1743
1744Definition of G4SYSTEM variable is $g4osname-$g4compiler.
1745That stands for:
1746
17471) OS           : $g4osname
1748
17492) Compiler     : $g4compiler
1750
1751To modify default settings, select number above (e.g. 2)
1752EOM`
1753
1754dflt="Press [Enter] for default settings"
1755rp=$g4message
1756. .config/UU/myread
1757gans=$ans
1758
1759        case $gans in
1760
1761        1)
1762                case "$osname" in
1763                        'aix')
1764                                        g4osnamerec=AIX
1765                                        ;;
1766                        'dec_osf')
1767                                        g4osnamerec=DEC
1768                                        ;;
1769                        'hpux')
1770                                        g4osnamerec=HP
1771                                        ;;
1772                        'linux')
1773                                        g4osnamerec=Linux
1774                                        ;;
1775                        'irix')
1776                                        g4osnamerec=SGI
1777                                        ;;
1778                        'sunos')
1779                                        g4osnamerec=SUN
1780                                        ;;
1781                        'win32')
1782                                        g4osnamerec=WIN32
1783                                        ;;
1784                        'darwin')
1785                                        g4osnamerec=Darwin
1786                                        ;;
1787                esac
1788                dflt=$g4osname
1789                rp="What is your OS'?"
1790                . .config/UU/myread
1791                tans=$ans
1792
1793                if test X$tans != X$g4osnamerec ; then
1794                echo ""
1795
1796cat << EOM
1797
1798                You are running 'Configure' on NOT native platform!
1799                You are on your own way !!!
1800
1801EOM
1802
1803                dflt=$tans
1804                rp="Confirm your selection or set native '$g4osnamerec'!"
1805                . .config/UU/myread
1806                tans=$ans
1807                fi
1808
1809                g4osname=$tans
1810                ;;
1811        2)
1812                case "$g4osname" in
1813                        'AIX')
1814                                        g4compilerrec=xlC
1815                                        ;;
1816                        'DEC')
1817                                        g4compilerrec=cxx
1818                                        ;;
1819                        'HP')
1820                                        g4compilerrec=aCC
1821                                        ;;
1822                        'Linux')
1823                                        g4compilerrec=g++
1824                                        ;;
1825                        'SGI')
1826                                        g4compilerrec=CC
1827                                        ;;
1828                        'SUN')
1829                                        g4compilerrec=CC
1830                                        ;;
1831                        'WIN32')
1832                                        g4compilerrec=VC
1833                                        ;;
1834                        'Darwin')
1835                                        g4compilerrec=g++
1836                                        ;;
1837                esac
1838                dflt=$g4compiler
1839                rp="Which C++ compiler?"
1840                . .config/UU/myread
1841                tans=$ans
1842
1843                if test X$tans != X$g4compilerrec ; then
1844                echo ""
1845
1846cat << EOM
1847
1848                The recommmended compiler for this platform ($g4osname) is $g4compilerrec.
1849                You are on your own way !!!
1850
1851EOM
1852
1853                dflt=$tans
1854                rp="Confirm your selection or set recommended '$g4compilerrec'!"
1855                . .config/UU/myread
1856                tans=$ans
1857                fi
1858
1859                g4compiler=$tans
1860                ;;
1861#       [eE])
1862#               break
1863#               ;;
1864        *)
1865#               echo " "
1866                break
1867                ;;
1868        esac
1869done
1870
1871fi
1872
1873#
1874# Ask about compiler used.
1875#
1876g4system=$g4osname-$g4compiler
1877
1878fi
1879
1880#cat << EOM
1881#
1882#G4SYSTEM is now set to $g4system.
1883#
1884#EOM
1885
1886cd .config/UU
1887
1888myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1889myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1890        ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1891newmyuname="$myuname"
1892dflt=n
1893
1894cd ../..
1895
1896
1897if [ X$g4build = X ] ; then
1898
1899        if test -f $src/.config/bin/$g4system/env.sh; then
1900
1901        # create not_display flag
1902
1903if [ X$g4ldlibs != X -o X$g4ldflags != X -o X$g4cxxflags != X -o X$g4cppflags != X -o X$g4incflags != X ] ; then
1904        g4non_display=yes
1905#       echo g4non_display=$g4non_display
1906fi
1907
1908        if [ X$install = Xyes ] ; then
1909
1910        $rm -rf .config/UU
1911       
1912        . $src/.config/bin/$g4system/move.sh
1913
1914        exit 1
1915
1916        fi #end of cppflags
1917
1918        if [ X$g4cppflags = Xyes ] ; then
1919
1920        . $src/.config/bin/$g4system/env.sh
1921
1922        CPPFLAGS=`grep 'CPPFLAGS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'`
1923
1924#       echo CPPFLAGS=$CPPFLAGS
1925        echo $CPPFLAGS
1926       
1927        $rm -rf .config/UU
1928        exit 1
1929
1930        fi #end of cppflags
1931
1932        if [ X$g4cxxflags = Xyes ] ; then
1933
1934        . $src/.config/bin/$g4system/env.sh
1935
1936        CXXFLAGS=`grep 'CXXFLAGS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'`
1937
1938#       echo CXXFLAGS=$CXXFLAGS
1939        echo $CXXFLAGS
1940       
1941        $rm -rf .config/UU
1942        exit 1
1943
1944        fi #end of cxxflags
1945
1946
1947
1948        g4install_lib_AAA=`echo $g4install/lib|sed -e "s/\//AAA/g"`
1949        g4final_install_lib_AAA=`echo $g4final_install/lib/geant4|sed -e "s/\//AAA/g"`
1950       
1951
1952#############################################################################
1953        if [ X$g4incflags = Xyes ] ; then
1954
1955        . $src/.config/bin/$g4system/env.sh
1956
1957### Getting G4FIRST_INSTALL
1958        G4FIRST_INSTALL_AAA=`grep 'G4INSTALL =' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\)= //'|$sed -e 's/\//AAA/g'`
1959        G4INSTALL_AAA=`echo $G4INSTALL|sed -e "s/\//AAA/g"`
1960###
1961        INCFLAGS_AAA=`grep 'INCFLAGS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'|$sed -e 's/\//AAA/g'`
1962
1963#       echo INCFLAGS_AAA=$INCFLAGS_AAA
1964#       echo G4INSTALL_AAA=$G4INSTALL_AAA
1965#       echo G4FIRST_INSTALL_AAA=$G4FIRST_INSTALL_AAA
1966
1967        INCFLAGS_AAA_NEW=`echo $INCFLAGS_AAA| $sed -e "s/$G4FIRST_INSTALL_AAA/$G4INSTALL_AAA/g"`
1968
1969#       echo INCFLAGS_AAA_NEW=$INCFLAGS_AAA_NEW
1970
1971        INCFLAGS=`echo $INCFLAGS_AAA_NEW| $sed -e "s/AAA/\//g"`
1972
1973#       echo INCFLAGS=$INCFLAGS
1974
1975        if [ X$G4INCLUDE = X ] ; then
1976        echo $INCFLAGS
1977        else
1978        echo -I$G4INCLUDE
1979        fi
1980       
1981        $rm -rf .config/UU
1982        exit 1
1983
1984        fi #end of incflags
1985#############################################################################
1986
1987
1988#############################################################################
1989        if [ X$g4ldflags = Xyes ] ; then
1990
1991        . $src/.config/bin/$g4system/env.sh
1992
1993### Getting G4FIRST_INSTALL
1994        G4FIRST_LIB_AAA=`grep 'G4LIB =' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\)= //'|$sed -e 's/\//AAA/g'`
1995        G4LIB_AAA=`echo $G4LIB|sed -e "s/\//AAA/g"`
1996###
1997#       G4FIRST_INSTALL_LIB_AAA=${G4FIRST_INSTALL_AAA}AAAlib
1998#       G4INSTALL_LIB_AAA=${G4INSTALL_AAA}AAAlibAAAgeant4
1999
2000#       echo G4FIRST_INSTALL_LIB_AAA=$G4FIRST_INSTALL_LIB_AAA
2001#       echo G4INSTALL_LIB_AAA=$G4INSTALL_LIB_AAA
2002       
2003        LDFLAGS_AAA=`grep 'LDFLAGS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'|$sed -e 's/\//AAA/g'`
2004        LDFLAGS_AAA_NEW=`echo $LDFLAGS_AAA| $sed -e "s/$G4FIRST_LIB_AAA/$G4LIB_AAA/g"`
2005        LDFLAGS=`echo $LDFLAGS_AAA_NEW| $sed -e "s/AAA/\//g"`
2006
2007#       echo LDFLAGS=$LDFLAGS
2008        echo $LDFLAGS
2009       
2010        $rm -rf .config/UU
2011        exit 1
2012
2013        fi #end of ldflags
2014#############################################################################
2015
2016        if [ X$g4ldlibs = Xyes ] ; then
2017
2018#       cat >&2 <<EOM
2019#---------------------------------------------------
2020#LibList mode :)
2021#---------------------------------------------------
2022#EOM
2023       
2024        . $src/.config/bin/$g4system/env.sh
2025
2026#       echo TEST
2027
2028#       ls -l $G4INSTALL/config/scripts/GNUmakefile
2029#       ls -l $G4LIB/$G4SYSTEM/GNUmakefile.db
2030
2031#       LDLIBS_1=`grep 'LDLIBS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | awk -F := '{print $2}'`
2032#       LDLIBS_2=`echo $LDLIBS_1 | awk -F -lMarker '{print $2}'`
2033
2034#       echo LDLIBS_2=$LDLIBS_2
2035#       echo $LDLIBS_2
2036
2037        if [ X$G4LIB_USE_GRANULAR = X ] ; then
2038       
2039# Global libs
2040
2041###     LDLIBS_1=`grep 'LDLIBS_FINAL :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'`
2042###     LDLIBS_2=`echo $LDLIBS_1 | $sed  -e 's/^\(.*\)-lMarker//'`
2043###     echo "$LDLIBS_2 $c"
2044
2045        LIBLIST_LIST=`$G4LIB/$G4SYSTEM/liblist -m $G4LIB/$G4SYSTEM < $G4LIB/$G4SYSTEM/libname.map`
2046
2047        LDLIBS3=`grep 'LDLIBS3 :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'`
2048        LDLIBS4=`grep 'LDLIBS4 :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'`
2049
2050        LDLIBS=$LIBLIST_LIST $LDLIBS3 $LDLIBS4
2051
2052        echo $LDLIBS
2053
2054#       echo "-L$G4WORKDIR/lib/$G4SYSTEM -lG4persistency -lG4readout -lG4run -lG4event -lG4tracking -lG4parmodels -lG4processes -lG4digits+hits -lG4track -lG4particles -lG4geometry -lG4materials -lG4graphics_reps -lG4intercoms -lG4global $c"
2055
2056        $rm -rf .config/UU
2057        exit 1
2058
2059        else
2060
2061# Granular libs
2062
2063#       echo $n "-L$G4WORKDIR/lib/$G4SYSTEM $c" ; $G4WORKDIR/lib/$G4SYSTEM/liblist -m $G4WORKDIR/lib/$G4SYSTEM < $G4WORKDIR/lib/$G4SYSTEM/libname.map
2064
2065#       echo G4LIB=$G4LIB/$G4SYSTEM
2066
2067        LIBLIST_LIST=`$G4LIB/$G4SYSTEM/liblist -m $G4LIB/$G4SYSTEM < $G4LIB/$G4SYSTEM/libname.map`
2068
2069        LDLIBS3=`grep 'LDLIBS3 :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'`
2070        LDLIBS4=`grep 'LDLIBS4 :=' $G4LIB/$G4SYSTEM/GNUmakefile.db | $sed  -e 's/^\(.*\):=//'`
2071
2072        LDLIBS=$LIBLIST_LIST $LDLIBS3 $LDLIBS4 
2073
2074        echo $LDLIBS   
2075       
2076        $rm -rf .config/UU
2077
2078        exit 1
2079        fi #end of check for global/granular
2080
2081        else #if not -lib but user mode
2082
2083# header for User
2084echo " "
2085echo " "
2086echo " "
2087echo "                --- Geant4 Toolkit Installation  ---"
2088echo "                  (setting environments for USER )"
2089echo " "
2090echo " "
2091echo " "
2092
2093#cat << EOM
2094#
2095#G4SYSTEM is now set to $g4system.
2096#
2097#EOM
2098
2099        cat >&2 <<EOM
2100---------------------------------------------------
2101The Geant4 toolkit installation was found.
2102The files env.[c]sh will be copied to your current directory.
2103For setting Geant4 environments you should make:
2104
2105source env.csh
2106
2107or
2108
2109. env.sh
2110
2111It will also check G4WORKDIR setting and set it to
2112your HOME if needed.
2113You can use these files also for further modifications
2114(adding your own environments).
2115---------------------------------------------------
2116EOM
2117        $rm -rf .config/UU
2118
2119cp -i $src/.config/bin/$g4system/env.csh .
2120cp -i $src/.config/bin/$g4system/env.sh  .
2121
2122        exit 1
2123        fi #end of -lib or user
2124else #there is no env.sh
2125
2126# header for Installer
2127echo " "
2128echo " "
2129echo " "
2130echo "                --- Geant4 Toolkit Installation  ---"
2131echo " "
2132echo " "
2133echo " "
2134echo " "
2135
2136        echo " "
2137        echo "WARNING: Geant4 is NOT built yet!"
2138        echo "You (or the administrator if you have not enough privileges)"
2139        echo "should start with \$G4INSTALL/Configure -build."
2140        echo "(where \$G4INSTALL is Geant4 install directory)."
2141        echo " "
2142        $rm -rf .config/UU
2143        exit 1
2144 fi #end of check for existence of env.sh
2145fi #end of check for "not -install"
2146
2147cd .config/UU
2148
2149case "$knowitall" in
2150'')
2151        cd ../..
2152        if test -f $src/.config/bin/$g4system/config.sh; then
2153                if $contains myuname= $src/.config/bin/$g4system/config.sh >/dev/null 2>&1; then
2154                        eval "`grep myuname= $src/.config/bin/$g4system/config.sh`"
2155                fi
2156                if test "X$myuname" = "X$newmyuname"; then
2157                        dflt=y
2158                fi
2159        fi
2160        cd .config/UU
2161        ;;
2162*) dflt=y;;
2163esac
2164
2165cd ../..
2166
2167if test -f $src/.config/bin/$g4system/config.sh; then
2168        echo " "
2169        rp="There exists a config.sh file. Shall I use it to set the defaults?"
2170        . .config/UU/myread
2171        case "$ans" in
2172        n*|N*) echo "OK, I'll ignore it."; mv $src/.config/bin/$g4system/config.sh $src/.config/bin/$g4system/config.sh.old;;
2173        *)  echo "Fetching default answers from your old config.sh file..." >&4
2174                tmp_n="$n"
2175                tmp_c="$c"
2176                tmp_sh="$sh"
2177                . $src/.config/bin/$g4system/config.sh
2178                cp $src/.config/bin/$g4system/config.sh .config/UU
2179                n="$tmp_n"
2180                c="$tmp_c"
2181                : Older versions did not always set $sh.  Catch re-use of such
2182                : an old config.sh.
2183                case "$sh" in
2184                '') sh="$tmp_sh" ;;
2185                esac
2186                hint=previous
2187                ;;
2188        esac
2189fi
2190
2191cd .config/UU
2192;;
2193*)
2194        echo " "
2195        echo "Fetching default answers from $config_sh..." >&4
2196        tmp_n="$n"
2197        tmp_c="$c"
2198        cd ../..
2199        cp $config_sh config.sh 2>/dev/null
2200        chmod +w config.sh
2201        . ./config.sh
2202        cd .config/UU
2203        cp ../config.sh .
2204        n="$tmp_n"
2205        c="$tmp_c"
2206        hint=previous
2207        ;;
2208esac
2209test "$override" && . ./optdef.sh
2210myuname="$newmyuname"
2211
2212: Restore computed paths
2213for file in $loclist $trylist; do
2214        eval $file="\$_$file"
2215done
2216
2217
2218: who configured the system
2219cf_time=`$date 2>&1`
2220cf_by=`(logname) 2>/dev/null`
2221case "$cf_by" in
2222"")
2223        cf_by=`(whoami) 2>/dev/null`
2224        case "$cf_by" in
2225        "") cf_by=unknown ;;
2226        esac ;;
2227esac
2228
2229: decide how portable to be
2230case "$d_portable" in
2231"$define") dflt=y;;
2232*)      dflt=n;;
2233esac
2234$cat <<'EOH'
2235 
2236I can set things up so that your shell scripts and binaries are more portable,
2237at what may be a noticable cost in performance.  In particular, if you
2238ask to be portable, the following happens:
2239
2240     1) Shell scripts will rely on the PATH variable rather than using
2241        the paths derived above.
2242     2) ~username interpretations will be done at run time rather than
2243        by Configure.
2244
2245EOH
2246rp="Do you expect to run these scripts and binaries on multiple machines?"
2247. ./myread
2248case "$ans" in
2249        y*) d_portable="$define"
2250        ;;
2251        *)  d_portable="$undef" ;;
2252esac
2253
2254: set up shell script to do ~ expansion
2255cat >filexp <<EOSS
2256$startsh
2257: expand filename
2258case "\$1" in
2259 ~/*|~)
2260        echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2261        ;;
2262 ~*)
2263        if $test -f /bin/csh; then
2264                /bin/csh -f -c "glob \$1"
2265                failed=\$?
2266                echo ""
2267                exit \$failed
2268        else
2269                name=\`$expr x\$1 : '..\([^/]*\)'\`
2270                dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2271                if $test ! -d "\$dir"; then
2272                        me=\`basename \$0\`
2273                        echo "\$me: can't locate home directory for: \$name" >&2
2274                        exit 1
2275                fi
2276                case "\$1" in
2277                */*)
2278                        echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2279                        ;;
2280                *)
2281                        echo \$dir
2282                        ;;
2283                esac
2284        fi
2285        ;;
2286*)
2287        echo \$1
2288        ;;
2289esac
2290EOSS
2291chmod +x filexp
2292$eunicefix filexp
2293
2294: now set up to get a file name
2295cat <<EOS >getfile
2296$startsh
2297EOS
2298cat <<'EOSC' >>getfile
2299tilde=''
2300fullpath=''
2301already=''
2302skip=''
2303none_ok=''
2304exp_file=''
2305nopath_ok=''
2306orig_rp="$rp"
2307orig_dflt="$dflt"
2308
2309case "$fn" in
2310*\(*)
2311        expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2312        fn=`echo $fn | sed 's/(.*)//'`
2313        ;;
2314esac
2315
2316case "$fn" in
2317*:*)
2318        loc_file=`expr $fn : '.*:\(.*\)'`
2319        fn=`expr $fn : '\(.*\):.*'`
2320        ;;
2321esac
2322
2323case "$fn" in
2324*~*) tilde=true;;
2325esac
2326case "$fn" in
2327*/*) fullpath=true;;
2328esac
2329case "$fn" in
2330*+*) skip=true;;
2331esac
2332case "$fn" in
2333*n*) none_ok=true;;
2334esac
2335case "$fn" in
2336*e*) exp_file=true;;
2337esac
2338case "$fn" in
2339*p*) nopath_ok=true;;
2340esac
2341
2342case "$fn" in
2343*f*) type='File';;
2344*d*) type='Directory';;
2345*l*) type='Locate';;
2346esac
2347
2348what="$type"
2349case "$what" in
2350Locate) what='File';;
2351esac
2352
2353case "$exp_file" in
2354'')
2355        case "$d_portable" in
2356        "$define") ;;
2357        *) exp_file=true;;
2358        esac
2359        ;;
2360esac
2361
2362cd ../..
2363while test "$type"; do
2364        redo=''
2365        rp="$orig_rp"
2366        dflt="$orig_dflt"
2367        case "$tilde" in
2368        true) rp="$rp ";;
2369        esac
2370        . .config/UU/myread
2371        if test -f .config/UU/getfile.ok && \
2372                $contains "^$ans\$" .config/UU/getfile.ok >/dev/null 2>&1
2373        then
2374                value="$ans"
2375                ansexp="$ans"
2376                break
2377        fi
2378        case "$ans" in
2379        none)
2380                value=''
2381                ansexp=''
2382                case "$none_ok" in
2383                true) type='';;
2384                esac
2385                ;;
2386        *)
2387                case "$tilde" in
2388                '') value="$ans"
2389                        ansexp="$ans";;
2390                *)
2391                        value=`.config/UU/filexp $ans`
2392                        case $? in
2393                        0)
2394                                if test "$ans" != "$value"; then
2395                                        echo "(That expands to $value on this system.)"
2396                                fi
2397                                ;;
2398                        *) value="$ans";;
2399                        esac
2400                        ansexp="$value"
2401                        case "$exp_file" in
2402                        '') value="$ans";;
2403                        esac
2404                        ;;
2405                esac
2406                case "$fullpath" in
2407                true)
2408                        case "$ansexp" in
2409                        /*) value="$ansexp" ;;
2410                        *)
2411                                redo=true
2412                                case "$already" in
2413                                true)
2414                                echo "I shall only accept a full path name, as in /bin/ls." >&4
2415                                echo "Use a ! shell escape if you wish to check pathnames." >&4
2416                                        ;;
2417                                *)
2418                                echo "Please give a full path name, starting with slash." >&4
2419                                        case "$tilde" in
2420                                        true)
2421                                echo "Note that using ~username is ok provided it expands well." >&4
2422                                                already=true
2423                                                ;;
2424                                        esac
2425                                esac
2426                                ;;
2427                        esac
2428                        ;;
2429                esac
2430                case "$redo" in
2431                '')
2432                        case "$type" in
2433                        File)
2434                                if test -f "$ansexp"; then
2435                                        type=''
2436                                elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2437                                then
2438                                        echo "($value is not a plain file, but that's ok.)"
2439                                        type=''
2440                                fi
2441                                ;;
2442                        Directory)
2443                                if test -d "$ansexp"; then
2444                                        type=''
2445                                fi
2446                                ;;
2447                        Locate)
2448                                if test -d "$ansexp"; then
2449                                        echo "(Looking for $loc_file in directory $value.)"
2450                                        value="$value/$loc_file"
2451                                        ansexp="$ansexp/$loc_file"
2452                                fi
2453                                if test -f "$ansexp"; then
2454                                        type=''
2455                                fi
2456                                case "$nopath_ok" in
2457                                true)   case "$value" in
2458                                        */*) ;;
2459                                        *)      echo "Assuming $value will be in people's path."
2460                                                type=''
2461                                                ;;
2462                                        esac
2463                                        ;;
2464                                esac
2465                                ;;
2466                        esac
2467
2468                        case "$skip" in
2469                        true) type='';
2470                        esac
2471
2472                        case "$type" in
2473                        '') ;;
2474                        *)
2475                                if test "$fastread" = yes; then
2476                                        dflt=y
2477                                else
2478                                        dflt=n
2479                                fi
2480                                rp="$what $value doesn't exist.  Use that name anyway?"
2481                                . .config/UU/myread
2482                                dflt=''
2483                                case "$ans" in
2484                                y*) type='';;
2485                                *) echo " ";;
2486                                esac
2487                                ;;
2488                        esac
2489                        ;;
2490                esac
2491                ;;
2492        esac
2493done
2494cd .config/UU
2495ans="$value"
2496
2497# Check for Windows!
2498if test "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7"; then
2499
2500checkdrive=`echo $ans|cut -d"/" -f2`
2501
2502if test "X$checkdrive" = "Xcygdrive"; then
2503
2504windrive=`echo $ans|cut -d"/" -f3`
2505winpath=`echo $ans|cut -d"/" -f4-`
2506
2507fullwinpath="$windrive:/$winpath"
2508ans=$fullwinpath
2509
2510fi # if cygwin syntax is used
2511fi # if Win
2512
2513rp="$orig_rp"
2514dflt="$orig_dflt"
2515rm -f getfile.ok
2516EOSC
2517
2518echo " "
2519
2520#echo "SSS"
2521#echo `pwd`
2522#echo "SSS"
2523
2524if [ X$src = X. ] ; then
2525        cd ../..
2526        abssrc=`pwd`
2527        cd .config/UU
2528else
2529        abssrc=$src
2530fi
2531
2532case "$g4conf" in
2533'')
2534        g4conf=$abssrc/.config/bin/$g4system
2535        ;;
2536esac
2537
2538#echo "g4conf=$g4conf"
2539
2540case "$g4install" in
2541'')
2542if test $g4system = "WIN32-VC" -o $g4system = "WIN32-VC7"; then
2543#       g4install="c:/geant4"
2544        g4install=$abssrc
2545else
2546#       if [ X"$HOME" = X/ ] ; then
2547#       HOME=""
2548#       fi
2549#       g4install="$HOME"/geant4
2550        g4install=$abssrc
2551
2552fi
2553
2554# Check for Windows!
2555if test $g4system = "WIN32-VC" -o $g4system = "WIN32-VC7"; then
2556
2557checkdrive=`echo $g4install|cut -d"/" -f2`
2558
2559if test $checkdrive = "cygdrive"; then
2560
2561windrive=`echo $g4install|cut -d"/" -f3`
2562winpath=`echo $g4install|cut -d"/" -f4-`
2563
2564fullwinpath="$windrive:/$winpath"
2565g4install=$fullwinpath
2566
2567fi
2568fi
2569        ;;
2570esac
2571
2572case "$g4final_install" in
2573'')
2574        g4final_install=$g4install
2575        ;;
2576esac
2577
2578case "$g4workdir" in
2579'')
2580        g4workdir=$g4install
2581        ;;
2582esac
2583
2584case "$g4includes_flag" in
2585'')
2586        g4includes_flag=n
2587        ;;
2588esac
2589
2590
2591g4message=`cat << EOM
2592
2593Where is Geant4 source installed?
2594EOM`
2595
2596#dflt="NO DEFAULT ANSWER"
2597dflt=$g4install
2598fn='d~'
2599rp=$g4message
2600. ./getfile
2601g4install=$ans
2602g4workdir=$g4install
2603#################################
2604g4message=`cat << EOM
2605
2606Specify the path where Geant4 libraries and source files should be
2607installed.
2608EOM`
2609
2610#dflt="NO DEFAULT ANSWER"
2611dflt=$g4final_install
2612fn='d~'
2613rp=$g4message
2614. ./getfile
2615g4final_install=$ans
2616#g4workdir=$g4install
2617
2618##################################
2619g4message=`cat << EOM
2620
2621Do you want to copy all Geant4 headers
2622in one directory?
2623EOM`
2624
2625#dflt="NO DEFAULT ANSWER"
2626dflt=$g4includes_flag
2627#fn='d~'
2628rp=$g4message
2629. ./myread
2630g4includes_flag=$ans
2631
2632if [ X$g4includes_flag = Xy ] ; then
2633
2634case "$g4include" in
2635'')
2636        g4include=$g4install/include
2637#       g4include=''
2638        ;;
2639esac
2640
2641#g4message=`cat << EOM
2642#
2643#Where will be directory to copy all Geant4 headers?
2644#EOM`
2645#
2646##dflt="NO DEFAULT ANSWER"
2647####dflt=$g4install/include
2648#dflt=$g4include
2649#fn='d~+'
2650#rp=$g4message
2651#. ./getfile
2652#g4include=$ans
2653
2654# Set constantly!
2655if [ X$g4install != X$g4final_install ] ; then
2656g4include=$g4final_install/include/geant4
2657else
2658g4include=$g4final_install/include
2659fi
2660
2661fi
2662
2663#if test "X$g4include" = "X[NOT DEFINED]" ; then
2664#g4include=""
2665#fi
2666
2667echo " "
2668
2669case "$g4tmp" in
2670'')
2671        g4tmp=$g4workdir/tmp
2672        ;;
2673esac
2674
2675case "$g4lib" in
2676'')
2677        g4lib=$g4workdir/lib
2678        ;;
2679esac
2680
2681#case "$g4bin" in
2682#'')
2683#       g4bin=$g4workdir/bin
2684#       ;;
2685#esac
2686
2687while test 1 = 0  ; do
2688
2689g4message=`cat << EOM
2690
2691(OPTIONAL) You can now customise installation directories:
2692  G4TMP - tmp/ containing temporary dependency (.d) and object (.o) files;
2693  G4LIB - lib/ containing final static (.a) or shared (.so) libraries;
2694
26951) G4TMP:               $g4tmp
2696
26972) G4LIB:               $g4lib
2698
2699To modify default settings, select number above (e.g. 2)
2700EOM`
2701
2702#dflt="NO DEFAULT ANSWER"
2703dflt="Press [Enter] for default settings"
2704#fn='d~'
2705rp=$g4message
2706. ./myread
2707gans=$ans
2708
2709
2710        case $gans in
2711
2712        1)
2713                dflt=$g4tmp
2714                fn='d~+'
2715                rp="Where will be your Geant4 tmp directory?"
2716                . ./getfile
2717                g4tmp=$ans
2718                ;;
2719        2)
2720                dflt=$g4lib
2721                fn='d~+'
2722                rp="Where will be your Geant4 lib directory?"
2723                . ./getfile
2724                g4lib=$ans
2725                ;;
2726#       3)
2727#               dflt=$g4bin
2728#               fn='d~+'
2729#               rp="Where will be your Geant4 bin directory?"
2730#               . ./getfile
2731#               g4bin=$ans
2732#               ;;
2733
2734#       [eE])
2735#               break
2736#               ;;
2737        *)
2738                break
2739#               echo " "
2740                ;;
2741        esac
2742done
2743
2744echo " "
2745
2746case "$g4data" in
2747'')
2748        g4data=$g4install/data
2749        ;;
2750esac
2751
2752case "$g4levelgammadata" in
2753'')
2754        g4levelgammadata=$g4data/PhotonEvaporation2.0
2755        ;;
2756esac
2757
2758case "$g4radioactivedata" in
2759'')
2760        g4radioactivedata=$g4data/RadioactiveDecay3.2
2761        ;;
2762esac
2763
2764case "$g4ledata" in
2765'')
2766        g4ledata=$g4data/G4EMLOW6.1
2767        ;;
2768esac
2769
2770case "$g4neutronhpcrosssections" in
2771'')
2772        g4neutronhpcrosssections=$g4data/G4NDL3.12
2773        ;;
2774esac
2775
2776case "$g4abladata" in
2777'')
2778        g4abladata=$g4data/G4ABLA3.0
2779        ;;
2780esac
2781
2782
2783#case "$g4elasticdata" in
2784#'')
2785#       g4elasticdata=$g4data/G4ELASTIC1.1
2786#       ;;
2787#esac
2788
2789#########################################################################
2790
2791# while test 1 = 1  ; do
2792
2793g4message=`cat << EOM
2794
2795Please, specify default directory where ALL the Geant4 data is installed:
2796
2797 G4LEVELGAMMADATA:              $g4levelgammadata
2798
2799 G4RADIOACTIVEDATA:             $g4radioactivedata
2800
2801 G4LEDATA:                      $g4ledata
2802
2803 G4NEUTRONHPDATA:               $g4neutronhpcrosssections
2804
2805 G4ABLADATA:                    $g4abladata
2806
2807You will be asked about customizing these next.
2808
2809EOM`
2810
2811#dflt="NO DEFAULT ANSWER"
2812dflt=$g4data
2813#fn='d~'
2814rp=$g4message
2815#. ./myread
2816gans=$ans
2817
2818                dflt=$g4data
2819                fn='d~'
2820                . ./getfile
2821
2822                if [ X$g4data != X$ans ] ; then
2823                g4data=$ans
2824
2825                g4levelgammadata=$g4data/PhotonEvaporation2.0
2826                g4radioactivedata=$g4data/RadioactiveDecay3.2
2827                g4ledata=$g4data/G4EMLOW6.1
2828                g4neutronhpcrosssections=$g4data/G4NDL3.12
2829                g4abladata=$g4data/G4ABLA3.0
2830#               g4elasticdata=$g4data/G4ELASTIC1.1
2831                fi
2832# done
2833
2834###################################################################
2835
2836while test 1 = 1  ; do
2837
2838g4message=`cat << EOM
2839
2840Please, specify default directory where the Geant4 data is installed:
2841
28421) G4LEVELGAMMADATA:            $g4levelgammadata
2843
28442) G4RADIOACTIVEDATA:           $g4radioactivedata
2845
28463) G4LEDATA:                    $g4ledata
2847
28484) G4NEUTRONHPDATA:             $g4neutronhpcrosssections
2849
28505) G4ABLADATA:                  $g4abladata
2851
2852To modify default settings, select number above (e.g. 2)
2853EOM`
2854
2855#dflt="NO DEFAULT ANSWER"
2856dflt="Press [Enter] for default settings"
2857#fn='d~'
2858rp=$g4message
2859. ./myread
2860gans=$ans
2861
2862
2863        case $gans in
2864
2865        1)
2866                dflt=$g4levelgammadata
2867                fn='d~'
2868                rp="Where is Geant4 PhotonEvaporation2.0 data installed?"
2869                . ./getfile
2870                g4levelgammadata=$ans
2871                ;;
2872        2)
2873                dflt=$g4radioactivedata
2874                fn='d~'
2875                rp="Where is Geant4 RadioactiveDecay3.2 data installed?"
2876                . ./getfile
2877                g4radioactivedata=$ans
2878                ;;
2879        3)
2880                dflt=$g4ledata
2881                fn='d~'
2882                rp="Where is G4EMLOW6.1 data installed ?"
2883                . ./getfile
2884                g4ledata=$ans
2885                ;;
2886        4)
2887                dflt=$g4neutronhpcrosssections
2888                fn='d~'
2889                rp="Where is G4NDL3.12 data installed?"
2890                . ./getfile
2891                g4neutronhpcrosssections=$ans
2892                ;;
2893
2894        5)
2895                dflt=$g4abladata
2896                fn='d~'
2897                rp="Where is G4ABLA3.0 data installed?"
2898                . ./getfile
2899                g4abladata=$ans
2900                ;;
2901
2902#       5)
2903#               dflt=$g4elasticdata
2904#               fn='d~'
2905#               rp="Where is G4ELASTIC1.1 data installed?"
2906#               . ./getfile
2907#               g4elasticdata=$ans
2908#               ;;
2909
2910#       [eE])
2911#               break
2912#               ;;
2913        *)
2914                break
2915#               echo " "
2916                ;;
2917        esac
2918done
2919
2920
2921if test "X$g4clhep_base_dir" = "X" ; then
2922
2923clhep_dirs=`find $g4clhep_base_dir /usr/local/include /usr/include -type d -name CLHEP 2>/dev/null |xargs echo`
2924#echo clhep_dirs=$clhep_dirs
2925
2926fi
2927
2928if test "X$clhep_dirs" != "X" ; then
2929
2930g4clhep_base_dir_found=`echo $clhep_dirs|cut -d" " -f1`
2931#echo g4clhep_base_dir_found=$g4clhep_base_dir_found
2932
2933
2934#g4clhep_base_dir_n=`echo $g4clhep_base_dir_found |awk -F"/" '{print NF}'`
2935#echo g4clhep_base_dir_n=$g4clhep_base_dir_n
2936g4clhep_base_dir_found=`dirname $g4clhep_base_dir_found`
2937g4clhep_base_dir_found=`dirname $g4clhep_base_dir_found`
2938
2939        g4clhep_base_dir=$g4clhep_base_dir_found
2940
2941#else
2942#case "$g4clhep_base_dir" in
2943#'')
2944#       if test "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7"; then
2945#       g4clhep_base_dir="c:/usr/local"
2946#       else
2947#       g4clhep_base_dir=/usr/local
2948#       fi
2949#       ;;
2950#esac
2951fi
2952
2953
2954#while test 1 = 1  ; do
2955
2956#if test "X$g4clhep_base_dir" != "X" ; then
2957#clhep_dirs=$g4clhep_base_dir
2958#echo 1 g4clhep_base_dir=$g4clhep_base_dir
2959#fi
2960
2961if test "X$g4clhep_base_dir" != "X" ; then
2962
2963g4message=`cat << EOM
2964
2965Please, specify where CLHEP is installed. It was found in:
2966
2967CLHEP_BASE_DIR:                 $g4clhep_base_dir
2968
2969EOM`
2970
2971dflt=$g4clhep_base_dir
2972fn='d~'
2973rp=$g4message
2974. ./getfile
2975
2976cend="no"
2977while test "$cend" = "no" ; do
2978if test -e "$ans/include/CLHEP" ; then
2979cend="yes"
2980
2981g4clhep_base_dir=$ans
2982
2983else
2984
2985g4message=`cat << EOM
2986
2987Could not find CLHEP installed in $ans!
2988Please, specify where CLHEP is installed:
2989
2990CLHEP_BASE_DIR:                 
2991
2992EOM`
2993
2994dflt=""
2995fn='d~'
2996rp=$g4message
2997. ./getfile
2998fi
2999done
3000
3001else
3002
3003g4message=`cat << EOM
3004
3005Could not find CLHEP installed on this system!
3006Please, specify where CLHEP is installed:
3007
3008CLHEP_BASE_DIR:                 
3009
3010EOM`
3011
3012dflt=""
3013fn='d~'
3014rp=$g4message
3015. ./getfile
3016
3017cend="no"
3018while test "$cend" = "no" ; do
3019if test -e "$ans/include/CLHEP" ; then
3020cend="yes"
3021
3022g4clhep_base_dir=$ans
3023
3024else
3025
3026g4message=`cat << EOM
3027
3028Could not find CLHEP installed in $ans!
3029Please, specify where CLHEP is installed:
3030
3031CLHEP_BASE_DIR:                 
3032
3033EOM`
3034
3035dflt=""
3036fn='d~'
3037rp=$g4message
3038. ./getfile
3039fi
3040done
3041
3042fi
3043
3044#dflt="Press [Enter] for default settings"
3045#fn='d~'
3046#####rp=$g4message
3047#. ./myread
3048#gans=$ans
3049
3050#       case $gans in
3051
3052#       1)
3053##              dflt=""
3054##              fn='d~'
3055#               rp="Where is CLHEP installed?"
3056##              . ./getfile
3057##              g4clhep_base_dir=$ans
3058
3059#####           g4clhep_include_dir=$ans/include
3060#####           g4clhep_lib_dir=$ans/lib
3061#               ;;
3062#       2)
3063#               dflt=$g4clhep_include_dir
3064#               fn='d~'
3065#               rp="Where is CLHEP include directory?"
3066#               . ./getfile
3067#               g4clhep_include_dir=$ans
3068#               ;;
3069#       3)
3070#               dflt=$g4clhep_lib_dir
3071#               fn='d~'
3072#               rp="Where is CLHEP lib directory?"
3073#               . ./getfile
3074#               g4clhep_lib_dir=$ans
3075#               ;;
3076#       4)
3077#               dflt=$g4clhep_lib
3078#               rp="What is CLHEP lib title?"
3079#               . ./myread
3080#               g4clhep_lib=$ans
3081#               ;;
3082##      [eE])
3083##              break
3084##              ;;
3085#       *)
3086#               echo " "
3087#               break
3088#               ;;
3089#       esac
3090#done
3091
3092case "$g4clhep_include_dir" in
3093'')
3094        g4clhep_include_dir=$g4clhep_base_dir/include
3095        ;;
3096esac
3097
3098case "$g4clhep_lib_dir" in
3099'')
3100        g4clhep_lib_dir=$g4clhep_base_dir/lib
3101        ;;
3102esac
3103
3104case "$g4clhep_lib" in
3105'')
3106        if test "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7"; then
3107        g4clhep_lib="CLHEP.lib"
3108        else
3109        g4clhep_lib=CLHEP
3110        fi
3111        ;;
3112esac
3113
3114while test 1 = 1  ; do
3115
3116g4message_1=`cat << You
3117
3118You can customize paths and library name of you CLHEP installation:
3119
31201) CLHEP_INCLUDE_DIR:           $g4clhep_include_dir
31212) CLHEP_LIB_DIR:               $g4clhep_lib_dir
31223) CLHEP_LIB:                   $g4clhep_lib
3123
3124You`
3125
3126g4message_2=" need to use full library name with its extension (e.g. libCLHEP.lib)."
3127
3128g4message_3=`cat << EOM
3129
3130To modify default settings, select number above (e.g. 2)
3131EOM`
3132
3133
3134if test "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7"; then
3135rp=$g4message_1$g4message_3
3136else
3137rp=$g4message_1$g4message_2$g4message_3
3138fi
3139
3140dflt="Press [Enter] for default settings"
3141#fn='d~'
3142. ./myread
3143gans=$ans
3144
3145        case $gans in
3146
3147        1)
3148                dflt=$g4clhep_include_dir
3149                fn='d~'
3150                rp="Where is CLHEP include directory?"
3151                . ./getfile
3152                g4clhep_include_dir=$ans
3153                ;;
3154        2)
3155                dflt=$g4clhep_lib_dir
3156                fn='d~'
3157                rp="Where is CLHEP lib directory?"
3158                . ./getfile
3159                g4clhep_lib_dir=$ans
3160                ;;
3161        3)
3162                dflt=$g4clhep_lib
3163                rp="What is CLHEP lib title?"
3164                . ./myread
3165                g4clhep_lib=$ans
3166                ;;
3167#       [eE])
3168##              break
3169##              ;;
3170        *)
3171#               echo " "
3172                break
3173                ;;
3174        esac
3175done
3176
3177#if test "X$g4clhep_base_dir" = "X/usr" -o "X$g4clhep_base_dir" = "X/usr/local"; then
3178#g4clhep_base_dir=""
3179#fi
3180#
3181#if test "X$g4clhep_include_dir" = "X/usr/include" -o "X$g4clhep_include_dir" = "X/usr/local/include"; then
3182#g4clhep_include_dir=""
3183#fi
3184#
3185#if test "X$g4clhep_lib_dir" = "X/usr/lib" -o "X$g4clhep_lib_dir" = "X/usr/local/lib"; then
3186#g4clhep_lib_dir=""
3187#fi
3188
3189echo " "
3190
3191case "$g4lib_build_shared" in
3192'')
3193        g4lib_build_shared=n
3194        ;;
3195esac
3196
3197echo " "
3198
3199case "$g4lib_build_static" in
3200'')
3201        g4lib_build_static=n
3202        ;;
3203esac
3204
3205echo " "
3206
3207case "$g4lib_use_shared" in
3208'')
3209        g4lib_use_shared=n
3210        ;;
3211esac
3212
3213echo " "
3214
3215case "$g4lib_use_static" in
3216'')
3217        g4lib_use_static=n
3218        ;;
3219esac
3220
3221case "$g4lib_build_dll" in
3222'')
3223        g4lib_build_dll=n
3224        ;;
3225esac
3226
3227case "$g4lib_build_dyn" in
3228'')
3229        g4lib_build_dyn=n
3230        ;;
3231esac
3232
3233#
3234# Ask about building of SHARED|STATIC libraries - default STATIC.
3235#
3236echo ""
3237
3238if test "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7"; then
3239
3240while test 1 = 1  ; do
3241
3242g4message=`cat << EOM
3243
3244By default 'static'  libraries are built.
3245
3246Do you want to build DLL (.dll) libraries?
3247EOM`
3248
3249dflt=$g4lib_build_dll
3250rp=$g4message
3251. ./myread
3252gans=$ans
3253
3254        case $gans in
3255       
3256        n*|N*)
3257                g4lib_build_dll=n
3258                g4lib_build_shared=n
3259                g4lib_build_static=y
3260                break
3261                ;;
3262        y*|Y*)
3263                g4lib_build_dll=y
3264                g4lib_build_shared=n
3265                g4lib_build_static=n
3266
3267#               g4lib_build_static=""
3268#               g4lib_use_shared=1
3269#               g4lib_use_static=""
3270                break
3271                ;;
3272#       [eE])
3273#               break
3274#               ;;
3275#       *)
3276#               echo " "
3277#               break
3278#               ;;
3279        esac
3280done
3281
3282fi
3283
3284if test "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7" ; then
3285
3286while test 1 = 1  ; do
3287
3288g4message=`cat << EOM
3289
3290By default 'static' (.a) libraries are built.
3291
3292Do you want to build 'shared' (.so) libraries?
3293EOM`
3294
3295dflt=$g4lib_build_shared
3296rp=$g4message
3297. ./myread
3298gans=$ans
3299
3300        case $gans in
3301       
3302        n*|N*)
3303                g4lib_build_shared=n
3304                g4lib_build_static=y
3305                break
3306                ;;
3307        y*|Y*)
3308                g4lib_build_shared=y
3309#               g4lib_build_static=""
3310#               g4lib_use_shared=1
3311#               g4lib_use_static=""
3312                break
3313                ;;
3314#       [eE])
3315#               break
3316#               ;;
3317#       *)
3318#               echo " "
3319#               break
3320#               ;;
3321        esac
3322done
3323
3324if [ X$g4lib_build_shared = Xy ] ; then
3325#
3326# Ask about g4lib_build_static - default "n".
3327#
3328echo ""
3329
3330while test 1 = 1  ; do
3331
3332g4message=`cat << EOM
3333
3334You selected to build 'shared' (.so) libraries.
3335Do you want to build 'static' (.a) libraries too?
3336EOM`
3337
3338#dflt=$g4lib_build_static
3339dflt=n
3340rp=$g4message
3341. ./myread
3342gans=$ans
3343
3344        case $gans in
3345       
3346        n*|N*)
3347                g4lib_build_static=n
3348                break
3349                ;;
3350        y*|Y*)
3351#               g4lib_build_shared=1
3352                g4lib_build_static=y
3353#               g4lib_use_shared=1
3354#               g4lib_use_static=""
3355                break
3356                ;;
3357#       [eE])
3358#               break
3359#               ;;
3360#       *)
3361#               echo " "
3362#               break
3363#               ;;
3364        esac
3365done
3366
3367## Comment out in waiting G4LIB_USE_STATIC and G4LIB_USE_SHARED.
3368#
3369#if [ X$g4lib_build_static = Xy ] ; then
3370##
3371## Ask about g4lib_use_static - default "n".
3372##
3373#echo ""
3374#
3375#while test 1 = 1  ; do
3376#
3377#g4message=`cat << EOM
3378#
3379#You selected to build 'shared' (.so) and 'static' (.a) libraries.
3380#Do you want to use 'static' (.a) libraries?
3381#EOM`
3382#
3383#dflt=$g4lib_use_static
3384#rp=$g4message
3385#. ./myread
3386#gans=$ans
3387#
3388#       case $gans in
3389#       
3390#       n*|N*)
3391#               break
3392#               ;;
3393#       y*|Y*)
3394##              g4lib_build_shared=1
3395##              g4lib_build_static=1
3396##              g4lib_use_shared=1
3397#               g4lib_use_static=y
3398#               break
3399#               ;;
3400##      [eE])
3401##              break
3402##              ;;
3403##      *)
3404##              echo " "
3405##              break
3406##              ;;
3407#       esac
3408#done
3409#fi
3410
3411fi
3412
3413fi # if !Win
3414
3415echo " "
3416case "$g4global" in
3417'')
3418        g4global=n
3419        ;;
3420esac
3421
3422echo " "
3423# By default it's 'grabular'!
3424case "$g4granular" in
3425'')
3426        g4granular=y
3427        ;;
3428esac
3429
3430echo " "
3431# Will be set (if needed) in GNUmakefile!
3432case "$g4lib_use_granular" in
3433'')
3434        g4lib_use_granular=y
3435        ;;
3436esac
3437
3438if test \( \( "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7" \) -a "X$g4lib_build_dll" = "Xy" \) -o  \( "X$g4system" = "XDarwin-g++"  -a "X$g4lib_build_dyn" = "Xy" \) ; then
3439
3440        g4global=n
3441        g4granular=n
3442        g4lib_use_granular=n
3443
3444fi
3445
3446if test \( "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7" -a "X$g4system" != "XDarwin-g++" \) -o    \( \( "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7" \) -a "X$g4lib_build_dll" = "Xn" \) -o \( "X$g4system" = "XDarwin-g++" -a "X$g4lib_build_dyn" = "Xn" \) ; then
3447
3448#
3449# Ask about g4global - default "(empty)".
3450#
3451echo ""
3452
3453while test 1 = 1  ; do
3454
3455g4message=`cat << EOM
3456
3457Do you want to build 'global' compound libraries?
3458EOM`
3459
3460dflt=$g4global
3461rp=$g4message
3462. ./myread
3463gans=$ans
3464
3465        case $gans in
3466       
3467        n*|N*)
3468                g4global=n
3469                g4granular=y
3470                g4lib_use_granular=y
3471                break
3472                ;;
3473        y*|Y*)
3474                g4global=y
3475# Shoud be comment out to keep settings from config.sh - not now to keep as in release
3476                g4granular=n
3477# Shoud be comment out to keep settings from config.sh - not now to keep as in release
3478                g4lib_use_granular=n
3479                break
3480                ;;
3481#       [eE])
3482#               break
3483#               ;;
3484#       *)
3485#               echo " "
3486#               break
3487#               ;;
3488        esac
3489done
3490
3491if [ X$g4global = Xy ] ; then
3492#
3493# Ask about g4granular - default "n".
3494#
3495echo ""
3496
3497while test 1 = 1  ; do
3498
3499g4message=`cat << EOM
3500
3501Granular libraries are used by defaults, you asked to build global
3502compound libraries. Do you want to build 'granular' libraries too?
3503EOM`
3504
3505dflt=$g4granular
3506rp=$g4message
3507. ./myread
3508gans=$ans
3509
3510        case $gans in
3511       
3512        n*|N*)
3513                g4granular=n
3514                break
3515                ;;
3516        y*|Y*)
3517                g4granular=y
3518                break
3519                ;;
3520#       [eE])
3521#               break
3522#               ;;
3523#       *)
3524#               echo " "
3525#               break
3526#               ;;
3527        esac
3528done
3529
3530if [ X$g4granular = Xy ] ; then
3531#
3532# Ask about g4lib_use_granular - default "n".
3533#
3534echo ""
3535
3536while test 1 = 1  ; do
3537
3538g4message=`cat << EOM
3539
3540Global libraries are used by defaults, you asked to build global
3541compound libraries and granular libraries.
3542Do you want to use 'granular' libraries instead?
3543EOM`
3544
3545dflt=$g4lib_use_granular
3546rp=$g4message
3547. ./myread
3548gans=$ans
3549
3550        case $gans in
3551       
3552        n*|N*)
3553                g4lib_use_granular=n
3554                break
3555                ;;
3556        y*|Y*)
3557                g4lib_use_granular=y
3558                break
3559                ;;
3560#       [eE])
3561#               break
3562#               ;;
3563#       *)
3564#               echo " "
3565#               break
3566#               ;;
3567        esac
3568done
3569fi
3570fi
3571
3572fi # !Win
3573
3574### End file - without will be problem! Check in others...
3575
3576
3577echo " "
3578case "$g4debug" in
3579'')
3580        g4debug=n
3581        ;;
3582esac
3583
3584#
3585# Ask about g4debug - default "(empty)".
3586#
3587echo ""
3588
3589while test 1 = 1  ; do
3590
3591g4message=`cat << EOM
3592
3593Do you want to compile libraries in DEBUG mode (-g)?
3594EOM`
3595
3596dflt=$g4debug
3597rp=$g4message
3598. ./myread
3599gans=$ans
3600
3601        case $gans in
3602       
3603        n*|N*)
3604                break
3605                ;;
3606        y*|Y*)
3607                g4debug=y
3608                break
3609                ;;
3610#       [eE])
3611#               break
3612#               ;;
3613#       *)
3614#               echo " "
3615#               break
3616#               ;;
3617        esac
3618done
3619
3620
3621echo " "
3622
3623case "$g4ui_none" in
3624'')
3625        g4ui_none=n
3626        ;;
3627esac
3628
3629# Set by default!
3630case "$g4ui_build_terminal_session" in
3631'')
3632        g4ui_build_terminal_session=y
3633        ;;
3634esac
3635
3636# Set by default!
3637case "$g4ui_use_terminal" in
3638'')
3639        g4ui_use_terminal=y
3640        ;;
3641esac
3642
3643# Set by default!
3644case "$g4ui_build_gag_session" in
3645'')
3646        g4ui_build_gag_session=y
3647        ;;
3648esac
3649
3650# Set by default!
3651case "$g4ui_use_gag" in
3652'')
3653        g4ui_use_gag=y
3654        ;;
3655esac
3656
3657case "$g4ui_build_xm_session" in
3658'')
3659        g4ui_build_xm_session=n
3660        ;;
3661esac
3662
3663case "$g4ui_use_xm" in
3664'')
3665        g4ui_use_xm=n
3666        ;;
3667esac
3668
3669case "$g4ui_build_xaw_session" in
3670'')
3671        g4ui_build_xaw_session=n
3672        ;;
3673esac
3674
3675case "$g4ui_use_xaw" in
3676'')
3677        g4ui_use_xaw=n
3678        ;;
3679esac
3680
3681case "$g4ui_build_win32_session" in
3682'')
3683        g4ui_build_win32_session=n
3684        ;;
3685esac
3686
3687case "$g4ui_use_win32" in
3688'')
3689        g4ui_use_win32=n
3690        ;;
3691esac
3692
3693# Set by default!
3694case "$g4ui_use_tcsh" in
3695'')
3696        g4ui_use_tcsh=y
3697        ;;
3698esac
3699
3700
3701
3702
3703echo ""
3704
3705g4message=`cat << EOM
3706
3707  G4UI_NONE
3708
3709If this variable is set, no UI sessions nor any UI libraries are built.
3710This can be useful when running a pure batch job or in a user framework
3711having its own UI system.
3712Do you want to set this variable ?
3713
3714EOM`
3715
3716dflt=$g4ui_none
3717rp=$g4message
3718. ./myread
3719gans=$ans
3720
3721        case $gans in
3722       
3723        n*|N*)
3724                g4ui_none=n
3725                ;;
3726        y*|Y*)
3727                g4ui_none=y
3728                ;;
3729        esac
3730
3731case $g4ui_none in
3732
3733n)
3734
3735g4message=`cat << EOM
3736
3737  G4UI_BUILD_TERMINAL_SESSION
3738  Specifies to include in kernel library a basic dumb terminal
3739  user interface (default).
3740
3741  G4UI_USE_TERMINAL
3742  Specifies to use dumb terminal interface in the application to be
3743  built (default).
3744EOM`
3745
3746dflt=$g4ui_use_terminal
3747rp=$g4message
3748#. ./myread
3749#gans=$ans
3750gans=y
3751
3752        case $gans in
3753       
3754        n*|N*)
3755                g4ui_build_terminal_session=n
3756                g4ui_use_terminal=n
3757                ;;
3758        y*|Y*)
3759                g4ui_build_terminal_session=y
3760                g4ui_use_terminal=y
3761                ;;
3762        esac
3763
3764g4message=`cat << EOM
3765
3766  G4UI_BUILD_GAG_SESSION
3767  Specifies to include in kernel library the GAG based
3768  user interface.
3769
3770  G4UI_USE_GAG
3771  Specifies to use the GAG interface in the application to be
3772  built.
3773EOM`
3774
3775dflt=$g4ui_use_gag
3776rp=$g4message
3777#. ./myread
3778#gans=$ans
3779gans=y
3780
3781        case $gans in
3782       
3783        n*|N*)
3784                g4ui_build_gag_session=n
3785                g4ui_use_gag=n
3786                ;;
3787        y*|Y*)
3788                g4ui_build_gag_session=y
3789                g4ui_use_gag=y
3790                ;;
3791        esac
3792
3793if test "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7"; then
3794
3795g4message=`cat << EOM
3796
3797  G4UI_BUILD_XAW_SESSION
3798  G4UI_USE_XAW
3799
3800  Specifies to include and use the XAW interfaces in the
3801  application to be built.
3802  The XAW (X11 Athena Widget set) extensions are required to activate
3803  and build this driver.
3804EOM`
3805
3806dflt=$g4ui_use_xaw
3807rp=$g4message
3808. ./myread
3809gans=$ans
3810
3811        case $gans in
3812       
3813        n*|N*)
3814                g4ui_build_xaw_session=n
3815                g4ui_use_xaw=n
3816                ;;
3817        y*|Y*)
3818                g4ui_build_xaw_session=y
3819                g4ui_use_xaw=y
3820                ;;
3821        esac
3822
3823############################################################
3824############################################################
3825
3826if test "X$g4ui_build_xaw_session" = "Xy" ; then
3827
3828if test "X$g4ui_xawhome" = "X" ; then
3829xaw_dirs=`find $g4ui_xawhome /usr/X11R6/include /usr/local/include /usr/include /sw/include -type d -name Xaw 2>/dev/null |xargs echo`
3830#echo ogl_dirs=$ogl_dirs
3831
3832if test "X$xaw_dirs" != "X" ; then
3833
3834g4xaw_base_dir_found=`echo $xaw_dirs|cut -d" " -f1`
3835#echo g4ogl_base_dir_found=$g4ogl_base_dir_found
3836
3837# That's right: should be 3 times! (e.g./usr/local/lib/libGLU.so -> /usr/local)
3838g4xaw_base_dir_found=`dirname $g4xaw_base_dir_found`
3839g4xaw_base_dir_found=`dirname $g4xaw_base_dir_found`
3840g4xaw_base_dir_found=`dirname $g4xaw_base_dir_found`
3841
3842        g4ui_xawhome=$g4xaw_base_dir_found
3843#else
3844#case "$g4ui_xawhome" in
3845#'')
3846#       g4ui_xawhome=/usr/X11R6/
3847#       ;;
3848#esac
3849fi
3850fi
3851
3852##########################################################################
3853
3854#if test "X$g4ui_xawhome" != "X" ; then
3855#xaw_dirs=$g4ui_xawhome
3856#fi
3857
3858if test "X$g4ui_xawhome" != "X" ; then
3859
3860g4message=`cat << EOM
3861
3862You have selected to use the XAW based user interfaces.
3863Specify the correct path where XAW is installed in your system.
3864It was found in $g4ui_xawhome. Press [Enter] to set this path or type the correct one.
3865
3866You can set '-' (without quotation) to CANCEL the XAW flag at all:
3867
3868EOM`
3869
3870dflt=$g4ui_xawhome
3871fn='d~(-)'
3872rp=$g4message
3873. ./getfile
3874
3875cend="no"
3876while test "$cend" = "no" ; do
3877if test -e "$ans/include/X11/Xaw" || [ "X$ans" = "X-"  ]; then
3878cend="yes"
3879if test "X$ans" != "X-" ; then
3880
3881g4ui_xawhome=$ans
3882
3883else
3884
3885g4ui_build_xaw_session=n
3886g4ui_use_xaw=n
3887
3888fi
3889else
3890
3891g4message=`cat << EOM
3892
3893You have selected to use XAW based user interfaces.
3894But XAW was not found in $ans.
3895Please specify the correct path where XAW is installed in your system.
3896
3897You can set '-' (without quotation) to CANCEL the XAW flag at all:
3898
3899EOM`
3900
3901dflt=""
3902fn='d~(-)'
3903rp=$g4message
3904. ./getfile
3905fi
3906done
3907
3908else
3909
3910g4message=`cat << EOM
3911
3912You have selected to use XAW based user interfaces.
3913But XAW was not found in expected place.
3914Please specify the correct path where XAW is installed in your system.
3915
3916You can set '-' (without quotation) to CANCEL the XAW flag at all:
3917
3918EOM`
3919
3920dflt=""
3921fn='d~(-)'
3922rp=$g4message
3923. ./getfile
3924
3925cend="no"
3926while test "$cend" = "no" ; do
3927if test -e "$ans/include/X11/Xaw" || [ "X$ans" = "X-"  ]; then
3928cend="yes"
3929if test "X$ans" != "X-" ; then
3930
3931g4ui_xawhome=$ans
3932
3933else
3934
3935g4ui_build_xaw_session=n
3936g4ui_use_xaw=n
3937
3938fi
3939else
3940
3941g4message=`cat << EOM
3942
3943You have selected to use XAW based user interfaces.
3944But XAW was not found in $ans.
3945Please specify the correct path where XAW is installed in your system.
3946
3947You can set '-' (without quotation) to CANCEL the XAW flag at all:
3948
3949EOM`
3950
3951dflt=""
3952fn='d~(-)'
3953rp=$g4message
3954. ./getfile
3955fi
3956done
3957fi
3958
3959if test "X$g4osname" = "XLinux"; then
3960
3961if test "X$g4ui_xawhome" = "X/usr" -o "X$g4ui_xawhome" = "X/usr/local" ; then
3962g4ui_xawhome=""
3963fi
3964fi
3965fi # g4vis_build_opheglxm_driver
3966
3967###############################################
3968# Set XMFLAGS and XMLIBS
3969#
3970
3971if test "X$g4ui_build_xaw_session" = "Xy" ; then
3972
3973if test "X$g4osname" = "XAIX" ; then
3974g4ui_xawflags=" -I$g4ui_xawhome/include "
3975g4ui_xawlibs=" -L$g4ui_xawhome/lib -lXaw -lXmu -lXt -lX11 -lXext "
3976fi
3977
3978if test "X$g4osname" = "XLinux" ; then
3979g4ui_xawflags=" -I$g4ui_xawhome/include "
3980        if test "X$g4ui_xawhome" = "X/usr/X11R6" ; then
3981                g4ui_xawlibs=" -lXaw "
3982        else
3983                g4ui_xawlibs=" -L$g4ui_xawhome/lib -lXaw "
3984        fi
3985fi
3986
3987if test "X$g4osname" = "XDarwin" ; then
3988g4ui_xawflags=" -I$g4ui_xawhome/include "
3989g4ui_xawlibs=" -L$g4ui_xawhome/lib -lXaw "
3990fi
3991
3992if test "X$g4osname" = "XDEC" ; then
3993g4ui_xawflags=" -I$g4ui_xawhome/include "
3994g4ui_xawlibs=" -L$g4ui_xawhome/lib -lXaw "
3995fi
3996
3997if test "X$g4osname" = "XHP" ; then
3998g4ui_xawflags=" -I$g4ui_xawhome/include "
3999g4ui_xawlibs=" -L$g4ui_xawhome/lib -lXaw "
4000fi
4001
4002if test "X$g4osname" = "XSGI" ; then
4003g4ui_xawflags=" -I$g4ui_xawhome/include "
4004g4ui_xawlibs=" -L$g4ui_xawhome/lib -lXaw "
4005fi
4006
4007if test "X$g4osname" = "XSUN" ; then
4008g4ui_xawflags=" -I$g4ui_xawhome/include "
4009g4ui_xawlibs=" -L$g4ui_xawhome/lib -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib -R/usr/openwin/lib -lXaw -lXmu -lXt -lX11 -lXext "
4010fi
4011
4012fi # end of XM build
4013
4014###############################################
4015###############################################
4016
4017g4message=`cat << EOM
4018
4019  G4UI_BUILD_XM_SESSION
4020  G4UI_USE_XM
4021
4022  Specifies to include and use the XM Motif based user interfaces.
4023  The XM Motif extensions are required to activate and build this
4024  driver.
4025
4026EOM`
4027
4028dflt=$g4ui_use_xm
4029rp=$g4message
4030. ./myread
4031gans=$ans
4032
4033        case $gans in
4034       
4035        n*|N*)
4036                g4ui_build_xm_session=n
4037                g4ui_use_xm=n
4038                ;;
4039        y*|Y*)
4040                g4ui_build_xm_session=y
4041                g4ui_use_xm=y
4042                ;;
4043        esac
4044
4045
4046############################################################
4047############################################################
4048
4049if test "X$g4ui_build_xm_session" = "Xy" ; then
4050
4051if test "X$g4vis_xmhome" = "X" ; then
4052xm_dirs=`find $g4vis_xmhome /usr/X11R6/include /usr/local/include /usr/include /sw/include -type d -name Xm 2>/dev/null |xargs echo`
4053#echo ogl_dirs=$ogl_dirs
4054
4055if test "X$xm_dirs" != "X" ; then
4056
4057g4xm_base_dir_found=`echo $xm_dirs|cut -d" " -f1`
4058#echo g4ogl_base_dir_found=$g4ogl_base_dir_found
4059
4060# That's right: should be twice! (e.g./usr/local/lib/libGLU.so -> /usr/local)
4061g4xm_base_dir_found=`dirname $g4xm_base_dir_found`
4062g4xm_base_dir_found=`dirname $g4xm_base_dir_found`
4063
4064        g4vis_xmhome=$g4xm_base_dir_found
4065#else
4066#case "$g4vis_xmhome" in
4067#'')
4068#       g4vis_xmhome=/usr/X11R6/
4069#       ;;
4070#esac
4071fi
4072fi
4073
4074##########################################################################
4075
4076#if test "X$g4vis_xmhome" != "X" ; then
4077#xm_dirs=$g4vis_xmhome
4078#fi
4079
4080if test "X$g4vis_xmhome" != "X" ; then
4081
4082g4message=`cat << EOM
4083
4084You have selected to use the XM Motif based user interfaces.
4085Specify the correct path where Xm is installed in your system.
4086It was found in $g4vis_xmhome. Press [Enter] to set this path or type the correct one.
4087
4088You can set '-' (without quotation) to CANCEL the XM flag at all:
4089
4090EOM`
4091
4092dflt=$g4vis_xmhome
4093fn='d~(-)'
4094rp=$g4message
4095. ./getfile
4096
4097cend="no"
4098while test "$cend" = "no" ; do
4099if test -e "$ans/include/Xm" || [ "X$ans" = "X-"  ]; then
4100cend="yes"
4101if test "X$ans" != "X-" ; then
4102
4103g4vis_xmhome=$ans
4104
4105else
4106
4107g4ui_build_xm_session=n
4108g4ui_use_xm=n
4109
4110fi
4111else
4112
4113g4message=`cat << EOM
4114
4115You have selected to use XM Motif based user interfaces.
4116But XM Motif was not found in $ans.
4117Please specify the correct path where Xm is installed in your system.
4118
4119You can set '-' (without quotation) to CANCEL the XM flag at all:
4120
4121EOM`
4122
4123dflt=""
4124fn='d~(-)'
4125rp=$g4message
4126. ./getfile
4127fi
4128done
4129
4130else
4131
4132g4message=`cat << EOM
4133
4134You have selected to use XM Motif based user interfaces.
4135But XM Motif was not found in expected place.
4136Please specify the correct path where Xm is installed in your system.
4137
4138You can set '-' (without quotation) to CANCEL the XM flag at all:
4139
4140EOM`
4141
4142dflt=""
4143fn='d~(-)'
4144rp=$g4message
4145. ./getfile
4146
4147cend="no"
4148while test "$cend" = "no" ; do
4149if test -e "$ans/include/Xm" || [ "X$ans" = "X-"  ]; then
4150cend="yes"
4151if test "X$ans" != "X-" ; then
4152
4153g4vis_xmhome=$ans
4154
4155else
4156
4157g4ui_build_xm_session=n
4158g4ui_use_xm=n
4159
4160fi
4161else
4162
4163g4message=`cat << EOM
4164
4165You have selected to use XM Motif based user interfaces.
4166But XM Motif was not found in $ans.
4167Please specify the correct path where Xm is installed in your system.
4168
4169You can set '-' (without quotation) to CANCEL the XM flag at all:
4170
4171EOM`
4172
4173dflt=""
4174fn='d~(-)'
4175rp=$g4message
4176. ./getfile
4177fi
4178done
4179fi
4180
4181if test "X$g4osname" = "XLinux"; then
4182
4183if test "X$g4vis_xmhome" = "X/usr" -o "X$g4vis_xmhome" = "X/usr/local" ; then
4184g4vis_xmhome=""
4185fi
4186fi
4187fi # g4vis_build_opheglxm_driver
4188
4189###############################################
4190# Set XMFLAGS and XMLIBS
4191#
4192
4193if test "X$g4ui_build_xm_session" = "Xy" ; then
4194
4195if test "X$g4osname" = "XAIX" ; then
4196g4vis_xmflags=" -I$g4vis_xmhome/include "
4197g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm -lXt -lX11 "
4198fi
4199
4200if test "X$g4osname" = "XLinux" ; then
4201g4vis_xmflags=" -I$g4vis_xmhome/include "
4202        if test "X$g4vis_xmhome" = "X/usr/X11R6" ; then
4203                g4vis_xmlibs=" -lXm -lXpm "
4204        else
4205                g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm -lXpm "
4206        fi
4207fi
4208
4209if test "X$g4osname" = "XDarwin" ; then
4210g4vis_xmflags=" -I$g4vis_xmhome/include "
4211g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm -lXpm "
4212fi
4213
4214if test "X$g4osname" = "XDEC" ; then
4215g4vis_xmflags=" -I$g4vis_xmhome/include "
4216g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm "
4217fi
4218
4219if test "X$g4osname" = "XHP" ; then
4220g4vis_xmflags=" -I$g4vis_xmhome/include/Motif1.2 "
4221g4vis_xmlibs=" -L$g4vis_xmhome/lib/Motif1.2 -lXm "
4222fi
4223
4224if test "X$g4osname" = "XSGI" ; then
4225g4vis_xmflags=" -I$g4vis_xmhome/include "
4226g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm "
4227fi
4228
4229if test "X$g4osname" = "XSUN" ; then
4230g4vis_xmflags=" -I$g4vis_xmhome/include "
4231g4vis_xmlibs=" -L$g4vis_xmhome/lib -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib -R/usr/openwin/lib -lXt -lXm -lX11 "
4232fi
4233
4234fi # end of XM build
4235
4236###############################################
4237###############################################
4238
4239fi # if !WIN
4240
4241if test "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7"; then
4242
4243g4message=`cat << EOM
4244
4245  G4UI_BUILD_WIN32_SESSION
4246  G4UI_USE_WIN32
4247
4248  Specifies to include and use the terminal interface for
4249  Windows systems.
4250
4251EOM`
4252
4253dflt=$g4ui_use_win32
4254rp=$g4message
4255. ./myread
4256gans=$ans
4257
4258        case $gans in
4259       
4260        n*|N*)
4261                g4ui_build_win32_session=n
4262                g4ui_use_win32=n
4263                ;;
4264        y*|Y*)
4265                g4ui_build_win32_session=y
4266                g4ui_use_win32=y
4267                ;;
4268        esac
4269
4270fi # if WIN
4271
4272g4message=`cat << EOM
4273
4274  G4UI_USE_TCSH
4275  Specifies to use the tcsh-style terminal in the application
4276  to be built.
4277EOM`
4278
4279dflt=$g4ui_use_tcsh
4280rp=$g4message
4281#. ./myread
4282#gans=$ans
4283gans=y
4284
4285        case $gans in
4286       
4287        n*|N*)
4288                g4ui_use_tcsh=n
4289                ;;
4290        y*|Y*)
4291                g4ui_use_tcsh=y
4292                ;;
4293        esac
4294
4295;;
4296esac
4297
4298#
4299# BEGIN QT/QTUI PROBE
4300#
4301
4302#
4303# We only perform the query/probe for Linux-g++ and Darwin-g++ systems..
4304#
4305if test "x$g4system" = "xLinux-g++" -o "x$g4system" = "xDarwin-g++" ; then
4306
4307# Now, IF g4ui_none HAS NOT BEEN SET TO Y, proceed to the query/probe section
4308if test "x$g4ui_none" = "xn" ; then
4309
4310   # Query the user to see if they want to build the Qt UI module
4311
4312   g4message=`cat << EOM
4313
4314   G4UI_BUILD_QT_SESSION
4315   G4UI_USE_QT
4316
4317Setting these variables will enable the building of the G4 Qt based
4318user interface module and the use of this module in your applications
4319respectively.
4320The Qt4 headers, libraries and binaries are required to enable the
4321building of this module.
4322### WARNING! THIS FEATURE IS EXPERIMENTAL IN THIS RELEASE! ###
4323### WARNING! THIS FEATURE WILL ONLY WORK WITH Qt4!         ###
4324Do you want to enable build and use of this module?
4325EOM`
4326
4327   #
4328   # read in the user response
4329   #
4330   dflt=$g4ui_build_qt_session
4331   rp=$g4message
4332   . ./myread
4333   gans=$ans
4334
4335   #
4336   # Check response
4337   #
4338   case $gans in
4339        n*|N*)
4340                g4ui_build_qt_session=n
4341                g4ui_use_qt=n
4342                ;;
4343        y*|Y*)
4344                g4ui_build_qt_session=y
4345                g4ui_use_qt=y
4346                ;;
4347   esac
4348
4349
4350   #########################################
4351
4352
4353   #####################################################################
4354   # Now, if we want to build/use the Qt UI module, we need to probe for
4355   # a Qt4 installation
4356   #
4357   if test "x$g4ui_build_qt_session" = "xy" ; then
4358
4359      echo " "
4360      g4_havegoodqt=no
4361
4362      g4_qthome=`./loc qglobal.h no /usr/include/Qt /usr/local/include/Qt /opt/local/include/Qt /sw/include/Qt`
4363
4364      echo "checking for Qt4 installation... $g4_qthome"
4365
4366      #If we found an installation, proceed to other tests.
4367      if test "x$g4_qthome" != "xno" ; then
4368
4369         #Set Qt installation to good at this point
4370         g4_havegoodqt=yes
4371     
4372        #Check that this is Qt4...
4373        g4_qtver=`$grep QT_VERSION_STR $g4_qthome | $sed 's/.* \"\([0-9]\)\..*\"/\1/'`
4374
4375        echo "checking Qt version... $g4_qtver"
4376
4377        #Now strip qthome back so we can check for moc...
4378        g4_qthome=`dirname $g4_qthome`
4379        g4_qthome=`dirname $g4_qthome`
4380        g4_qthome=`dirname $g4_qthome`
4381
4382        #If version is o.k, check for moc
4383        if test "x$g4_qtver" = "x4" ; then
4384           #Check for moc
4385           g4_qthavemoc=`./loc moc no $g4_qthome/bin`
4386
4387           echo "checking for moc... $g4_qthavemoc"
4388
4389           if test "x$g4_qthavemoc" = "xno" ; then
4390              g4_havegoodqt=no
4391           fi
4392        else
4393           g4_havegoodqt=no
4394        fi #END CHECK Qt VERSION
4395      fi #END CHECK QTHOME
4396      #
4397      # END QT AUTOPROBE
4398      ####################################################################
4399
4400
4401      ####################################################################
4402      # Based on result of Qt autoprobe, we decide if user input is needed to
4403      # locate Qt...
4404      #
4405      if test "x$g4_havegoodqt" = "xno" ; then
4406         promptend="no"
4407         qthomeloc="the standard locations"
4408
4409         while test "x$promptend" = "xno" ; do
4410               g4message=`cat << EOM
4411
4412Autodetection failed to locate Qt4 in $qthomeloc on your system.
4413Please enter the path to your Qt4 install (i.e. if Qt4 is installed
4414in PATH/include/Qt, or PATH/include, enter PATH), or type '-' to
4415CANCEL the build of the Qt UI module.
4416Qt path:
4417EOM`
4418               dflt="/usr"
4419               fn='d~(-)'
4420               rp=$g4message
4421               . ./getfile
4422
4423               #Check for user cancellation
4424               if test "x$ans" = "x-" ; then
4425                  g4ui_build_qt_session=n
4426                  g4ui_use_qt=n
4427                  g4_qthome=""
4428                  echo "build/use of Qt UI module cancelled..."
4429                  promptend=yes
4430
4431               else
4432                  #We want to probe for Qt in the user supplied directory
4433                  echo " "
4434                  qthomeloc=$ans
4435                  g4_havegoodqt=no
4436                  g4_qthome=`./loc qglobal.h no $ans/include/Qt $ans/include`
4437
4438                  echo "checking for Qt4 installation... $g4_qthome"
4439
4440                  #If we found an installation, proceed to other tests.
4441                  if test "x$g4_qthome" != "xno" ; then
4442                     #Set Qt installation to good at this point
4443                     g4_havegoodqt=yes         
4444
4445                     #Check that this is Qt4...
4446                     g4_qtver=`$grep QT_VERSION_STR $g4_qthome | $sed 's/.* \"\([0-9]\)\..*\"/\1/'`
4447
4448                     echo "checking Qt version... $g4_qtver"
4449
4450                     #Now strip qthome back so we can check for moc...
4451                     g4_qthome=`dirname $g4_qthome`
4452
4453                     #At this point we could have include/Qt
4454                     #or include
4455                     if test `basename $g4_qthome` = "Qt" ; then
4456                        g4_qthome=`dirname $g4_qthome`
4457                        g4_qthome=`dirname $g4_qthome`
4458                     else
4459                        g4_qthome=`dirname $g4_qthome`
4460                     fi
4461
4462                     #If version is o.k, check for moc
4463                     if test "x$g4_qtver" = "x4" ; then
4464                        #Check for moc
4465                        g4_qthavemoc=`./loc moc no $g4_qthome/bin`
4466
4467                        echo "checking for moc... $g4_qthavemoc"
4468
4469                        if test "x$g4_qthavemoc" = "xno" ; then
4470                           g4_havegoodqt=no
4471                        fi
4472                     else
4473                        g4_havegoodqt=no
4474                     fi #END CHECK Qt VERSION
4475                  fi #END CHECK QTHOME
4476
4477                  #If we have a good Qt, end prompt
4478                  if test "x$g4_havegoodqt" = "xyes" ; then
4479                     promptend=yes
4480                  fi
4481               fi #END CHECK USER CANCELLATION
4482         done #END USER PROMPT FOR QT DETECTION
4483
4484      fi #END USER DIRECTED QT DETECTION
4485      #
4486      #END QT USER INPUT PROBE
4487      ####################################################################
4488
4489   fi #END CHECK OF G4UI_BUILD_QT_SESSION=Y
4490   ###########################################
4491
4492fi #END TEST G4UI_NONE=N
4493fi #END TEST G4SYSTEM = Linux-g++ OR Darwin-g++
4494########################
4495echo " "
4496case "$g4vis_none" in
4497'')
4498        g4vis_none=n
4499        ;;
4500esac
4501
4502
4503case "$g4vis_build_openglwin32_driver" in
4504'')
4505        g4vis_build_openglwin32_driver=n
4506        ;;
4507esac
4508
4509case "$g4vis_use_openglwin32" in
4510'')
4511        g4vis_use_openglwin32=n
4512        ;;
4513esac
4514
4515case "$g4vis_build_oiwin32_driver" in
4516'')
4517        g4vis_build_oiwin32_driver=n
4518        ;;
4519esac
4520
4521case "$g4vis_use_oiwin32" in
4522'')
4523        g4vis_use_oiwin32=n
4524        ;;
4525esac
4526
4527case "$g4vis_build_dawn_driver" in
4528'')
4529        g4vis_build_dawn_driver=n
4530        ;;
4531esac
4532
4533case "$g4vis_use_dawn" in
4534'')
4535        g4vis_use_dawn=n
4536        ;;
4537esac
4538
4539# Set by default!
4540case "$g4vis_build_dawnfile_driver" in
4541'')
4542        g4vis_build_dawnfile_driver=y
4543        ;;
4544esac
4545
4546# Set by default!
4547case "$g4vis_use_dawnfile" in
4548'')
4549        g4vis_use_dawnfile=y
4550        ;;
4551esac
4552
4553case "$g4vis_build_openglx_driver" in
4554'')
4555        g4vis_build_openglx_driver=n
4556        ;;
4557esac
4558
4559case "$g4vis_use_openglx" in
4560'')
4561        g4vis_use_openglx=n
4562        ;;
4563esac
4564
4565case "$g4vis_build_openglxm_driver" in
4566'')
4567        g4vis_build_openglxm_driver=n
4568        ;;
4569esac
4570
4571case "$g4vis_use_openglxm" in
4572'')
4573        g4vis_use_openglxm=n
4574        ;;
4575esac
4576
4577case "$g4vis_build_oix_driver" in
4578'')
4579        g4vis_build_oix_driver=n
4580        ;;
4581esac
4582
4583case "$g4vis_use_oix" in
4584'')
4585        g4vis_use_oix=n
4586        ;;
4587esac
4588
4589case "$g4vis_build_raytracerx_driver" in
4590'')
4591        g4vis_build_raytracerx_driver=n
4592        ;;
4593esac
4594
4595case "$g4vis_use_raytracerx" in
4596'')
4597        g4vis_use_raytracerx=n
4598        ;;
4599esac
4600
4601# Set by default!
4602case "$g4vis_build_raytracer_driver" in
4603'')
4604        g4vis_build_raytracer_driver=y
4605        ;;
4606esac
4607
4608# Set by default!
4609case "$g4vis_use_raytracer" in
4610'')
4611        g4vis_use_raytracer=y
4612        ;;
4613esac
4614
4615case "$g4vis_build_vrml_driver" in
4616'')
4617        g4vis_build_vrml_driver=n
4618        ;;
4619esac
4620
4621case "$g4vis_use_vrml" in
4622'')
4623        g4vis_use_vrml=n
4624        ;;
4625esac
4626
4627# Set by default!
4628case "$g4vis_build_asciitree_driver" in
4629'')
4630        g4vis_build_asciitree_driver=y
4631        ;;
4632esac
4633
4634# Set by default!
4635case "$g4vis_use_asciitree" in
4636'')
4637        g4vis_use_asciitree=y
4638        ;;
4639esac
4640
4641# Set by default!
4642case "$g4vis_build_gagtree_driver" in
4643'')
4644        g4vis_build_gagtree_driver=y
4645        ;;
4646esac
4647
4648# Set by default!
4649case "$g4vis_use_gagtree" in
4650'')
4651        g4vis_use_gagtree=y
4652        ;;
4653esac
4654
4655echo ""
4656
4657g4message=`cat << EOM
4658
4659  G4VIS_NONE
4660
4661If this variable is set, no visualization drivers will be built or used.
4662Do you want to set this variable ?
4663
4664EOM`
4665
4666dflt=$g4vis_none
4667rp=$g4message
4668. ./myread
4669gans=$ans
4670
4671        case $gans in
4672       
4673        n*|N*)
4674                g4vis_none=n
4675                ;;
4676        y*|Y*)
4677                g4vis_none=y
4678                ;;
4679        esac
4680
4681case $g4vis_none in
4682
4683n)
4684
4685if test "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7"; then
4686
4687g4message=`cat << EOM
4688
4689  G4VIS_BUILD_OPENGLX_DRIVER
4690  G4VIS_USE_OPENGLX
4691
4692It is an interface to the de facto standard 3D graphics library,
4693OpenGL. It is well suited for real-time fast visualization
4694and prototyping. The X11 version of the OpenGL libraries is
4695required.
4696EOM`
4697
4698dflt=$g4vis_use_openglx
4699rp=$g4message
4700. ./myread
4701gans=$ans
4702
4703        case $gans in
4704       
4705        n*|N*)
4706                g4vis_build_openglx_driver=n
4707                g4vis_use_openglx=n
4708                ;;
4709        y*|Y*)
4710                g4vis_build_openglx_driver=y
4711                g4vis_use_openglx=y
4712                ;;
4713        esac
4714
4715#############################################3
4716g4message=`cat << EOM
4717
4718  G4VIS_BUILD_OPENGLXM_DRIVER
4719  G4VIS_USE_OPENGLXM
4720
4721It is an interface to the de facto standard 3D graphics library,
4722OpenGL. It is well suited for real-time fast visualization
4723and prototyping. The X11 version of the OpenGL libraries and
4724the Motif Xm extension is required.
4725
4726EOM`
4727
4728dflt=$g4vis_use_openglxm
4729rp=$g4message
4730. ./myread
4731gans=$ans
4732
4733        case $gans in
4734       
4735        n*|N*)
4736                g4vis_build_openglxm_driver=n
4737                g4vis_use_openglxm=n
4738                ;;
4739        y*|Y*)
4740                g4vis_build_openglxm_driver=y
4741                g4vis_use_openglxm=y
4742                ;;
4743        esac
4744
4745############################################################
4746#echo xm_dirs=$xm_dirs
4747#echo g4vis_xmhome=$g4vis_xmhome
4748#echo g4ui_build_xm_session=$g4ui_build_xm_session
4749#echo g4vis_build_openglxm_driver=$g4vis_build_openglxm_driver
4750
4751if test "X$g4ui_build_xm_session" = "Xn" ; then
4752
4753#echo PASS1
4754
4755if test "X$g4vis_build_openglxm_driver" = "Xy" ; then
4756
4757#echo PASS2
4758
4759if test "X$g4vis_xmhome" = "X" ; then
4760xm_dirs=`find $g4vis_xmhome /usr/X11R6/include /usr/local/include /usr/include /sw/include -type d -name Xm 2>/dev/null |xargs echo`
4761#echo ogl_dirs=$ogl_dirs
4762
4763if test "X$xm_dirs" != "X" ; then
4764
4765g4xm_base_dir_found=`echo $xm_dirs|cut -d" " -f1`
4766#echo g4ogl_base_dir_found=$g4ogl_base_dir_found
4767
4768# That's right: should be twice! (e.g./usr/local/lib/libGLU.so -> /usr/local)
4769g4xm_base_dir_found=`dirname $g4xm_base_dir_found`
4770g4xm_base_dir_found=`dirname $g4xm_base_dir_found`
4771
4772        g4vis_xmhome=$g4xm_base_dir_found
4773#else
4774#case "$g4vis_xmhome" in
4775#'')
4776#       g4vis_xmhome=/usr/X11R6/
4777#       ;;
4778#esac
4779fi
4780fi
4781
4782##########################################################################
4783
4784#if test "X$g4vis_xmhome" != "X" ; then
4785#xm_dirs=$g4vis_xmhome
4786#fi
4787
4788if test "X$g4vis_xmhome" != "X" ; then
4789
4790g4message=`cat << EOM
4791
4792You have selected to use OPENGLXM driver.
4793Specify the correct path where Xm is installed in your system.
4794It was found in $g4vis_xmhome. Press [Enter] to set this path or type the correct one.
4795
4796You can set '-' (without quotation) to CANCEL the XM flag at all:
4797
4798EOM`
4799
4800dflt=$g4vis_xmhome
4801fn='d~(-)'
4802rp=$g4message
4803. ./getfile
4804
4805cend="no"
4806while test "$cend" = "no" ; do
4807if test -e "$ans/include/Xm" || [ "X$ans" = "X-"  ]; then
4808cend="yes"
4809if test "X$ans" != "X-" ; then
4810
4811g4vis_xmhome=$ans
4812
4813else
4814
4815g4vis_build_openglxm_driver=n
4816g4vis_use_openglxm=n
4817
4818fi
4819else
4820
4821g4message=`cat << EOM
4822
4823You have selected to use OPENGLXM driver.
4824But it was not found in $ans.
4825Please specify the correct path where Xm is installed in your system.
4826
4827You can set '-' (without quotation) to CANCEL the XM flag at all:
4828
4829EOM`
4830
4831dflt=""
4832fn='d~(-)'
4833rp=$g4message
4834. ./getfile
4835fi
4836done
4837
4838else
4839
4840g4message=`cat << EOM
4841
4842You have selected to use OPENGLXM driver.
4843But it was not found in expected place.
4844Please specify the correct path where Xm is installed in your system.
4845
4846You can set '-' (without quotation) to CANCEL the XM flag at all:
4847
4848EOM`
4849
4850dflt=""
4851fn='d~(-)'
4852rp=$g4message
4853. ./getfile
4854
4855cend="no"
4856while test "$cend" = "no" ; do
4857if test -e "$ans/include/Xm" || [ "X$ans" = "X-"  ]; then
4858cend="yes"
4859if test "X$ans" != "X-" ; then
4860
4861g4vis_xmhome=$ans
4862
4863else
4864
4865g4vis_build_openglxm_driver=n
4866g4vis_use_openglxm=n
4867
4868fi
4869else
4870
4871g4message=`cat << EOM
4872
4873You have selected to use OPENGLXM driver.
4874But it was not found in $ans.
4875Please specify the correct path where Xm is installed in your system.
4876
4877You can set '-' (without quotation) to CANCEL the XM flag at all:
4878
4879EOM`
4880
4881dflt=""
4882fn='d~(-)'
4883rp=$g4message
4884. ./getfile
4885fi
4886done
4887fi
4888
4889if test "X$g4osname" = "XLinux"; then
4890
4891if test "X$g4vis_xmhome" = "X/usr" -o "X$g4vis_xmhome" = "X/usr/local" ; then
4892g4vis_xmhome=""
4893fi
4894fi
4895fi # g4vis_build_opheglxm_driver
4896
4897###############################################
4898# Set XMFLAGS and XMLIBS
4899#
4900
4901if test "X$g4vis_build_openglxm_driver" = "Xy" ; then
4902
4903if test "X$g4osname" = "XAIX" ; then
4904g4vis_xmflags=" -I$g4vis_xmhome/include "
4905g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm -lXt -lX11 "
4906fi
4907
4908if test "X$g4osname" = "XLinux" ; then
4909g4vis_xmflags=" -I$g4vis_xmhome/include "
4910        if test "X$g4vis_xmhome" = "X/usr/X11R6" ; then
4911                g4vis_xmlibs=" -lXm -lXpm "
4912        else
4913                g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm -lXpm "
4914        fi
4915fi
4916
4917if test "X$g4osname" = "XDarwin" ; then
4918g4vis_xmflags=" -I$g4vis_xmhome/include "
4919g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm -lXpm "
4920fi
4921
4922if test "X$g4osname" = "XDEC" ; then
4923g4vis_xmflags=" -I$g4vis_xmhome/include "
4924g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm "
4925fi
4926
4927if test "X$g4osname" = "XHP" ; then
4928g4vis_xmflags=" -I$g4vis_xmhome/include/Motif1.2 "
4929g4vis_xmlibs=" -L$g4vis_xmhome/lib/Motif1.2 -lXm "
4930fi
4931
4932if test "X$g4osname" = "XSGI" ; then
4933g4vis_xmflags=" -I$g4vis_xmhome/include "
4934g4vis_xmlibs=" -L$g4vis_xmhome/lib -lXm "
4935fi
4936
4937if test "X$g4osname" = "XSUN" ; then
4938g4vis_xmflags=" -I$g4vis_xmhome/include "
4939g4vis_xmlibs=" -L$g4vis_xmhome/lib -L/usr/openwin/lib -L/usr/dt/lib -L/usr/ucblib -R/usr/openwin/lib -lXt -lXm -lX11 "
4940fi
4941
4942fi # end of XM build
4943fi
4944###############################################
4945
4946fi # if !WIN
4947
4948######################################################################
4949if test "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7"; then
4950
4951g4message=`cat << EOM
4952
4953  G4VIS_BUILD_OPENGLWIN32_DRIVER
4954  G4VIS_USE_OPENGLWIN32
4955
4956It is an interface to the de facto standard 3D graphics library,
4957OpenGL. It is well suited for real-time fast visualization
4958and prototyping. The Windows version of the OpenGL libraries is
4959required.
4960
4961EOM`
4962
4963dflt=$g4vis_use_openglwin32
4964rp=$g4message
4965. ./myread
4966gans=$ans
4967
4968        case $gans in
4969       
4970        n*|N*)
4971                g4vis_build_openglwin32_driver=n
4972                g4vis_use_openglwin32=n
4973                ;;
4974        y*|Y*)
4975                g4vis_build_openglwin32_driver=y
4976                g4vis_use_openglwin32=y
4977                ;;
4978        esac
4979
4980fi # if WIN
4981###########################################
4982
4983if test "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7"; then
4984
4985g4message=`cat << EOM
4986
4987  G4VIS_BUILD_DAWN_DRIVER
4988  G4VIS_USE_DAWN
4989
4990DAWN drivers are interfaces to the Fukui Renderer DAWN. DAWN is
4991a vectorized 3D PostScript processor suited to prepare technical
4992high quality outputs for presentation and/or documentation.
4993
4994EOM`
4995
4996dflt=$g4vis_use_dawn
4997rp=$g4message
4998. ./myread
4999gans=$ans
5000
5001        case $gans in
5002       
5003        n*|N*)
5004                g4vis_build_dawn_driver=n
5005                g4vis_use_dawn=n
5006                ;;
5007        y*|Y*)
5008                g4vis_build_dawn_driver=y
5009                g4vis_use_dawn=y
5010                ;;
5011        esac
5012
5013
5014#######################################
5015g4message=`cat << EOM
5016
5017  G4VIS_BUILD_OIX_DRIVER
5018  G4VIS_USE_OIX
5019
5020The OpenInventor driver is based on OpenInventor technology
5021for scientific visualization.
5022The X11 version of OpenInventor is required.
5023
5024EOM`
5025
5026dflt=$g4vis_use_oix
5027rp=$g4message
5028. ./myread
5029gans=$ans
5030
5031        case $gans in
5032       
5033        n*|N*)
5034                g4vis_build_oix_driver=n
5035                g4vis_use_oix=n
5036                ;;
5037        y*|Y*)
5038                g4vis_build_oix_driver=y
5039                g4vis_use_oix=y
5040                ;;
5041        esac
5042
5043############################################################
5044if test "X$g4vis_build_oix_driver" = "Xy" ; then
5045
5046oiv_dirs=`find $g4vis_oivhome /usr/X11R6/include /usr/local/include /usr/include  -type d -name Inventor 2>/dev/null|xargs echo`
5047#echo ogl_dirs=$ogl_dirs
5048
5049if test "X$oiv_dirs" != "X" ; then
5050
5051g4oiv_base_dir_found=`echo $oiv_dirs|cut -d" " -f1`
5052#echo g4ogl_base_dir_found=$g4ogl_base_dir_found
5053
5054# That's right: should be twice! (e.g./usr/local/lib/libGLU.so -> /usr/local)
5055g4oiv_base_dir_found=`dirname $g4oiv_base_dir_found`
5056g4oiv_base_dir_found=`dirname $g4oiv_base_dir_found`
5057
5058        g4vis_oivhome=$g4oiv_base_dir_found
5059#else
5060#case "$g4vis_oivhome" in
5061#'')
5062#       g4vis_oivhome=/usr
5063#       ;;
5064#esac
5065fi
5066
5067##########################################################################
5068
5069#if test "X$g4vis_oivhome" != "X" ; then
5070#oiv_dirs=$g4vis_oivhome
5071#fi
5072
5073if test "X$g4vis_oivhome" != "X" ; then
5074
5075g4message=`cat << EOM
5076
5077  OIVHOME/include
5078  OIVHOME/lib
5079
5080You have selected to use OpenInventor driver.
5081Specify the correct path (OIVHOME) where OpenInventor is installed in your system.
5082It was found in $g4vis_oivhome. Press [Enter] to set this path or type the correct one.
5083
5084You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5085
5086EOM`
5087
5088dflt=$g4vis_oivhome
5089fn='d~(-)'
5090rp=$g4message
5091. ./getfile
5092
5093cend="no"
5094while test "$cend" = "no" ; do
5095if test -e "$ans/include/Inventor" || [ "X$ans" = "X-"  ]; then
5096cend="yes"
5097if test "X$ans" != "X-" ; then
5098
5099g4vis_oivhome=$ans
5100
5101else
5102
5103g4vis_build_oix_driver=n
5104g4vis_use_oix=n
5105
5106fi
5107else
5108
5109g4message=`cat << EOM
5110
5111  OIVHOME/include
5112  OIVHOME/lib
5113
5114You have selected to use OpenInventor driver.
5115But it was not found in $ans.
5116Please specify the correct path where OpenInventor is installed in your system.
5117
5118You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5119
5120EOM`
5121
5122dflt=""
5123fn='d~(-)'
5124rp=$g4message
5125. ./getfile
5126fi
5127done
5128
5129else
5130
5131g4message=`cat << EOM
5132
5133  OIVHOME/include
5134  OIVHOME/lib
5135
5136You have selected to use OpenInventor driver.
5137But it was not found in expected place.
5138Please specify the correct path where OpenInventor is installed in your system.
5139
5140You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5141
5142EOM`
5143
5144dflt=""
5145fn='d~(-)'
5146rp=$g4message
5147. ./getfile
5148
5149cend="no"
5150while test "$cend" = "no" ; do
5151if test -e "$ans/include/Inventor" || [ "X$ans" = "X-"  ]; then
5152cend="yes"
5153if test "X$ans" != "X-" ; then
5154
5155g4vis_oivhome=$ans
5156
5157else
5158
5159g4vis_build_oix_driver=n
5160g4vis_use_oix=n
5161
5162fi
5163else
5164
5165g4message=`cat << EOM
5166
5167  OIVHOME/include
5168  OIVHOME/lib
5169
5170You have selected to use OpenInventor driver.
5171But it was not found in $ans.
5172Please specify the correct path where OpenInventor is installed in your system.
5173
5174You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5175
5176EOM`
5177
5178dflt=""
5179fn='d~(-)'
5180rp=$g4message
5181. ./getfile
5182fi
5183done
5184fi
5185
5186if test "X$g4osname" = "XLinux"; then
5187
5188if test "X$g4vis_oivhome" = "X/usr" -o "X$g4vis_oivhome" = "X/usr/local"; then
5189g4vis_oivhome=""
5190fi
5191fi
5192fi # g4vis_build_oix_driver
5193
5194###############################################
5195
5196g4message=`cat << EOM
5197
5198  G4VIS_BUILD_RAYTRACERX_DRIVER
5199  G4VIS_USE_RAYTRACERX
5200
5201Allows for interactive ray-tracing graphics through X11.
5202The X11 package is required.
5203
5204EOM`
5205
5206dflt=$g4vis_use_raytracerx
5207rp=$g4message
5208. ./myread
5209gans=$ans
5210
5211        case $gans in
5212       
5213        n*|N*)
5214                g4vis_build_raytracerx_driver=n
5215                g4vis_use_raytracerx=n
5216                ;;
5217        y*|Y*)
5218                g4vis_build_raytracerx_driver=y
5219                g4vis_use_raytracerx=y
5220                ;;
5221        esac
5222
5223########################################################
5224fi # if !WIN
5225
5226###############################################################
5227if test "X$g4system" = "XWIN32-VC" -o "X$g4system" = "XWIN32-VC7"; then
5228
5229g4message=`cat << EOM
5230
5231  G4VIS_BUILD_OIWIN32_DRIVER
5232  G4VIS_USE_OIWIN32
5233
5234Specifies to build and use the driver for the free X11 version of
5235OpenInventor on Windows systems.
5236The Windows version of OpenInventor is required.
5237
5238EOM`
5239
5240dflt=$g4vis_use_oiwin32
5241rp=$g4message
5242. ./myread
5243gans=$ans
5244
5245        case $gans in
5246       
5247        n*|N*)
5248                g4vis_build_oiwin32_driver=n
5249                g4vis_use_oiwin32=n
5250                ;;
5251        y*|Y*)
5252                g4vis_build_oiwin32_driver=y
5253                g4vis_use_oiwin32=y
5254                ;;
5255        esac
5256
5257############################################################
5258if test "X$g4vis_build_oiwin32_driver" = "Xy" ; then
5259
5260oiv_dirs=`find $g4vis_oivhome /usr/X11R6/include /usr/local/include /usr/include  -type d -name Inventor 2>/dev/null|xargs echo`
5261#echo ogl_dirs=$ogl_dirs
5262
5263if test "X$oiv_dirs" != "X" ; then
5264
5265g4oiv_base_dir_found=`echo $oiv_dirs|cut -d" " -f1`
5266#echo g4ogl_base_dir_found=$g4ogl_base_dir_found
5267
5268# That's right: should be twice! (e.g./usr/local/lib/libGLU.so -> /usr/local)
5269g4oiv_base_dir_found=`dirname $g4oiv_base_dir_found`
5270g4oiv_base_dir_found=`dirname $g4oiv_base_dir_found`
5271
5272        g4vis_oivhome=$g4oiv_base_dir_found
5273#else
5274#case "$g4vis_oivhome" in
5275#'')
5276#       g4vis_oivhome=/usr
5277#       ;;
5278#esac
5279fi
5280
5281##########################################################################
5282
5283#if test "X$g4vis_oivhome" != "X" ; then
5284#oiv_dirs=$g4vis_oivhome
5285#fi
5286
5287if test "X$g4vis_oivhome" != "X" ; then
5288
5289g4message=`cat << EOM
5290
5291  OIVHOME/include
5292  OIVHOME/lib
5293
5294You have selected to use OpenInventor driver.
5295Specify the correct path (OIVHOME) where OpenInventor is installed in your system.
5296It was found in $g4vis_oivhome. Press [Enter] to set this path or type the correct one.
5297
5298You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5299
5300EOM`
5301
5302dflt=$g4vis_oivhome
5303fn='d~(-)'
5304rp=$g4message
5305. ./getfile
5306
5307cend="no"
5308while test "$cend" = "no" ; do
5309if test -e "$ans/include/Inventor" || [ "X$ans" = "X-"  ]; then
5310cend="yes"
5311if test "X$ans" != "X-" ; then
5312
5313g4vis_oivhome=$ans
5314
5315else
5316
5317g4vis_build_oiwin32_driver=n
5318g4vis_use_oiwin32=n
5319
5320fi
5321else
5322
5323g4message=`cat << EOM
5324
5325  OIVHOME/include
5326  OIVHOME/lib
5327
5328You have selected to use OpenInventor driver.
5329But it was not found in $ans.
5330Please specify the correct path where OpenInventor is installed in your system.
5331
5332You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5333
5334EOM`
5335
5336dflt=""
5337fn='d~(-)'
5338rp=$g4message
5339. ./getfile
5340fi
5341done
5342
5343else
5344
5345g4message=`cat << EOM
5346
5347  OIVHOME/include
5348  OIVHOME/lib
5349
5350You have selected to use OpenInventor driver.
5351But it was not found in expected place.
5352Please specify the correct path where OpenInventor is installed in your system.
5353
5354You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5355
5356EOM`
5357
5358dflt=""
5359fn='d~(-)'
5360rp=$g4message
5361. ./getfile
5362
5363cend="no"
5364while test "$cend" = "no" ; do
5365if test -e "$ans/include/Inventor" || [ "X$ans" = "X-"  ]; then
5366cend="yes"
5367if test "X$ans" != "X-" ; then
5368
5369g4vis_oivhome=$ans
5370
5371else
5372
5373g4vis_build_oiwin32_driver=n
5374g4vis_use_oiwin32=n
5375
5376fi
5377else
5378
5379g4message=`cat << EOM
5380
5381  OIVHOME/include
5382  OIVHOME/lib
5383
5384You have selected to use OpenInventor driver.
5385But it was not found in $ans.
5386Please specify the correct path where OpenInventor is installed in your system.
5387
5388You can set '-' (without quotation) to CANCEL the OpenInventor flag at all:
5389
5390EOM`
5391
5392dflt=""
5393fn='d~(-)'
5394rp=$g4message
5395. ./getfile
5396fi
5397done
5398fi
5399
5400if test "X$g4osname" = "XLinux"; then
5401
5402if test "X$g4vis_oivhome" = "X/usr" -o "X$g4vis_oivhome" = "X/usr/local"; then
5403g4vis_oivhome=""
5404fi
5405fi
5406fi # g4vis_build_oiwin32_driver
5407
5408###############################################
5409
5410fi # if WIN
5411################################################################
5412
5413if test "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7"; then
5414
5415g4message=`cat << EOM
5416
5417  G4VIS_BUILD_DAWNFILE_DRIVER
5418  G4VIS_USE_DAWNFILE
5419
5420DAWN drivers are interfaces to Fukui Renderer DAWN. It is a vectorized 3D
5421PostScript processor, and so well suited to prepare technical high
5422quality outputs for presentation and/or documentation.
5423The DAWNFILE driver sends 3D data to DAWN via an intermediate file,
5424named g4.prim in the current directory. The file g4.prim is able to
5425be re-visualized later without the help of Geant4.
5426EOM`
5427
5428dflt=$g4vis_use_dawnfile
5429rp=$g4message
5430#. ./myread
5431#gans=$ans
5432gans=y
5433
5434        case $gans in
5435       
5436        n*|N*)
5437                g4vis_build_dawnfile_driver=n
5438                g4vis_use_dawnfile=n
5439                ;;
5440        y*|Y*)
5441                g4vis_build_dawnfile_driver=y
5442                g4vis_use_dawnfile=y
5443                ;;
5444        esac
5445
5446g4message=`cat << EOM
5447
5448  G4VIS_BUILD_RAYTRACER_DRIVER
5449  G4VIS_USE_RAYTRACER
5450
5451It performs ray-tracing visualization using the tracking routines of Geant4.
5452It is, therefore, available for debugging tracking routines.
5453It is well suited for photo-realistic high quality output for
5454presentation, and for intuitive debugging of detector geometry.
5455EOM`
5456
5457dflt=$g4vis_use_raytracer
5458rp=$g4message
5459#. ./myread
5460#gans=$ans
5461gans=y
5462
5463        case $gans in
5464       
5465        n*|N*)
5466                g4vis_build_raytracer_driver=n
5467                g4vis_use_raytracer=n
5468                ;;
5469        y*|Y*)
5470                g4vis_build_raytracer_driver=y
5471                g4vis_use_raytracer=y
5472                ;;
5473        esac
5474
5475g4message=`cat << EOM
5476
5477  G4VIS_BUILD_VRML_DRIVER
5478  G4VIS_USE_VRML
5479
5480These driver generate VRML files, which describe 3D scenes to be
5481visualized with a proper VRML viewer.
5482
5483EOM`
5484
5485dflt=$g4vis_use_vrml
5486rp=$g4message
5487. ./myread
5488gans=$ans
5489
5490        case $gans in
5491       
5492        n*|N*)
5493                g4vis_build_vrml_driver=n
5494                g4vis_use_vrml=n
5495                ;;
5496        y*|Y*)
5497                g4vis_build_vrml_driver=y
5498                g4vis_use_vrml=y
5499                ;;
5500        esac
5501
5502g4message=`cat << EOM
5503
5504  G4VIS_BUILD_VRMLFILE_DRIVER
5505  G4VIS_USE_VRMLFILE
5506
5507This driver generates VRML files, which describe 3D scenes to be
5508visualized with a proper VRML viewer, at either a local or a remote host.
5509The VRMLFILE driver sends 3D data to your VRML viewer, which is running
5510in the same host machine as Geant4, via an intermediate file named
5511g4.wrl created in the current directory. This file is available for
5512re-visualization afterwards. In visualization, you should specify a
5513name of the VRML viewer by setting the environment variable G4VRML_VIEWER
5514beforehand.
5515EOM`
5516
5517dflt=$g4vis_use_vrmlfile
5518rp=$g4message
5519#. ./myread
5520#gans=$ans
5521gans=y
5522
5523        case $gans in
5524       
5525        n*|N*)
5526                g4vis_build_vrmlfile_driver=n
5527                g4vis_use_vrmlfile=n
5528                ;;
5529        y*|Y*)
5530                g4vis_build_vrmlfile_driver=y
5531                g4vis_use_vrmlfile=y
5532                ;;
5533        esac
5534
5535fi # if !WIN
5536
5537g4message=`cat << EOM
5538
5539  G4VIS_BUILD_ASCIITREE_DRIVER
5540  G4VIS_USE_ASCIITREE
5541
5542Description????????????????????????
5543EOM`
5544
5545dflt=$g4vis_use_asciitree
5546rp=$g4message
5547# Don't ask by default and set to 'y'!
5548#. ./myread
5549#gans=$ans
5550gans=y
5551
5552        case $gans in
5553       
5554        n*|N*)
5555                g4vis_build_asciitree_driver=n
5556                g4vis_use_asciitree=n
5557                ;;
5558        y*|Y*)
5559                g4vis_build_asciitree_driver=y
5560                g4vis_use_asciitree=y
5561                ;;
5562        esac
5563
5564
5565g4message=`cat << EOM
5566
5567  G4VIS_BUILD_GAGTREE_DRIVER
5568  G4VIS_USE_GAGTREE
5569
5570Description????????????????????????
5571EOM`
5572
5573dflt=$g4vis_use_gagtree
5574rp=$g4message
5575# Don't ask by default and set to 'y'!
5576#. ./myread
5577#gans=$ans
5578gans=y
5579
5580        case $gans in
5581       
5582        n*|N*)
5583                g4vis_build_gagtree_driver=n
5584                g4vis_use_gagtree=n
5585                ;;
5586        y*|Y*)
5587                g4vis_build_gagtree_driver=y
5588                g4vis_use_gagtree=y
5589                ;;
5590        esac
5591
5592;;
5593esac
5594
5595if test "X$g4system" != "XWIN32-VC" -a "X$g4system" != "XWIN32-VC7" -a "X$g4system" != "XDarwin-g++"; then
5596
5597#echo PASS1
5598
5599if [ X$g4vis_build_openglx_driver = Xy ] || [ X$g4vis_build_openglxm_driver = Xy ] || [ X$g4vis_build_openglwin32_driver = Xy ] ; then
5600
5601#echo PASS2
5602
5603#####################################################################
5604ogl_dirs=`find $g4vis_oglhome /usr/X11R6/include /usr/local/include /usr/include -type d -name GL 2>/dev/null|xargs echo`
5605#echo ogl_dirs=$ogl_dirs
5606
5607if test "X$ogl_dirs" != "X" ; then
5608
5609g4ogl_base_dir_found=`echo $ogl_dirs|cut -d" " -f1`
5610#echo g4ogl_base_dir_found=$g4ogl_base_dir_found
5611
5612# That's right: should be twice! (e.g./usr/local/lib/libGLU.so -> /usr/local)
5613g4ogl_base_dir_found=`dirname $g4ogl_base_dir_found`
5614g4ogl_base_dir_found=`dirname $g4ogl_base_dir_found`
5615
5616        g4vis_oglhome=$g4ogl_base_dir_found
5617#else
5618#case "$g4vis_oglhome" in
5619#'')
5620#       g4vis_oglhome=/usr
5621#       ;;
5622#esac
5623fi
5624
5625##########################################################################
5626if test "X$g4vis_oglhome" != "X" ; then
5627ogl_dirs=$g4vis_oglhome
5628fi
5629
5630if test "X$ogl_dirs" != "X" ; then
5631
5632g4message=`cat << EOM
5633
5634  OGLHOME/include
5635  OGLHOME/lib
5636
5637You have selected to use OpenGL driver.
5638Specify the correct path (OGLHOME) where OpenGL is installed in your system.
5639It was found in $g4vis_oglhome. Press [Enter] to set this path or type the correct one.
5640
5641You can set '-' (without quotation) to CANCEL the OpenGL flag at all:
5642
5643EOM`
5644
5645dflt=$g4vis_oglhome
5646fn='d~(-)'
5647rp=$g4message
5648. ./getfile
5649
5650cend="no"
5651while test "$cend" = "no" ; do
5652if test -e "$ans/include/GL" || [ "X$ans" = "X-"  ]; then
5653cend="yes"
5654
5655if test "X$ans" != "X-" ; then
5656
5657g4vis_oglhome=$ans
5658
5659else
5660
5661g4vis_build_openglx_driver=n
5662g4vis_use_openglx=n
5663
5664g4vis_build_openglxm_driver=n
5665g4vis_use_openglxm=n
5666
5667g4vis_build_openglwin32_driver=n
5668g4vis_use_openglwin32=n
5669
5670fi
5671else
5672
5673g4message=`cat << EOM
5674
5675  OGLHOME/include
5676  OGLHOME/lib
5677
5678You have selected to use OpenGL driver.
5679But it was not found in $ans.
5680Please specify the correct path where OpenGL is installed in your system.
5681
5682You can set '-' (without quotation) to CANCEL the OpenGL flag at all:
5683
5684EOM`
5685
5686dflt=""
5687fn='d~(-)'
5688rp=$g4message
5689. ./getfile
5690fi
5691done
5692
5693else
5694
5695g4message=`cat << EOM
5696
5697  OGLHOME/include
5698  OGLHOME/lib
5699
5700You have selected to use OpenGL driver.
5701But it was not found in expected place.
5702Please specify the correct path where OpenGL is installed in your system.
5703
5704You can set '-' (without quotation) to CANCEL the OpenGL flag at all:
5705
5706EOM`
5707
5708dflt=""
5709fn='d~(-)'
5710rp=$g4message
5711. ./getfile
5712
5713cend="no"
5714while test "$cend" = "no" ; do
5715if test -e "$ans/include/GL" || [ "X$ans" = "X-"  ]; then
5716cend="yes"
5717
5718if test "X$ans" != "X-" ; then
5719
5720g4vis_oglhome=$ans
5721
5722else
5723
5724g4vis_build_openglx_driver=n
5725g4vis_use_openglx=n
5726
5727g4vis_build_openglxm_driver=n
5728g4vis_use_openglxm=n
5729
5730g4vis_build_openglwin32_driver=n
5731g4vis_use_openglwin32=n
5732
5733fi
5734else
5735
5736g4message=`cat << EOM
5737
5738  OGLHOME/include
5739  OGLHOME/lib
5740
5741You have selected to use OpenGL driver.
5742But it was not found in $ans.
5743Please specify the correct path where OpenGL is installed in your system.
5744
5745You can set '-' (without quotation) to CANCEL the OpenGL flag at all:
5746
5747EOM`
5748
5749dflt=""
5750fn='d~(-)'
5751rp=$g4message
5752. ./getfile
5753fi
5754done
5755
5756fi
5757
5758if test "X$g4osname" = "XLinux"; then
5759
5760if test "X$g4vis_oglhome" = "X/usr" -o "X$g4vis_oglhome" = "X/usr/local"; then
5761g4vis_oglhome=""
5762fi
5763
5764fi # if platform (Linux vs SUN)
5765
5766fi # if need
5767###########################################
5768fi # if platform (Unix vs Win)
5769
5770#
5771# BEGIN QTVIS/QT PROBE
5772#
5773
5774#
5775# We only run on a Linux-g++ or Darwin-g++ system
5776#
5777if test "x$g4system" = "xLinux-g++" -o "x$g4system" = "xDarwin-g++" ; then
5778
5779   # Only proceed further if g4vis_none is not set
5780   if test "x$g4vis_none" = "xn" ; then
5781      #Query the user on whether to activate the module
5782      g4message=`cat << EOM
5783
5784    G4VIS_BUILD_OPENGLQT_DRIVER
5785    G4VIS_USE_OPENGLQT
5786
5787Setting these variables will enable the building of the G4 OpenGL Qt based
5788visualisation driver and the use of this driver in your applications
5789respectively.
5790The Qt4 headers, libraries and binaries are required to enable the
5791building of this module.
5792### WARNING! THIS FEATURE IS EXPERIMENTAL IN THIS RELEASE! ###
5793### WARNING! THIS FEATURE WILL ONLY WORK WITH Qt4!         ###
5794Do you want to enable build and use of this module?
5795EOM`
5796
5797      #Read the user response
5798      dflt=$g4vis_build_openglqt_driver
5799      rp=$g4message
5800      . ./myread
5801      gans=$ans
5802
5803      #
5804      # Check response
5805      #
5806      case $gans in
5807           n*|N*)
5808                g4vis_build_openglqt_driver=n
5809                g4vis_use_openglqt=n
5810                ;;
5811           y*|Y*)
5812                g4vis_build_openglqt_driver=y
5813                g4vis_use_openglqt=y
5814                ;;
5815      esac
5816
5817      ###################
5818
5819
5820
5821      ####################################################################
5822      # Now, if we have selected to build the driver, we need to check for
5823      # a Qt4 installation, which may have been done for use by the UI
5824      # module...
5825      #
5826      if test "x$g4vis_build_openglqt_driver" = "xy" ; then
5827                 
5828         #Now check whether g4_qthome has been set previously - if it hasn't
5829         #proceed to probe for Qt4... (assume it's unfiltered, i.e. not
5830         #set to '' by earlier probe if it was /usr or /usr/local
5831         if test "x$g4_qthome" != "x" ; then
5832            echo " "
5833            echo "configure: Qt4 preconfigured, no recheck neccessary"
5834         else
5835         #################################################################
5836            #We repeat the search used for the UI module
5837           
5838            echo " "
5839            g4_havegoodqt=no
5840
5841            g4_qthome=`./loc qglobal.h no /usr/include/Qt /usr/local/include/Qt /opt/local/include/Qt /sw/include/Qt`
5842
5843            echo "checking for Qt4 installation... $g4_qthome"
5844
5845            #If we found an installation, proceed to other tests.
5846            if test "x$g4_qthome" != "xno" ; then
5847
5848               #Set Qt installation to good at this point
5849               g4_havegoodqt=yes
5850     
5851                #Check that this is Qt4...
5852                g4_qtver=`$grep QT_VERSION_STR $g4_qthome | $sed 's/.* \"\([0-9]\)\..*\"/\1/'`
5853
5854                echo "checking Qt version... $g4_qtver"
5855
5856                #Now strip qthome back so we can check for moc...
5857                g4_qthome=`dirname $g4_qthome`
5858                g4_qthome=`dirname $g4_qthome`
5859                g4_qthome=`dirname $g4_qthome`
5860
5861                #If version is o.k, check for moc
5862                if test "x$g4_qtver" = "x4" ; then
5863                   #Check for moc
5864                   g4_qthavemoc=`./loc moc no $g4_qthome/bin`
5865
5866                   echo "checking for moc... $g4_qthavemoc"
5867
5868                   if test "x$g4_qthavemoc" = "xno" ; then
5869                      g4_havegoodqt=no
5870                   fi
5871                else
5872                   g4_havegoodqt=no
5873                fi #END CHECK Qt VERSION
5874            fi #END CHECK QTHOME
5875            #
5876            # END QT AUTOPROBE     
5877
5878
5879            # Based on result of Qt autoprobe, we decide if user input is
5880            # needed to locate Qt...
5881            #
5882            if test "x$g4_havegoodqt" = "xno" ; then
5883               promptend="no"
5884               qthomeloc="the standard locations"
5885
5886               while test "x$promptend" = "xno" ; do
5887                     g4message=`cat << EOM
5888
5889Autodetection failed to locate Qt4 in $qthomeloc on your system.
5890Please enter the path to your Qt4 install (i.e. if Qt4 is installed
5891in PATH/include/Qt, or PATH/include, enter PATH), or type '-' to
5892CANCEL the build of the Qt UI module.
5893Qt path:
5894EOM`
5895                     dflt="/usr"
5896                     fn='d~(-)'
5897                     rp=$g4message
5898                     . ./getfile
5899
5900                     #Check for user cancellation
5901                     if test "x$ans" = "x-" ; then
5902                        g4ui_build_qt_session=n
5903                        g4ui_use_qt=n
5904                        g4_qthome=""
5905                        echo "build/use of OpenGl Qt driver cancelled..."
5906                        promptend=yes
5907
5908                     else
5909                        #We want to probe for Qt in the user supplied directory
5910                        echo " "
5911                        qthomeloc=$ans
5912                        g4_havegoodqt=no
5913                        g4_qthome=`./loc qglobal.h no $ans/include/Qt $ans/include`
5914
5915                        echo "checking for Qt4 installation... $g4_qthome"
5916
5917                        #If we found an installation, proceed to other tests.
5918                        if test "x$g4_qthome" != "xno" ; then
5919                           #Set Qt installation to good at this point
5920                           g4_havegoodqt=yes           
5921
5922                           #Check that this is Qt4...
5923                           g4_qtver=`$grep QT_VERSION_STR $g4_qthome | $sed 's/.* \"\([0-9]\)\..*\"/\1/'`
5924
5925                           echo "checking Qt version... $g4_qtver"
5926
5927                           #Now strip qthome back so we can check for moc...
5928                           g4_qthome=`dirname $g4_qthome`
5929
5930                           #At this point we could have include/Qt
5931                           #or include
5932                           if test `basename $g4_qthome` = "Qt" ; then
5933                              g4_qthome=`dirname $g4_qthome`
5934                              g4_qthome=`dirname $g4_qthome`
5935                           else
5936                              g4_qthome=`dirname $g4_qthome`
5937                           fi
5938
5939                           #If version is o.k, check for moc
5940                           if test "x$g4_qtver" = "x4" ; then
5941                              #Check for moc
5942                              g4_qthavemoc=`./loc moc no $g4_qthome/bin`
5943
5944                              echo "checking for moc... $g4_qthavemoc"
5945
5946                              if test "x$g4_qthavemoc" = "xno" ; then
5947                                 g4_havegoodqt=no
5948                              fi
5949                           else
5950                              g4_havegoodqt=no
5951                           fi #END CHECK Qt VERSION
5952                        fi #END CHECK QTHOME
5953
5954                        #If we have a good Qt, end prompt
5955                        if test "x$g4_havegoodqt" = "xyes" ; then
5956                           promptend=yes
5957                        fi
5958                     fi #END CHECK USER CANCELLATION
5959               done #END USER PROMPT FOR QT DETECTION
5960
5961            fi #END USER DIRECTED QT DETECTION
5962            #
5963            #END QT USER INPUT PROBE
5964         #################################################################
5965         fi #END TEST G4_QTHOME IS SET
5966
5967
5968      fi #END TEST G4VIS_BUILD_OPENGLQT_DRIVER = y
5969
5970     
5971      #
5972      # Put a filter in here on /usr and /usr/local as QTHOME in line
5973      # with other paths - done here as this is the last place QT is
5974      # checked for
5975      #DEACTIVATED AT PRESENT BECAUSE OF USE OF MOC
5976      #
5977      #if test "x$g4_qthome" = "x/usr" -o "x$g4_qthome" = "x/usr/local" ; then
5978        # g4_qthome=""
5979      #fi
5980         
5981
5982   fi #END TEST G4VIS_NONE IS N
5983
5984fi #END TEST G4SYSTEM IS Linux-g++ OR Darwin-g++
5985
5986#
5987# END OF QTVIS/QT PROBE
5988
5989#
5990# BEGIN GDML/XERCESC PROBE
5991#
5992
5993# Set default build option to no
5994echo " "
5995case "$g4lib_build_gdml" in
5996'')
5997        g4lib_build_gdml=n
5998        ;;
5999esac
6000
6001
6002# Now query the user to see if they want to build the GDML plugin
6003echo ""
6004
6005g4message=`cat << EOM
6006
6007  G4LIB_BUILD_GDML
6008
6009Setting this variable will enable building of the GDML plugin module embedded
6010in Geant4 for detector description persistency.
6011It requires your system to have the XercesC library and headers installed.
6012Do you want to set this variable?
6013
6014EOM`
6015
6016#
6017# read in the users response
6018#
6019dflt=$g4lib_build_gdml
6020rp=$g4message
6021. ./myread
6022gans=$ans
6023
6024#
6025# Check response
6026#
6027case $gans in
6028     n*|N*)
6029        g4lib_build_gdml=n
6030        ;;
6031     y*|Y*)
6032        g4lib_build_gdml=y
6033        ;;
6034esac
6035
6036
6037#
6038# If user does want to build GDML plugin, now try to locate Xerces install
6039#
6040if test "X$g4lib_build_gdml" != "Xn"; then
6041
6042   if test "X$g4gdml_xercesc_root" = "X"; then
6043      #probe for Xerces, using example from UI and Vis
6044      xercesc_root=`find $g4gdml_xercesc_root /usr/include /usr/local/include \
6045/opt/local/include /sw/include -type d -name xercesc 2>/dev/null | xargs echo`
6046
6047      #If we got something, strip off the include/xerces part
6048      if test "X$xercesc_root" != "X"; then
6049         g4gdml_xercesc_root=`dirname $xercesc_root`
6050         g4gdml_xercesc_root=`dirname $g4gdml_xercesc_root`
6051
6052         echo " "
6053         echo "checking for XercesC install... $g4gdml_xercesc_root"
6054      else
6055         g4gdml_xercesc_root=""
6056         echo " "
6057         echo "checking for XercesC install... no"
6058      fi
6059   fi #END OF XERCES AUTOPROBE
6060
6061   #
6062   # If the autoprobe failed, prompt the user to enter the path to the Xerces
6063   # install
6064   #
6065   if test "X$g4gdml_xercesc_root" = "X"; then
6066
6067      promptend="no"
6068      xercesloc="the standard locations"
6069     
6070      while test "$promptend" = "no"; do
6071            g4message=`cat << EOM
6072
6073Autodetection failed to locate XercesC in $xercesloc on your system.
6074Please enter the path to your XercesC install (i.e. if XercesC is installed
6075in PATH/include/xercesc, enter PATH), or type '-' to CANCEL the build of the
6076GDML module.
6077XercesC path:
6078EOM`
6079
6080            dflt=$g4gdml_xercesc_root
6081            fn='d~(-)'
6082            rp=$g4message
6083            . ./getfile
6084
6085            #check for user cancellation
6086            if test "X$ans" = "X-"; then
6087               g4lib_build_gdml=n
6088               g4gdml_xercesc_root=""
6089               echo "G4LIB_BUILD_GDML cancelled..."
6090               promptend=yes
6091            else
6092               if test -r "$ans/include/xercesc"; then
6093                  g4gdml_xercesc_root=$ans
6094                  echo "checking for XercesC install... $g4gdml_xercesc_root"
6095                  promptend=yes
6096               else
6097                  xercesloc=$ans
6098                  echo "checking for Xercesc install... no"
6099               fi
6100            fi #END OF USER INPUT CHECKING
6101      done #END OF WHILE LOOP OVER USER INPUT
6102   fi #END OF USER INPUT SECTION
6103
6104   #
6105   # If a filter on g4gdml_xerces_root is needed to remove common system paths
6106   # then it should be put here...
6107   #
6108        if test "x$g4gdml_xercesc_root" = "x/usr" -o "x$g4gdml_xercesc_root" = "x/usr/local" ; then
6109                g4gdml_xercesc_root=""
6110        fi
6111
6112fi #END XERCES PROBE
6113
6114#END OF GDML/XERCES PROBE
6115
6116echo " "
6117
6118case "$g4make" in
6119'')
6120        g4make=gmake
6121        ;;
6122esac
6123
6124echo ""
6125
6126        g4_gmake_version=`(gmake -v) 2>/dev/null`
6127                                case $g4_gmake_version in
6128                                GNU*)
6129                                g4_gmake=y                             
6130                                ;;
6131                                *)
6132                                g4_gmake=n
6133                                ;;
6134                                esac                           
6135
6136        g4_make_version=`(make -v) 2>/dev/null`
6137                                case $g4_make_version in
6138                                GNU*)
6139                                g4_make=y                               
6140                                ;;
6141                                *)
6142                                g4_make=n
6143                                ;;
6144                                esac                           
6145
6146if  [ $g4_gmake = y ] ; then
6147
6148g4make=gmake
6149
6150g4message=`cat << EOM
6151
6152  G4MAKE
6153
6154You have GNU make which could be used to build GEANT4.
6155You can select your own 'make' program if you want.
6156EOM`
6157
6158fi
6159
6160if [ $g4_gmake = n ] && [ $g4_make = y ] ; then
6161
6162g4make=make
6163
6164g4message=`cat << EOM
6165
6166  G4MAKE
6167
6168You have GNU make which could be used to build GEANT4.
6169You can select your own 'make' program if you want.
6170EOM`
6171
6172fi
6173
6174if [ $g4_gmake = n ] && [ $g4_make = n ] ; then
6175
6176g4make=none
6177
6178g4message=`cat << EOM
6179
6180  G4MAKE
6181
6182You have NO GNU make which could be used to build GEANT4.
6183Please select your own 'make' program compatible with GNU make.
6184EOM`
6185
6186dflt=$g4make
6187rp=$g4message
6188
6189
6190. ./myread
6191gans=$ans
6192
6193        case $gans in
6194       
6195        '')
6196                g4make=$dflt
6197                ;;
6198        *)
6199                g4make=$gans
6200                ;;
6201        esac
6202
6203fi
6204
6205
6206
6207
6208echo " "
6209case "$g4wlib_build_g3tog4" in
6210'')
6211        g4wlib_build_g3tog4=n
6212        ;;
6213esac
6214
6215case "$g4w_use_g3tog4" in
6216'')
6217        g4w_use_g3tog4=n
6218        ;;
6219esac
6220
6221echo ""
6222
6223g4message=`cat << EOM
6224
6225  G4LIB_BUILD_G3TOG4 
6226
6227The utility module 'g3tog4' will be built by setting this
6228variable. NOTE: it requires a valid FORTRAN compiler to be
6229installed on your system and the 'cernlib' command in the
6230path, in order to build the ancillary tools!
6231Do you want to build 'g3tog4' ?
6232 
6233EOM`
6234
6235dflt=$g4wlib_build_g3tog4
6236rp=$g4message
6237. ./myread
6238gans=$ans
6239
6240        case $gans in
6241       
6242        n*|N*)
6243                g4wlib_build_g3tog4=n
6244                g4w_use_g3tog4=n
6245                ;;
6246        y*|Y*)
6247                g4wlib_build_g3tog4=y
6248                g4w_use_g3tog4=y
6249                ;;
6250        esac
6251
6252
6253echo " "
6254case "$g4wlib_build_zlib" in
6255'')
6256        g4wlib_build_zlib=n
6257        ;;
6258esac
6259
6260case "$g4w_use_zlib" in
6261'')
6262        g4w_use_zlib=n
6263        ;;
6264esac
6265
6266echo ""
6267
6268g4message=`cat << EOM
6269
6270  G4LIB_BUILD_ZLIB 
6271
6272Do you want to activate compression for output files
6273generated by the HepRep visualization driver?
6274 
6275EOM`
6276
6277dflt=$g4wlib_build_zlib
6278rp=$g4message
6279. ./myread
6280gans=$ans
6281
6282        case $gans in
6283       
6284        n*|N*)
6285                g4wlib_build_zlib=n
6286                g4w_use_zlib=n
6287                ;;
6288        y*|Y*)
6289                g4wlib_build_zlib=y
6290                g4w_use_zlib=y
6291                ;;
6292        esac
6293
6294
6295echo " "
6296
6297case "$g4wanalysis_use" in
6298'')
6299        g4wanalysis_use=n
6300        ;;
6301esac
6302
6303echo ""
6304
6305g4message=`cat << EOM
6306
6307  G4ANALYSIS_USE
6308
6309Activates the configuration setup for allowing plugins to
6310analysis tools based on AIDA (Astract Interfaces for Data
6311Analysis). In order to use AIDA features and compliant analysis
6312tools, the proper environment for these tools will have to be
6313set (see documentation for the specific analysis tools).
6314EOM`
6315
6316dflt=$g4wanalysis_use
6317rp=$g4message
6318. ./myread
6319gans=$ans
6320
6321        case $gans in
6322       
6323        n*|N*)
6324                g4wanalysis_use=n
6325                ;;
6326        y*|Y*)
6327                g4wanalysis_use=y
6328                ;;
6329        esac
6330
6331
6332: end of configuration questions
6333echo " "
6334echo "End of configuration phase."
6335echo " "
6336
6337: back to where it started
6338if test -d ../../.config/UU; then
6339        cd ../..
6340fi
6341
6342: configuration may be patched via a 'config.over' file
6343if $test -f config.over; then
6344        echo " "
6345        dflt=y
6346        rp='A config.over file exists.  Do you wish to load it?'
6347        . .config/UU/myread
6348        case "$ans" in
6349        n*) echo "OK, I'll ignore it.";;
6350        *)      . ./config.over
6351                echo "Configuration settings have been loaded."
6352                ;;
6353        esac
6354fi
6355
6356: in case they want portability, strip down executable paths
6357case "$d_portable" in
6358"$define")
6359        echo " "
6360        echo "Stripping down executable paths..." >&4
6361        for file in $loclist $trylist; do
6362                eval $file="\$file"
6363        done
6364        ;;
6365esac
6366
6367: create config.sh file
6368echo " "
6369echo "Creating configuration setup file..." >&4
6370mkdir -p $g4conf
6371$spitshell <<EOT > $g4conf/config.sh
6372$startsh
6373#
6374# This file was produced by running the Configure script. It holds all the
6375# definitions figured out by Configure. Should you modify one of these values,
6376# do not forget to propagate your changes by running "Configure -der". You may
6377# instead choose to run each of the .SH files by yourself, or "Configure -S".
6378#
6379
6380# Package name      : $package
6381# Source directory  : $src
6382# Configuration time: $cf_time
6383# Configured by     : $cf_by
6384# Target system     : $myuname
6385
6386Author='$Author'
6387Date='$Date'
6388Header='$Header'
6389Id='$Id'
6390Locker='$Locker'
6391Log='$Log'
6392RCSfile='$RCSfile'
6393Revision='$Revision'
6394Source='$Source'
6395State='$State'
6396c='$c'
6397cf_by='$cf_by'
6398cf_time='$cf_time'
6399contains='$contains'
6400d_portable='$d_portable'
6401eunicefix='$eunicefix'
6402g4_gmake='$g4_gmake'
6403g4_gmake_version='$g4_gmake_version'
6404g4_make='$g4_make'
6405g4_make_version='$g4_make_version'
6406g4_qthome='$g4_qthome'
6407g4abladata='$g4abladata'
6408g4base='$g4base'
6409g4bin='$g4bin'
6410g4clhep_base_dir='$g4clhep_base_dir'
6411g4clhep_include_dir='$g4clhep_include_dir'
6412g4clhep_lib='$g4clhep_lib'
6413g4clhep_lib_dir='$g4clhep_lib_dir'
6414g4compiler='$g4compiler'
6415g4conf='$g4conf'
6416g4data='$g4data'
6417g4debug='$g4debug'
6418g4elasticdata='$g4elasticdata'
6419g4final_install='$g4final_install'
6420g4gdml_xercesc_root='$g4gdml_xercesc_root'
6421g4global='$g4global'
6422g4granular='$g4granular'
6423g4include='$g4include'
6424g4includes_flag='$g4includes_flag'
6425g4install='$g4install'
6426g4ledata='$g4ledata'
6427g4levelgammadata='$g4levelgammadata'
6428g4lib='$g4lib'
6429g4lib_build_gdml='$g4lib_build_gdml'
6430g4lib_build_shared='$g4lib_build_shared'
6431g4lib_build_static='$g4lib_build_static'
6432g4lib_use_dll='$g4lib_use_dll'
6433g4lib_use_dyn='$g4lib_use_dyn'
6434g4lib_use_granular='$g4lib_use_granular'
6435g4lib_use_shared='$g4lib_use_shared'
6436g4lib_use_static='$g4lib_use_static'
6437g4make='$g4make'
6438g4neutronhpcrosssections='$g4neutronhpcrosssections'
6439g4osname='$g4osname'
6440g4radioactivedata='$g4radioactivedata'
6441g4system='$g4system'
6442g4tmp='$g4tmp'
6443g4ui_build_gag_session='$g4ui_build_gag_session'
6444g4ui_build_qt_session='$g4ui_build_qt_session'
6445g4ui_build_terminal_session='$g4ui_build_terminal_session'
6446g4ui_build_win32_session='$g4ui_build_win32_session'
6447g4ui_build_xaw_session='$g4ui_build_xaw_session'
6448g4ui_build_xm_session='$g4ui_build_xm_session'
6449g4ui_none='$g4ui_none'
6450g4ui_use_gag='$g4ui_use_gag'
6451g4ui_use_qt='$g4ui_use_qt'
6452g4ui_use_tcsh='$g4ui_use_tcsh'
6453g4ui_use_terminal='$g4ui_use_terminal'
6454g4ui_use_win32='$g4ui_use_win32'
6455g4ui_use_xaw='$g4ui_use_xaw'
6456g4ui_use_xm='$g4ui_use_xm'
6457g4ui_xawflags='$g4ui_xawflags'
6458g4ui_xawhome='$g4ui_xawhome'
6459g4ui_xawlibs='$g4ui_xawlibs'
6460g4vis_build_asciitree_driver='$g4vis_build_asciitree_driver'
6461g4vis_build_dawn_driver='$g4vis_build_dawn_driver'
6462g4vis_build_dawnfile_driver='$g4vis_build_dawnfile_driver'
6463g4vis_build_oiwin32_driver='$g4vis_build_oiwin32_driver'
6464g4vis_build_oix_driver='$g4vis_build_oix_driver'
6465g4vis_build_openglqt_driver='$g4vis_build_openglqt_driver'
6466g4vis_build_openglwin32_driver='$g4vis_build_openglwin32_driver'
6467g4vis_build_openglx_driver='$g4vis_build_openglx_driver'
6468g4vis_build_openglxm_driver='$g4vis_build_openglxm_driver'
6469g4vis_build_raytracer_driver='$g4vis_build_raytracer_driver'
6470g4vis_build_raytracerx_driver='$g4vis_build_raytracerx_driver'
6471g4vis_build_vrml_driver='$g4vis_build_vrml_driver'
6472g4vis_build_vrmlfile_driver='$g4vis_build_vrmlfile_driver'
6473g4vis_oglhome='$g4vis_oglhome'
6474g4vis_oivhome='$g4vis_oivhome'
6475g4vis_use_asciitree='$g4vis_use_asciitree'
6476g4vis_use_dawn='$g4vis_use_dawn'
6477g4vis_use_dawnfile='$g4vis_use_dawnfile'
6478g4vis_use_oiwin32='$g4vis_use_oiwin32'
6479g4vis_use_oix='$g4vis_use_oix'
6480g4vis_use_openglqt='$g4vis_use_openglqt'
6481g4vis_use_openglwin32='$g4vis_use_openglwin32'
6482g4vis_use_openglx='$g4vis_use_openglx'
6483g4vis_use_openglxm='$g4vis_use_openglxm'
6484g4vis_use_raytracer='$g4vis_use_raytracer'
6485g4vis_use_raytracerx='$g4vis_use_raytracerx'
6486g4vis_use_vrml='$g4vis_use_vrml'
6487g4vis_use_vrmlfile='$g4vis_use_vrmlfile'
6488g4vis_xmflags='$g4vis_xmflags'
6489g4vis_xmflags='$g4vis_xmflags'
6490g4vis_xmhome='$g4vis_xmhome'
6491g4vis_xmhome='$g4vis_xmhome'
6492g4vis_xmlibs='$g4vis_xmlibs'
6493g4vis_xmlibs='$g4vis_xmlibs'
6494g4w_use_g3tog4='$g4w_use_g3tog4'
6495g4w_use_zlib='$g4w_use_zlib'
6496g4wanalysis_build='$g4wanalysis_build'
6497g4wanalysis_build_jas='$g4wanalysis_build_jas'
6498g4wanalysis_build_lab='$g4wanalysis_build_lab'
6499g4wanalysis_build_lizard='$g4wanalysis_build_lizard'
6500g4wanalysis_use='$g4wanalysis_use'
6501g4wanalysis_use_jas='$g4wanalysis_use_jas'
6502g4wanalysis_use_lab='$g4wanalysis_use_lab'
6503g4wanalysis_use_lizard='$g4wanalysis_use_lizard'
6504g4wlib_build_g3tog4='$g4wlib_build_g3tog4'
6505g4wlib_build_zlib='$g4wlib_build_zlib'
6506g4workdir='$g4workdir'
6507hint='$hint'
6508lns='$lns'
6509myuname='$myuname'
6510n='$n'
6511osname='$osname'
6512osvers='$osvers'
6513package='$package'
6514sh='$sh'
6515sharpbang='$sharpbang'
6516shsharp='$shsharp'
6517spackage='$spackage'
6518spitshell='$spitshell'
6519src='$src'
6520startsh='$startsh'
6521EOT
6522
6523: add special variables
6524mkdir -p $g4conf
6525$test -f $src/patchlevel.h && \
6526awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >> $g4conf/config.sh
6527echo "CONFIG=true" >> $g4conf/config.sh
6528
6529: propagate old symbols
6530if $test -f .config/UU/config.sh; then
6531        <.config/UU/config.sh sort | uniq >.config/UU/oldconfig.sh
6532        sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' $g4conf/config.sh $g4conf/config.sh .config/UU/oldconfig.sh |\
6533        sort | uniq -u >.config/UU/oldsyms
6534        set X `cat .config/UU/oldsyms`
6535        shift
6536        case $# in
6537        0) ;;
6538        *)
6539                cat <<EOM
6540               
6541Hmm...You had some extra variables I don't know about...
6542      I'll try to keep 'em...
6543
6544EOM
6545                echo "# Variables propagated from previous config.sh file." >>.config/bin/$g4system/config.sh
6546                for sym in `cat .config/UU/oldsyms`; do
6547                        echo "    Propagating $hint variable "'$'"$sym..."
6548                        eval 'tmp="$'"${sym}"'"'
6549                        echo "$tmp" | \
6550                                sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>.config/bin/$g4system/config.sh
6551                done
6552                ;;
6553        esac
6554fi
6555
6556: preserve RCS keywords in files with variable substitution, grrr
6557Id='$Id'
6558
6559: Finish up by extracting the .SH files
6560case "$alldone" in
6561exit)
6562        $rm -rf .config/UU
6563        echo "Done."
6564        exit 0
6565        ;;
6566cont)
6567        ;;
6568'')
6569        dflt=''
6570        nostick=true
6571        $cat <<EOM
6572
6573WARNING: the generated configuration file
6574can be edited if necessary!
6575You can introduce any change to the configuration file
6576$g4conf/config.sh before the final installation.
6577To do so, use a shell escape now (e.g. !vi $g4conf/config.sh).
6578
6579EOM
6580        rp="Press [Enter] to start installation or use a shell escape to edit config.sh:"
6581        . .config/UU/myread
6582        nostick=''
6583        case "$ans" in
6584        '') ;;
6585        *) : in case they cannot read
6586                sh 1>&4 -c "$ans";;
6587        esac
6588        ;;
6589esac
6590
6591: if this fails, just run all the .SH files by hand
6592. $g4conf/config.sh
6593
6594echo " "
6595exec 1>&4
6596. ./.config/UU/extract
6597
6598if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
6599        dflt=y
6600        case "$silent" in
6601        true) ;;
6602        *)
6603                $cat <<EOM
6604
6605Now you need to generate make dependencies by running "make depend".
6606You might prefer to run it in background: "make depend > makedepend.out &"
6607It can take a while, so you might not want to run it right now.
6608
6609EOM
6610                ;;
6611        esac
6612        rp="Run make depend now?"
6613        . .config/UU/myread
6614        case "$ans" in
6615        y*)
6616                make depend && echo "Now you must run a make."
6617                ;;
6618        *)
6619                echo "You must run 'make depend' then 'make'."
6620                ;;
6621        esac
6622elif test -f [Mm]akefile; then
6623        echo " "
6624        echo "Now you must run a make."
6625elif [ -f $g4conf/install.sh -a X$g4build = Xyes ] ; then
6626        echo " "
6627        echo "Now starting Geant4 libraries build..."
6628        echo " "
6629        . $g4conf/install.sh
6630elif [ -f $g4conf/install.sh -a X$install = Xyes ] ; then
6631        echo " "
6632        echo "Now starting Geant4 libraries installation..."
6633        echo " "
6634        . $g4conf/move.sh
6635else
6636        echo " "
6637        echo "WARNING: Geant4 is NOT installed yet!"
6638        echo "You (or the administrator if you have not enough privileges)"
6639        echo "should start with \$G4INSTALL/Configure -install"
6640        echo "(where \$G4INSTALL is Geant4 install directory)."
6641        echo " "
6642fi
6643
6644$rm -f kit*isdone ark*isdone
6645$rm -rf .config/UU
6646
6647: End of Configure
6648
Note: See TracBrowser for help on using the repository browser.