source: trunk/Configure @ 1265

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

update CVS release candidate geant4.9.3.01

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