Skip to content
Snippets Groups Projects
configure 181 KiB
Newer Older
# A (not so) simple configure script.
#
# Authors: Christian Holm Christensen and Fons Rademakers
#
# To help with debugging the script, some comments are preprended with
# 3 '#' echo and 3 '%' - replace that pattern with echo and 3 '%' to
# get printouts.  When done replace the pattern echo and 3 '%' with the
# original pattern of 3 '#' echo and 3 '%'.  Emacs command M-C-% does
# this easily.
#
######################################################################
#
### echo %%% Some global variables
#
found_lib=no
found_dir=no
found_hdr=no
Fons Rademakers's avatar
Fons Rademakers committed
fail_on_missing=no
Fons Rademakers's avatar
Fons Rademakers committed
nohowto="no"
Fons Rademakers's avatar
Fons Rademakers committed
logfile=config.log
Fons Rademakers's avatar
Fons Rademakers committed
deprecated_options="         \
   enable_mathcore           \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_cern               \
Fons Rademakers's avatar
Fons Rademakers committed
"

options="                    \
   enable_afs                \
   enable_alien              \
   enable_asimage            \
   enable_builtin_afterimage \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_builtin_ftgl       \
   enable_builtin_freetype   \
   enable_builtin_pcre       \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_builtin_zlib       \
   enable_chirp              \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_cint7              \
   enable_clarens            \
   enable_dcache             \
   enable_exceptions         \
   enable_explicitlink       \
Rene Brun's avatar
Rene Brun committed
   enable_fftw3              \
   enable_gdml               \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_gfal               \
Rene Brun's avatar
Rene Brun committed
   enable_g4root             \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_glite              \
   enable_globus             \
Rene Brun's avatar
Rene Brun committed
   enable_gsl_shared         \
   enable_krb5               \
   enable_ldap               \
Rene Brun's avatar
Rene Brun committed
   enable_genvector          \
Rene Brun's avatar
Rene Brun committed
   enable_memstat            \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_monalisa           \
   enable_mysql              \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_odbc               \
   enable_opengl             \
   enable_oracle             \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_pch                \
   enable_peac               \
   enable_pgsql              \
   enable_pythia6            \
   enable_python             \
   enable_qt                 \
   enable_qtgsi              \
Rene Brun's avatar
Rene Brun committed
   enable_minuit2            \
   enable_ruby               \
   enable_rfio               \
   enable_rpath              \
   enable_sapdb              \
   enable_shadowpw           \
   enable_shared             \
   enable_soversion          \
   enable_srp                \
   enable_ssl                \
   enable_table              \
Rene Brun's avatar
Rene Brun committed
   enable_unuran             \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_winrtdebug         \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_xft                \
   enable_xml                \
   enable_xrootd             \
"

#
# This sets all options to "yes" - we turn off those we don't want
# on per default explictly afterwards.
#
Fons Rademakers's avatar
Fons Rademakers committed
for c in $options ; do eval ${c}="yes" ; done
Fons Rademakers's avatar
Fons Rademakers committed
for c in $deprecated_options ; do eval ${c}="yes" ; done
Fons Rademakers's avatar
Fons Rademakers committed
for c in $options ; do eval ${c}_explicit="" ; done
Fons Rademakers's avatar
Fons Rademakers committed
enable_cint7=no
enable_gdml=no
Fons Rademakers's avatar
Fons Rademakers committed
enable_globus=no
Rene Brun's avatar
Rene Brun committed
enable_gsl_shared=no
enable_qtgsi=no
Rene Brun's avatar
Rene Brun committed
enable_minuit2=no
enable_table=no
enable_thread=yes        # cannot be disabled (not in above options list)
no_stubs=no              # complete Dictionaries by default (All stubs)
no_stubs_test=no         # complete Dictionaries by default (All stubs)
Rene Brun's avatar
Rene Brun committed
enable_unuran=no
Fons Rademakers's avatar
Fons Rademakers committed
enable_winrtdebug=
enable_xrootd=           # must be set explicitely via --enable-xrootd
Fons Rademakers's avatar
Fons Rademakers committed
# Remove old log file
rm -f $logfile

#
# ./configure arguments and defaults set via supported env vars
#
envvars="
THREAD           \
OPENGL           \
MYSQL            \
ORACLE           \
Fons Rademakers's avatar
Fons Rademakers committed
GFAL             \
Rene Brun's avatar
Rene Brun committed
G4ROOT           \
Fons Rademakers's avatar
Fons Rademakers committed
GSL              \
Rene Brun's avatar
Rene Brun committed
FFTW3            \
Rene Brun's avatar
Rene Brun committed
PYTHONDIR        \
DCACHE           \
CHIRP            \
ALIEN            \
ASIMAGE          \
LDAP             \
GLOBUS_LOCATION  \
Fons Rademakers's avatar
Fons Rademakers committed
GLITE            \
Rene Brun's avatar
Rene Brun committed
MEMSTAT          \
Fons Rademakers's avatar
Fons Rademakers committed
MONALISA         \
Fons Rademakers's avatar
Fons Rademakers committed
SSL              \
Rene Brun's avatar
Rene Brun committed
MINUIT2          \
Rene Brun's avatar
Rene Brun committed
XMLDIR           \
Fons Rademakers's avatar
Fons Rademakers committed
ROOTDICTTYPE     \
for c in $envvars ; do
Fons Rademakers's avatar
Fons Rademakers committed
   cc=`eval echo "$"$c | sed 's,\\\,\\\\\\\,g'`
   if test ! "x$cc" = "x" ; then
      if test ! "x$configenvvars" = "x" ; then
         configenvvars="$configenvvars $c=$cc"
      else
         configenvvars="$c=$cc"
      fi
   fi
done
Fons Rademakers's avatar
Fons Rademakers committed
# don't write --nohowto to config.h
Fons Rademakers's avatar
Fons Rademakers committed
configargs=`echo $configargs | sed 's, *--nohowto,,g'`

configoptions=
if test ! "x$configenvvars" = "x" ; then
   configoptions=$configenvvars
fi
if test ! "x$configargs" = "x" ; then
   if test ! "x$configoptions" = "x" ; then
      configoptions="$configoptions $configargs"
   else
      configoptions=$configargs
   fi
fi
Fons Rademakers's avatar
Fons Rademakers committed
configoptions=`echo $configoptions | sed 's,\\\,\\\\\\\,g'`
######################################################################
#
### echo %%% Some common functions
#
#_____________________________________________________________________
message() {
    # Write a simple message to std out
    if test $# -lt 1 ; then
	echo "message: Too few arguments"
	return 1
    fi
    echo $ac_n "$* ... $ac_c"
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg "$*"
}

#_____________________________________________________________________
logmsg() {
    # Write a simple message to std out
    if test $# -lt 1 ; then
	echo "logmsg: Too few arguments"
	return 1
    fi
    if test "x$1" = "x-n"; then
       shift
       echo -n "$*" >> $logfile
    else
       echo "$*" >> $logfile
    fi
}

#_____________________________________________________________________
result() {
    echo "$*"
    logmsg "Result: $*"
#_____________________________________________________________________
checking_msg() {
    # Write a simple "checking" message to std out.
    if test $# -lt 1 ; then
	echo "checking_msg: Too few arguments"
	return 1
    fi
    echo $ac_n "Checking for$ac_c"
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg $ac_n "Checking for$ac_c"
    while test $# -gt 1 ; do
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg $ac_n " $1,$ac_c"
	shift
	if test $# -eq 1 ; then
	    echo $ac_n " or$ac_c"
Fons Rademakers's avatar
Fons Rademakers committed
	    logmsg $ac_n " or$ac_c"
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg " $1 ... "
#_____________________________________________________________________
check_lib64() {
    # This function will try to find out if a library [$1] contains 64 bit
    # or 32 bit code. Currently works only for linux.
    # The result of the check is stored in is_lib64, 1 if true,
    # 0 otherwise, which should be immediately copied, since the variable
    # will be overwritten at next invocation of this function.

    is_lib64=0

    # Assert that we got enough arguments
    if test $# -ne 1 ; then
	echo "check_lib64: not 1 argument"
	return 1
    fi

    # Save arguments in logical names
    chklib64=$1
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg "Checking if $chklib64 is a 64bit library"
    if [ "x`basename $chklib64 .a`" != "x`basename $chklib64`" ]; then
        # we have an archive .a file
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg " objdump -a $chklib64 | grep 'x86-64'"
        objdump -a $chklib64 | grep 'x86-64' > /dev/null 2>& 1
Fons Rademakers's avatar
Fons Rademakers committed
	ret=$?
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg " file -L $chklib64 | grep '64-bit'"
        file -L $chklib64 | grep '64-bit' > /dev/null 2>& 1
Fons Rademakers's avatar
Fons Rademakers committed
	ret=$?
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg " result: $ret"
    if test $ret -eq 0 ; then
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg " is a 64bit library"
#_____________________________________________________________________
check_library() {
    # This function will try to locate a library [$1] in the specific
    # directory [$3] or in a default path [$*].  If the second argument
    # [$2] is not "no", then shared libraries are favoured.
    # The result of the search is stored in found_lib and found_dir,
    # which should be immediately copied, since the variables value will
    # be overwritten at next invocation of this function.

    # Assert that we got enough arguments
    if test $# -lt 4 ; then
	echo "check_library: Too few arguments"
	return 1
    fi

    libdirs="$*"

    # Write a message
    checking_msg $lib

    # check if we got a specific argument as to where the library
    # is to be found
    if test ! "x$libdirl" = "x" ; then
        libdirs=$libdirl
    fi
    found_lib=no
    found_dir=no

    # Make list of libraries to search for. The .lib extension is for
    # Windoze - note $shared is always "no" on windoze, since we need
    # the .lib export library to link.
    libs=""
    for i in $lib ; do
	for ext in .a .lib "" ; do     # lib without extension for MacOS X
    slibs=""
    for i in $lib ; do
        for ext in .so .sl .dylib .dll.a ; do      # .dll.a for cygwin gcc
            slibs="$slibs $i$ext"
        done
    done
    if test ! "x$shared" = "xno" ; then
	libs="$slibs $libs"
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg "libraries to check for: $libs"
    # Loop over the list of possible directories, and see if we can
    # find any of the library files as determind above.
        # look first in the lib32 directories
        if test "x$checklib32" = "xyes" ; then
            i32=`echo $i | sed -e 's|lib$|lib32|' -e 's|lib/|lib32/|'`
        # look first in the lib64 directories
        if test "x$checklib64" = "xyes" ; then
            i64=`echo $i | sed -e 's|lib$|lib64|' -e 's|lib/|lib64/|'`
            i="$i64 $i"
        fi
        # look only in the lib64 directories
        if test "x$checkonlylib64" = "xyes" ; then
            i64=`echo $i | sed -e 's|lib$|lib64|' -e 's|lib/|lib64/|'`
        # look only in the hpux64 directories
Fons Rademakers's avatar
Fons Rademakers committed
        if test "x$checkhpux64" = "xyes" ; then
Fons Rademakers's avatar
Fons Rademakers committed
            i64=`echo $i | sed 's|\(lib\)|\1/hpux64|'`
Fons Rademakers's avatar
Fons Rademakers committed
        fi
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg " Checking in directories $i for $libs"
Fons Rademakers's avatar
Fons Rademakers committed
            l=`echo $l | sed 's,^//,/,'`
Fons Rademakers's avatar
Fons Rademakers committed
            if test ! -d $l ; then
		continue
            fi
Fons Rademakers's avatar
Fons Rademakers committed
		logmsg "  Checking for library $j in directory $i"
	        # if we found the file (it's readable by user), we set the
	        # logical variables and are on our way, otherwise we continue
                liblist=`echo $l/$j`    # expands wildcard in $l/$j
                for n in ${liblist} ; do
Fons Rademakers's avatar
Fons Rademakers committed
		    logmsg "   Checking $n"
Fons Rademakers's avatar
Fons Rademakers committed
			logmsg "   Found file $n"
                        if test "x$checklib64" = "xyes" ; then
                            check_lib64 $n
                            if test $is_lib64 -eq 1 ; then
                                found_dir=$l
                                found_lib=$j
                                break 4
                            fi
                        else
                            found_dir=$l
                            found_lib=$j
                            if test "x$arch" = "linux"; then
                               check_lib64 $n
                            else
                               is_lib64=0
                            fi
                            if test $is_lib64 -eq 1 ; then
                                found_dir=no
                                found_lib=no
Fons Rademakers's avatar
Fons Rademakers committed
                            else
                                # skip cygwin libraries when in pure Win32 mode
                                if test "x$platform" = "xwin32"; then
                                    case $found_dir in
                                        /lib|/lib/*|/usr/*) found_dir=no ;;
                                        *) break 4;;
                                    esac
                                else
                                    break 4
                                fi
Fons Rademakers's avatar
Fons Rademakers committed
                            fi
Fons Rademakers's avatar
Fons Rademakers committed
		    else
Fons Rademakers's avatar
Fons Rademakers committed
			logmsg "  $j not found in $j"
    if test "x$found_dir" = "xno" || test "x$found_lib" = "xno" ; then
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg " library not found"
	    for ext in .a .lib "" ; do     # lib without extension for MacOS X
		if test "x$found_lib" = "x$i$ext" ; then
		    flib=$i$ext
                    if test "x$ext" = "x" ; then
                        maclib="yes"
                    fi
                    break 2

	if (test "x$found_lib" = "x$flib" && test "x$shared" = "xno") || \
           test "x$maclib" = "xyes" ; then
	    found_lib=${found_dir}/${found_lib}
Rene Brun's avatar
Rene Brun committed
	    found_raw_dir=${found_dir}
	    found_dir=""
	else
	    found_lib=`echo $found_lib | sed 's|^lib\(.*\)\..*|-l\1|'`
Rene Brun's avatar
Rene Brun committed
       found_raw_dir=${found_dir}
            # Avoid inclusion of /usr/lib, which is always included anyway
            if test "x$found_dir" = "x-L/usr/lib"   || \
               test "x$found_dir" = "x-L/usr/lib32" || \
               test "x$found_dir" = "x-L/usr/lib64" ; then

        # Correct path for win32
        if test "x$platform" = "xwin32"; then
            if test ! "x$found_lib" = "x" ; then
                found_lib=`cygpath -m $found_lib`
            fi
            if test ! "x$found_dir" = "x" ; then
               found_dir=`cygpath -m $found_dir`
            fi
        fi
#_____________________________________________________________________
check_header()  {
    # This function will try to locate a header [$1] in the specific
    # directory [$2] or in a default path [$*].
    # The result of the search is stored in found_hdr and found_dir,
    # which should be immediately copied, since the variables value will
    # be overwritten at next invocation of this function.

    # Assert that we got enough arguments
    if test $# -lt 3 ; then
	echo "check_header: Too few arguments"
	return 1
    fi

    # Save arguments in logical names
    hdrs=$1     ; shift
    hdrdir=$1   ; shift
    hdrdirs="$*"

    # Write a message
    checking_msg $hdrs

    # Check if we got a specific argument as to where the library
    # is to be found
    if test ! "x$hdrdir" = "x" ; then
        hdrdirs=$hdrdir
    fi
    found_hdr=no
    found_dir=no

    # Loop over the list of possible directories, and see if we can
    # find any of the library files as determind above.
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg " Checking in directory $i"
Fons Rademakers's avatar
Fons Rademakers committed
	    logmsg "  Checking for $j in directory $i"
	    # if we found the file (it's readable by user), we set the
	    # logical variables and are on our way, otherwise we continue
            if test -r $i/$j ; then
Fons Rademakers's avatar
Fons Rademakers committed
		logmsg "  $i/$j is read-able"
Fons Rademakers's avatar
Fons Rademakers committed
                # skip cygwin headers when in pure Win32 mode
                if test "x$platform" = "xwin32"; then
                    case $found_dir in
                        /usr/*) found_dir="no" ;;
                        *) break 2;;
                    esac
                else
                    break 2
                fi
    if test "x$found_hdr" = "xno" || test "x$found_dir" = "xno" ; then
	found_hdr=""
	found_dir=""
    fi

    # Avoid inclusion of /usr/include, which is always included anyway
    #if test "x$found_dir" = "x/usr/include" ; then
	# found_dir="include"
    #fi
    if test "x$platform" = "xwin32"; then
        if test ! "x$found_hdr" = "x" ; then
           found_hdr=`cygpath -m $found_hdr`
        fi
        if test ! "x$found_dir" = "x" ; then
           found_dir=`cygpath -m $found_dir`
        fi
    fi

#_____________________________________________________________________
check_symbol() {
    # This function will try to locate a symbol [$1] in a specific
    # library [$2] and in a given directory [$3].
    # The result of the check is stored in found_symbol, 1 if true,
    # 0 otherwise, which should be immediately copied, since the variable
    # will be overwritten at next invocation of this function.

    # Assert that we got enough arguments
    if test $# -ne 3 ; then
	echo "check_symbol: not 3 arguments"
        found_symbol=0
	return 1
    fi

    # Save arguments in logical names
    symbol=$1     ; shift
    symbollib=$1  ; shift
    symboldir=$1

    if test "x$symbollib" = "x" ; then
        found_symbol=0
        return 1
    fi

    symbollib=`echo $symbollib | sed -e 's/^-l/lib/'`

    if test ! "x$symboldir" = "x" ; then
        symboldir=`echo $symboldir | sed -e 's/^-L//'`
    # Check if we got a specific argument as to where the library
    # is to be found
    symbolfile=$symbollib
Fons Rademakers's avatar
Fons Rademakers committed
    exts=".so .lib"
    if test ! "x$shared" = "xno" ; then
	exts="$exts .a"
    else
	exts=".a $exts"
    fi

    usrlib="/usr/lib"
    # look first in the lib32 directories
    if test "x$checklib32" = "xyes" ; then
        usrlib="/usr/lib32 $usrlib"
    fi
    # look first in the lib64 directories
    if test "x$checklib64" = "xyes" ; then
        usrlib="/usr/lib64 $usrlib"
    fi
    # look only in the lib64 directories
    if test "x$checkonlylib64" = "xyes" ; then
        usrlib="/usr/lib64"
    fi
    # look only in the hpux64 directories
    if test "x$checkhpux64" = "xyes" ; then
Fons Rademakers's avatar
Fons Rademakers committed
	logmsg " Checking in $d"
Fons Rademakers's avatar
Fons Rademakers committed
	if test ! -r $d/$symbollib ; then
Fons Rademakers's avatar
Fons Rademakers committed
	    logmsg "  $d/$symbollib not readable"
Fons Rademakers's avatar
Fons Rademakers committed
	    for i in $exts ; do
Fons Rademakers's avatar
Fons Rademakers committed
		logmsg "   Checking extension $i with $d/$symbollib"
Fons Rademakers's avatar
Fons Rademakers committed
		if test -r $d/$symbollib$i ; then
Fons Rademakers's avatar
Fons Rademakers committed
		    logmsg "   $d/$symbollib$i readable"
Fons Rademakers's avatar
Fons Rademakers committed
		    symbolfile=$d/$symbollib$i
		    break 2
Fons Rademakers's avatar
Fons Rademakers committed
        else
            logmsg "$d/$symbollib readable"
            symbolfile=$d/$symbollib
            break
Fons Rademakers's avatar
Fons Rademakers committed
    done

    if test "x$symbolfile" = "x" || test ! -r $symbolfile ; then
       found_symbol=0
Fons Rademakers's avatar
Fons Rademakers committed
       logmsg " Symbol not found"
Fons Rademakers's avatar
Fons Rademakers committed
    checking_msg "$symbol in $symbolfile"
Fons Rademakers's avatar
Fons Rademakers committed
    nm $symbolfile 2>&1 | grep $symbol > /dev/null 2>&1
    if test $? -eq 0 ; then
        found_symbol=1
Fons Rademakers's avatar
Fons Rademakers committed
        logmsg " Symbol found"
Fons Rademakers's avatar
Fons Rademakers committed
	nm $symbolfile 2>&1 | grep "no symbols" > /dev/null 2>&1
Fons Rademakers's avatar
Fons Rademakers committed
	if test $? -eq 0 ; then
Fons Rademakers's avatar
Fons Rademakers committed
	    logmsg " $symbolfile is stripped, trying a link"
Fons Rademakers's avatar
Fons Rademakers committed
	    # stripped library - only safe test is to link against the
	    # library!  However, we do not know what compiler to use
	    # so we can not do the test.  Assume the symbol is in
	    cat <<EOF > conftest.mk
include config/Makefile.${arch}
conftest:conftest.c $symbolfile
	\$(CC) \$(CFLAGS) \$(LDFLAGS) $symbolfile \$< -o \$@

conftest.c:
	echo "extern int $symbol (); " > \$@
	echo "int main() { $symbol (); return 0; }" >> \$@
EOF
Fons Rademakers's avatar
Fons Rademakers committed
	    $gnumake -f conftest.mk >> $logfile 2>&1
Fons Rademakers's avatar
Fons Rademakers committed
	    if test $? -eq 0 ; then
		found_symbol=1
Fons Rademakers's avatar
Fons Rademakers committed
		logmsg " Link OK"
Fons Rademakers's avatar
Fons Rademakers committed
	    else
Fons Rademakers's avatar
Fons Rademakers committed
		found_symbol=0
Fons Rademakers's avatar
Fons Rademakers committed
		logmsg " Failed code was"
Fons Rademakers's avatar
Fons Rademakers committed
		cat conftest.mk >> $logfile
	    fi
	    rm -rf conftest.c conftest.mk conftest
Fons Rademakers's avatar
Fons Rademakers committed
	else
	    found_symbol=0
	fi
    fi
    if test $found_symbol -eq 1 ; then
Fons Rademakers's avatar
Fons Rademakers committed
	result "ok"
Fons Rademakers's avatar
Fons Rademakers committed
    else
Fons Rademakers's avatar
Fons Rademakers committed
	result "no"
Fons Rademakers's avatar
Fons Rademakers committed
    fi
#_____________________________________________________________________
check_comp() {
    # This function will try to locate the default or alt compiler
    # type [$1] in the PATH.
    # The result of the check is stored in found_comp, 1 if true,
    # 0 otherwise, which should be immediately copied, since the variable
    # will be overwritten at next invocation of this function.

    # Assert that we got enough arguments
    if test $# -ne 1 ; then
        echo "check_comp: not 1 argument"
        found_comp=0
        return 1
    fi

    comptype="$1"

    if test "x$comptype" = "xLD" ; then
       message "Checking for linker (LD)"
    else
       message "Checking for $comptype compiler"
    fi

    found_comp=0
    case $comptype in
    C)
        if test "x$altcc" = "x" ; then
            altcc=`grep '^CC ' config/Makefile.$arch | awk '{ if (NF==3) {print $3; exit 0} }'`
        fi
        if `$cwhich $altcc > /dev/null 2>&1` ; then
            found_comp=1
            result "$altcc"
        else
            nocomp="$altcc"
        fi
        ;;
    C++)
        if test "x$altcxx" = "x" ; then
            altcxx=`grep '^CXX ' config/Makefile.$arch | awk '{ if (NF==3) {print $3; exit 0} }'`
        fi
        if `$cwhich $altcxx > /dev/null 2>&1` ; then
            found_comp=1
            result "$altcxx"
        else
            nocomp="$altcxx"
        fi
        ;;
    LD)
        if test "x$altld" = "x" ; then
            altld=`grep '^LD ' config/Makefile.$arch | awk '{ if (NF==3) {print $3; exit 0} }'`
            if test "x$arch" = "xwin32" ; then
                altldorg="link"
                altldtmp="$altld"
                altld="$altldorg"
            fi
            if test "x$arch" = "xwin32gcc" ; then
                altldorg="g++"
                altldtmp="$altld"
                altld="$altldorg"
            fi
        fi
        if `$cwhich $altld > /dev/null 2>&1` ; then
            found_comp=1
            if test ! "x$altldtmp" = "x" ; then
                altld="$altldtmp"
            fi
            altf77=`grep '^F77 ' config/Makefile.$arch | awk '{ if (NF==3) {print $3; exit 0} }'`
                altf77org="fl32"
                altf77tmp="$altf77"
                altf77="$altf77org"
            fi
        fi
        if `$cwhich $altf77 > /dev/null 2>&1` ; then
            found_comp=1
            if test ! "x$altf77tmp" = "x" ; then
                altf77="$altf77tmp"
        fi
        ;;
    esac

    if test $found_comp -eq 0 ; then
       result "no $comptype compiler $nocomp found"
    fi
}

Fons Rademakers's avatar
Fons Rademakers committed
#_____________________________________________________________________
check_explicit()
{
    feat=$1 ; shift
    expl=$1 ; shift
    emsg=$1 ; shift

    if test "x$fail_on_missing" = "xno" ; then return 0 ; fi
Fons Rademakers's avatar
Fons Rademakers committed
    if test ! "x$expl" = "xyes" ; then return 0 ; fi
Fons Rademakers's avatar
Fons Rademakers committed
    if test ! "x$feat" = "xyes" ; then
	result $emsg
	exit 1
    fi
}

#_____________________________________________________________________
    # Try to guess the architecture of the host system
    # Note, that there's no attempt at guessing the compiler.
    # The `native' compiler is used in all cases.
    # If a user really want a specifific compiler, s/he better use the
    # first argument to do so.
    arch=`uname -s | tr '[A-Z]' '[a-z]'`
    chip=`uname -m | tr '[A-Z]' '[a-z]'`
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg "arch=$arch"
    logmsg "chip=$chip"
    logmsg "rele=$rele"
    case "$arch:$chip:$rele" in
        aix*)                  arch=aix5            ;;
        osf1*:alpha:*)         arch=alphacxx6       ;;
Fons Rademakers's avatar
Fons Rademakers committed
        freebsd*:*:7*)         arch=freebsd7        ;;
        freebsd*:*:6*)         arch=freebsd5        ;;
Fons Rademakers's avatar
Fons Rademakers committed
        freebsd*:*:5*)         arch=freebsd5        ;;
        freebsd*:*:4*)         arch=freebsd4        ;;
        freebsd*:*:*)          arch=freebsd         ;;
        hp-ux:ia64:*)          arch=hpuxia64acc     ;;
        hp-ux:*:*)             arch=hpuxacc         ;;
        hurd*:*:*)             arch=hurddeb         ;;
        linux:ia64:*)          arch=linuxia64gcc    ;;
        linux:x86_64:*)        arch=linuxx8664gcc   ;;
        linux:alpha:*)         arch=linuxalphagcc   ;;
Fons Rademakers's avatar
Fons Rademakers committed
        linux:hppa*:*)         arch=linux           ;;
        linux:mips:*)          arch=linuxmips       ;;
Rene Brun's avatar
Rene Brun committed
        linux:sparc*:*)        arch=linux           ;;
Fons Rademakers's avatar
Fons Rademakers committed
        linux:parisc*:*)       arch=linuxhppa       ;;
        linux:ppc64*:*)        arch=linuxppc64gcc   ;;
        linux:ppc*:*)          arch=linuxppcgcc     ;;
Fons Rademakers's avatar
Fons Rademakers committed
        openbsd*:*:*)          arch=openbsd         ;;
        darwin:power*:*)       arch=macosx          ;;
        darwin:*86*:*)         arch=macosx          ;;
        irix*:sgi*:*)          arch=sgicc           ;;
        sunos:sun*:6*)         arch=solarisCC5      ;;
        sunos:sun*:5*)         arch=solarisCC5      ;;
        sunos:sun*:4*)         arch=solaris         ;;
        sunos:i86pc:5*)        arch=solarisCC5      ;;
        cygwin_*:*86:*)        arch=win32           ;;
        cygwin_*:pentium:*)    arch=win32           ;;
        cygwin_*:ia64)         arch=win32           ;;
        *)
            echo "Attempts at guessing your architecture failed."
Fons Rademakers's avatar
Fons Rademakers committed
	    echo "(triplet is $arch:$chip:$rele)"
            echo "Please specify the architecture as the first argument."
            echo "Do '$0 --help' for a list of avaliable architectures."
Fons Rademakers's avatar
Fons Rademakers committed
            echo "Or file a bug at https://savannah.cern.ch/projects/savroot/"
            echo "including the full config.log and a dump of"
Fons Rademakers's avatar
Fons Rademakers committed
            echo "  touch dummy_file.c; gcc -E -dM dummy_file.c"
       if [ `sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` -ge 5 ]; then
          if `sysctl machdep.cpu.extfeatures | grep "64" > /dev/null  2>&1` ; then
             arch=macosx64
          fi
       fi
    fi
###################################################################
#
### echo %%% Some skeleton and config files
#
ARCHS=config/ARCHS
MAKEIN=config/Makefile.in
MAKEOUT=config/Makefile.config
MAKECOMPIN=config/Makefile-comp.in
MAKECOMPOUT=config/Makefile.comp
CONFIGUREIN=config/RConfigure.in
CONFIGUREOUT=include/RConfigure.h
CONFIGOPTIN=config/RConfigOptions.in
CONFIGOPTOUT=include/RConfigOptions.h
RCONFIN=config/root-config.in
RCONFOUT=bin/root-config
ROOTRCOUT=etc/system.rootrc
ROOTAUTHRCIN=config/rootauthrc.in
ROOTAUTHRCOUT=etc/system.rootauthrc
ROOTDAEMONRCIN=config/rootdaemonrc.in
ROOTDAEMONRCOUT=etc/system.rootdaemonrc
MEMPROBEIN=config/memprobe.in
MEMPROBEOUT=bin/memprobe
MIMEUNIXIN=config/mimes.unix.in
MIMEWIN32IN=config/mimes.win32.in
MIMEOUT=etc/root.mimes
Fons Rademakers's avatar
Fons Rademakers committed
ROOTDIN=config/rootd.in
ROOTDOUT=etc/daemons/rootd.rc.d
ROOTDXINETDIN=config/rootd.xinetd.in
ROOTDXINETDOUT=etc/daemons/rootd.xinetd
PROOFDIN=config/proofd.in
PROOFDOUT=etc/daemons/proofd.rc.d
PROOFDXINETDIN=config/proofd.xinetd.in
PROOFDXINETDOUT=etc/daemons/proofd.xinetd
Fons Rademakers's avatar
Fons Rademakers committed
XROOTDIN=config/xrootd.in
XROOTDOUT=etc/daemons/xrootd.rc.d
OLBDIN=config/olbd.in
OLBDOUT=etc/daemons/olbd.rc.d
Fons Rademakers's avatar
Fons Rademakers committed
ROOTHELPIN=config/root-help.el.in
ROOTHELPOUT=build/misc/root-help.el
HTMLIN=config/html.C.in
HTMLOUT=macros/html.C
THISROOTSHIN=config/thisroot.sh
THISROOTSHOUT=bin/thisroot.sh
THISROOTCSHIN=config/thisroot.csh
THISROOTCSHOUT=bin/thisroot.csh
Fons Rademakers's avatar
Fons Rademakers committed
THISROOTBATIN=config/thisroot.bat
THISROOTBATOUT=bin/thisroot.bat
Fons Rademakers's avatar
Fons Rademakers committed
GENREFLEXSHIN=config/genreflex.in
GENREFLEXSHOUT=bin/genreflex
GENREFLEXBATIN=config/genreflex.bat.in
GENREFLEXBATOUT=bin/genreflex.bat
GENREFLEXROOTCINTSHIN=config/genreflex-rootcint.in
GENREFLEXROOTCINTSHOUT=bin/genreflex-rootcint
GENREFLEXROOTCINTBATIN=config/genreflex-rootcint.bat.in
GENREFLEXROOTCINTBATOUT=bin/genreflex-rootcint.bat
ROOTCINTSTUBSHIN=utils/src/rootcint_nostubs.sh
ROOTCINTSTUBSHOUT=bin/rootcint_nostubs.sh
# unset global command options that can cause havoc
unset GREP_OPTIONS

######################################################################
#
### echo %%% Testing the echo features
#
if `(echo "testing\c"; echo 1,2,3) | grep c > /dev/null` ; then
  if `(echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn > /dev/null`; then
    ac_n= ac_c='
' ac_t='	'
  else
    ac_n=-n ac_c= ac_t=
  fi
else
  ac_n= ac_c='\c' ac_t=
fi

######################################################################
#
### echo %%% Help function
#
\`configure' configures ROOT $vers to adapt to many kind of systems.

Usage:     $0 [architecture] [flag=value]

The architecture to build for will be guessed from the output of 'uname'.
If, however, that fails, or you don't want the 'native' compiler on the
host platform, you can specify the architecture to use by passing as the
FIRST argument one of the architecures given at the end of this message.

   FLAG            DESCRIPTION               DEFAULT
   --aclocaldir    Autoconf macro install dir(<prefix>/share/aclocal)
   --bindir        Binary installation dir   (<prefix>/bin)
   --build         Build configuration [debug, exceptions, ...],
                   overrides the ROOTBUILD shell variable
   --cintincdir    CINT interpeted headers   (<libdir>/cint)
   --datadir       Data installation dir     (<prefix>/share/root)
   --docdir        Documentation             (<prefix>/share/doc/root)
   --elispdir      Where to put Emacs Lisp   (<prefix>/share/emacs/site-lisp)
   --etcdir        Config installation dir   (/etc/root)
   --fontdir       Font installation dir     (<datadir>/fonts)
   --iconpath      Icon installation dir     (<datadir>/icons)
   --incdir        Header installation dir   (<prefix>/include/root)
   --libdir        Library installation dir  (<prefix>/lib/root)
   --macrodir      Macro installation dir    (<datadir>/macros)
   --mandir        Manpages installation dir (<prefix>/share/man/man1)
   --no-create     Do not create output files, dry run
   --no-stubs      Remove Stubs from dictionaries (Direct call mechanism)
   --no-stubs-test Remove Stubs from dictionaries (Direct call mechanism, can be switched off in rootrc)
   --prefix        Installation prefix       (/usr/local)
   --srcdir        Sources installation dir  (<datadir>/src)
   --testdir       Tests                     (<docdir>/test)
   --tutdir        Tutorials                 (<docdir>/tutorial)

If any of the flags --cintincdir, --datadir, --docdir, --etcdir, --iconpath
--incdir, --libdir, --macrodir, --mandir, or --prefix is given,
ROOT will be compiled with static directory names, and you should not set
the ROOTSYS environment variable.

enable/disable options, prefix with either --enable- or --disable-
  afs                AFS support, requires AFS libs and objects
Fons Rademakers's avatar
Fons Rademakers committed
  alien              AliEn support, requires libgapiUI from ALICE
  asimage            Image processing support, requires libAfterImage
  astiff             Include tiff support in image processing