source: trunk/Configure @ 921

Last change on this file since 921 was 921, checked in by garnier, 15 years ago

en test de gl2ps. Problemes de libraries

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