source: trunk/Configure

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

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