Skip to content
Snippets Groups Projects
configure 289 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 "****************************************************************************************************************"
echo "*  The classic configure/make method of building ROOT is now DEPRECATED in favor of the CMake one.             *"
echo "*  Refer to README/INSTALL file for updated instructions or visit the page https://root.cern.ch/building-root  *"
echo "****************************************************************************************************************"

#
### echo %%% Some global variables
#
found_lib=no
found_dir=no
found_hdr=no
Fons Rademakers's avatar
Fons Rademakers committed
found_ext=
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
   enable_cintex             \
   enable_reflex             \
   enable_cxx11              \
Fons Rademakers's avatar
Fons Rademakers committed
"

options="                    \
   enable_afdsmgrd           \
   enable_afs                \
   enable_alien              \
   enable_asimage            \
   enable_builtin_afterimage \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_builtin_ftgl       \
   enable_builtin_freetype   \
   enable_builtin_gl2ps      \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_builtin_glew       \
   enable_builtin_pcre       \
   enable_builtin_unuran     \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_builtin_zlib       \
   enable_libcxx             \
   enable_chirp              \
   enable_dcache             \
   enable_explicitlink       \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_fink               \
Rene Brun's avatar
Rene Brun committed
   enable_fftw3              \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_fitsio             \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_gviz               \
   enable_gdml               \
   enable_geocad             \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_gfal               \
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_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             \
   enable_pgsql              \
   enable_pythia6            \
   enable_python             \
   enable_qt                 \
   enable_qtgsi              \
   enable_ruby               \
   enable_rfio               \
   enable_rpath              \
   enable_sapdb              \
   enable_shadowpw           \
   enable_shared             \
   enable_soversion          \
   enable_srp                \
   enable_ssl                \
   enable_table              \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_tmva               \
Rene Brun's avatar
Rene Brun committed
   enable_unuran             \
   enable_werror             \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_winrtdebug         \
Fons Rademakers's avatar
Fons Rademakers committed
   enable_xft                \
   enable_xml                \
   enable_xrootd             \
Fons Rademakers's avatar
Fons Rademakers committed
DEFAULTENABLE="yes"
for flag in "$@"; do
    case $flag in
Fons Rademakers's avatar
Fons Rademakers committed
    --gminimal)
       DEFAULTENABLE="no"
Fons Rademakers's avatar
Fons Rademakers committed
       break ;;
     --minimal)
       DEFAULTENABLE="no"
       MINIMALENABLE=""
       break ;;
    esac
done

Fons Rademakers's avatar
Fons Rademakers committed
# This sets all options to "yes" unless --minimal is specified.
# We turn off those we don't want on per default explictly afterwards.
Fons Rademakers's avatar
Fons Rademakers committed
for c in $options $deprecated_options; do
    case ${c} in
        ${MINIMALENABLE}) eval ${c}="yes" ;;
        enable_shared)    eval ${c}="yes" ;;
        *)                eval ${c}="${DEFAULTENABLE}" ;;
    esac
done
Fons Rademakers's avatar
Fons Rademakers committed
for c in $options ; do eval ${c}_explicit="" ; done
enable_cxx11=yes
enable_libcxx=no
enable_gdml=no
enable_geocad=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)
Rene Brun's avatar
Rene Brun committed
enable_unuran=no
enable_werror=no
Fons Rademakers's avatar
Fons Rademakers committed
enable_winrtdebug=
enable_builtin_freetype=no
enable_builtin_ftgl=no
enable_builtin_gl2ps=no
Fons Rademakers's avatar
Fons Rademakers committed
enable_builtin_glew=no
enable_builtin_unuran=no
Fons Rademakers's avatar
Fons Rademakers committed
enable_afdsmgrd=no
if test "x$ENABLEALL" = "xyes"; then
    enable_gdml=yes
    enable_geocad=yes
    enable_qt=yes
    enable_qtgsi=yes
    enable_roofit=yes
    enable_minuit2=yes
Fons Rademakers's avatar
Fons Rademakers committed
    #enable_ruby=yes     #not supported in ROOT v6.0.0 yet
    enable_r=yes
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           \
ORACLE           \
Fons Rademakers's avatar
Fons Rademakers committed
GFAL             \
Fons Rademakers's avatar
Fons Rademakers committed
GSL              \
Rene Brun's avatar
Rene Brun committed
FFTW3            \
Fons Rademakers's avatar
Fons Rademakers committed
CFITSIO          \
Fons Rademakers's avatar
Fons Rademakers committed
GVIZ             \
Rene Brun's avatar
Rene Brun committed
PYTHONDIR        \
Fons Rademakers's avatar
Fons Rademakers committed
AVAHI            \
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           \
CASROOT          \
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
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
Fons Rademakers's avatar
Fons Rademakers committed
    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
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg $ac_n "Checking for$ac_c"
    while test $# -gt 1 ; do
        echo $ac_n " $1,$ac_c"
        logmsg $ac_n " $1,$ac_c"
        shift
        if test $# -eq 1 ; then
            echo $ac_n " or$ac_c"
            logmsg $ac_n " or$ac_c"
        fi
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg " $1 ... "
#_____________________________________________________________________
check_libpic() {
    # This function will try to find out if an archive library [$1]
    # contains relocatable code. Currently works only for linux.
    # The result of the check is stored in is_libpic, 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_libpic: not 1 argument"
        return 1
    fi

    case $platform in
    linux) ;;
           ;;
    esac

    # Save arguments in logical names
    chklibpic=$1
    if [ "x`basename $chklibpic .a`" != "x`basename $chklibpic`" ]; then
        # we have an archive .a file
        logmsg "Checking if $chklibpic contains relocatable code"
Fons Rademakers's avatar
Fons Rademakers committed
        logmsg " objdump -r $chklibpic | grep -v ' .debug_' | grep 'R_X86_64_32'"
        objdump -r $chklibpic | grep -v ' .debug_' | grep 'R_X86_64_32' > /dev/null 2>& 1
        ret=$?
        logmsg " result: $ret"
        if test $ret -eq 0 ; then
            is_libpic=0
            logmsg " is not a relocatable library"
#_____________________________________________________________________
check_libcompat() {
    # This function will try to find out if a library [$1] contains
    # compatible 64 bit or 32 bit code matching the selected architecture.
    # Currently only MacOS X supports universal libs.
    # The result of the check is stored in is_libcompat, 1 if true,
    # 0 otherwise, which should be immediately copied, since the variable
    # will be overwritten at next invocation of this function.

    is_libcompat=0
    ret=0

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

    # Save arguments in logical names
    chklibcompat=$1
    logmsg "Checking if $chklibcompat contains compatible code"

    case $arch in
    macosx)
            ;;
        *)
            logmsg " lipo $chklibcompat -verify_arch i386"
            if lipo $chklibcompat -verify_arch i386 ; then
                ret=1
            fi
            ;;
        esac
            ;;
        *)
            logmsg " lipo $chklibcompat -verify_arch x86_64"
            if lipo $chklibcompat -verify_arch x86_64 ; then
                ret=1
            fi
            ;;
        esac
        ;;
    esac

    logmsg " result: $ret"
    if test $ret -eq 1 ; then
        is_libcompat=1
        logmsg " is a compatible library"
    else
        is_libnotcompat=1
        logmsg " is a not-compatible library"
#_____________________________________________________________________
check_libcxxcompat() {
    # This function will try to find out if a library [$1] is linked
    # against a compatible C++ run-time library (either libstdc++ or libc++).
    # Currently only MacOS X and Linux support libc++ and libstdc++.
    # The result of the check is stored in is_libcxxcompat, 1 if true,
    # 0 otherwise, which should be immediately copied, since the variable
    # will be overwritten at next invocation of this function.
    # To skip this check, in case std types are not used in the public
    # API of the library, set skipchecklibcxxcompat="yes".

    is_libcxxcompat=1
    ret=0

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

    # Can we skip the check in case library has no std C++ in public API
    if test "x$skipchecklibcxxcompat" = "xyes"; then
        skipchecklibcxxcompat=""
        logmsg "check_libcxxcompat: skipping check for $1"
        return
    fi

    # Save arguments in logical names
    chklibcxxcompat=$1
    logmsg "Checking if $chklibcxxcompat is linked against compatible C++ run-time"

    if test "x$enable_libcxx" = "xyes"; then
        case $arch in
        macosx*)
            logmsg " otool -L $chklibcxxcompat | grep libstdc++"
            if otool -L $chklibcxxcompat | grep 'libstdc++' > /dev/null 2>& 1 ; then
                ret=1
            fi
            ;;
        linux*)
            logmsg " ldd $chklibcxxcompat | grep libstdc++"
            if ldd $chklibcxxcompat | grep 'libstdc++' > /dev/null 2>& 1 ; then
                ret=1
            fi
            ;;
        esac
    else
        case $arch in
        macosx*)
            logmsg " otool -L $chklibcxxcompat | grep libc++"
            if otool -L $chklibcxxcompat | grep 'libc++' > /dev/null 2>& 1 ; then
                ret=1
            fi
            ;;
        linux*)
            logmsg " ldd $chklibcxxcompat | grep libc++"
            if ldd $chklibcxxcompat | grep 'libc++' > /dev/null 2>& 1 ; then
                ret=1
            fi
            ;;
        esac
    fi

    logmsg " result: $ret"
    if test $ret -eq 1 ; then
        is_libcxxcompat=0
        logmsg " is linked against not-compatible C++ run-time library"
    else
        logmsg " is linked against compatible C++ run-time library"
    fi
}

#_____________________________________________________________________
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 and solaris.
    # 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
    filearg=
    case $platform in
        linux)   filearg="-L" ;;
        solaris) ;;
        *)       return 1;;
    esac

    # Save arguments in logical names
    chklib64=$1
    logmsg "Checking if $chklib64 is a 64-bit library"
    if [ "x`basename $chklib64 .a`" != "x`basename $chklib64`" ]; then
        # we have an archive .a file
        if [ "x$platform" = "xlinux" ]; then
            logmsg " objdump -a $chklib64 | grep 'x86-64'"
            if objdump -a $chklib64 | grep 'x86-64' > /dev/null 2>& 1 ; then
                ret=1
            fi
        fi
        if [ "x$platform" = "xsolaris" ]; then
            chklib64file=`ar t $chklib64 | awk '{if (NR == 2) print $1}'`
            logmsg " ar x $chklib64 $chklib64file"
            ar x $chklib64 $chklib64file
            logmsg " file $filearg $chklib64file | grep '64-bit'"
            if file $filearg $chklib64file | grep '64-bit' > /dev/null 2>& 1 ; then
                ret=1
            fi
            rm -f $chklib64file
        if file $filearg $chklib64 | grep 'ASCII' > /dev/null 2>& 1 ; then
            check_link $chklib64
            ret=$link_result
        else
            logmsg " file $filearg $chklib64 | grep '64-bit'"
            if file $filearg $chklib64 | grep '64-bit' > /dev/null 2>& 1 ; then
Fons Rademakers's avatar
Fons Rademakers committed
    logmsg " result: $ret"
#_____________________________________________________________________
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
Philippe Canal's avatar
Philippe Canal committed
    # [$2] is not "no" or "staticonly", 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
        sdklibs=""
        for i in $libdirs; do
            #if test $i = "/usr/lib"; then
                sdklibs="$sdklibs ${iossdk}${i}"
            #else
            #    sdklibs="$sdklibs $i"
            #fi
        done
        libdirs="$sdklibs"
    if test "x$enable_search_usrlocal" = "xno" ; then
       no_usrlocal=""
       for i in $libdirs; do
           if [[ $i != /usr/local/* ]] ; then
               no_usrlocal="$no_usrlocal $i"
           fi
       done
       libdirs="$no_usrlocal"
    fi

    # 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
Fons Rademakers's avatar
Fons Rademakers committed
    found_ext=

    # 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
            libs="$libs $i$ext"
        done
        for ext in .so .sl .tbd .dylib .dll.a ; do      # .dll.a for cygwin gcc
Philippe Canal's avatar
Philippe Canal committed
    if test "x$shared" = "xno" ; then
Philippe Canal's avatar
Philippe Canal committed
    elif test "x$shared" = "xstaticonly" ; then
        libs="$libs"
    else
        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$checklinux64" = "xyes" ; then
            i64=`echo $i | sed -e 's|lib$|lib64|' -e 's|lib/|lib64/|'`
        # look first in the DEB_HOST_MULTIARCH directories
        if test "x$debmultiarch" != "x" ; then
            i64=`echo $i | sed "s|\(lib\)$|\1/$debmultiarch|"`
            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
        # look first in the amd64 directories
        if test "x$checksolaris64" = "xyes" ; then
            i64=`echo $i | sed 's|\(lib\)|\1/amd64|'`
        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
Fons Rademakers's avatar
Fons Rademakers committed
            fi
                logmsg "  Checking for library $j in directory $l"
                # 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
                        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
                            if test "x$checklibcompat" = "xyes" ; then
                                check_libcompat $n
                                if test $is_libcompat -eq 0 ; then
                                    break 4
                                fi
                            fi
                            if test "x$checklibcxxcompat" = "xyes" ; then
                                check_libcxxcompat $n
                                if test $is_libcxxcompat -eq 0 ; then
                                    break 4
                                fi
                            fi
                            if test "x$arch" = "xlinux"; 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
                        logmsg "  $j not found in $l"
    if test "x$found_dir" = "xno" || test "x$found_lib" = "xno" ; then
        found_dir=""
        found_lib=""
        found_raw_lib=""
        logmsg " library not found"
Fons Rademakers's avatar
Fons Rademakers committed
        found_ext=`echo $found_lib | sed 's|^lib\(.*\)\.\(.*\)|\2|'`
        for i in $lib ; do
            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") || \
            found_raw_lib=${found_lib}
            found_lib=${found_dir}/${found_lib}
            found_raw_dir=${found_dir}
            found_dir=""
        else
            found_raw_lib=${found_lib}
Philippe Canal's avatar
Philippe Canal committed
            if test ! "x$shared" = "xstaticonly" ; then
                found_lib=`echo $found_lib | sed 's|^lib\(.*\)\..*|-l\1|'`
Philippe Canal's avatar
Philippe Canal committed
            fi
Philippe Canal's avatar
Philippe Canal committed
            if test ! "x$shared" = "xstaticonly" ; then
Philippe Canal's avatar
Philippe Canal committed
            fi
            # 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
            if test "x$debmultiarch" != "x" ; then
                if test "x$found_dir" = "x-L/usr/lib/$debmultiarch" ; then
                    found_dir=""
                fi
            fi
            if test "x$checksolaris64" = "xyes" ; then
                if test "x$found_dir" = "x-L/usr/lib/amd64" || \
                   test "x$found_dir" = "x-L/usr/lib/64" ; then
                    found_dir=""
                fi
            fi
            if test "x$checkhpux64" = "xyes" ; then
                if test "x$found_dir" = "x-L/usr/lib/hpux64" ; then
                    found_dir=""
                fi
            fi

        # 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="$*"

        sdkhdrs=""
        for i in $hdrdirs; do
            #if test $i = "/usr/include"; then
                sdkhdrs="$sdkhdrs ${iossdk}${i}"
            #else
            #    sdkhdrs="$sdkhdrs $i"
            #fi
        done
        hdrdirs="$sdkhdrs"
    if test "x$enable_search_usrlocal" = "xno" ; then
       no_usrlocal=""
       for i in $hdrdirs; do
           if [[ $i != /usr/local/* ]] ; then
               no_usrlocal="$no_usrlocal $i"
           fi
       done
       hdrdirs="$no_usrlocal"
    fi
    # 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.
        logmsg " Checking in directory $i"
            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
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
    fi

    # Avoid inclusion of /usr/include, which is always included anyway
    #if test "x$found_dir" = "x/usr/include" ; then
    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_code() {
    # This function compiles a source file containing code from $1
    # with extra CXXFLAGS $2 (can be empty), e.g. to pass -I.
    # The result of the check is stored in include_result, 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 $# -lt 1 ; then
        echo "check_include: Too few arguments"
        return 1
    fi

    logmsg " Compiling $1 with flags '$2'"
Axel Naumann's avatar
Axel Naumann committed
    echo "$1" > conftest.cxx
    cat <<EOF > conftest.mk
include ${ac_srcdir}/config/Makefile.${arch}
CXX = ${altcxx}
conftest.o: conftest.cxx
	\$(CXX) $2 -c \$^ -o \$@
EOF
    $gnumake -f conftest.mk >> $logfile 2>&1
    if test $? -eq 0 ; then
        logmsg "  supported"
        include_result=1
    else
        logmsg "  not supported"
        include_result=0
    fi
    rm -f conftest.mk conftest.o conftest.cxx conftest.d
}

#_____________________________________________________________________
check_link() {
    # This function will try to link a specific library [$1] in an
    # optional directory [$2] and test, optionally, for a specified
    # symbol [$3].
    # The result of the check is stored in link_result, 1 if true,