#! /bin/sh ################################################################################ # # $Id: configure.classic,v 1.89 2009/06/11 08:31:19 ganis Exp $ # # # c o n f i g u r e . c l a s s i c # # (previously called configure) # # # # (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University # # All Rights Reserved. See XrdInfo.cc for complete License Terms # # Produced by Andrew Hanushevsky for Stanford University under contract # # DE-AC03-76-SFO0515 with the Department of Energy # # # # Oct 6, 2005 # # The name of this script has been changed to configure.classic to avoid # # interferences with the new build system based on autotools. The change has # # done directly in the CVS repository so the history of the file did not get # # lost. (D. Feichtinger, G. Ganis) # # # ################################################################################ # # # A simple configure script. # # # # Derived from the ROOT configure script written by Christian Holm Christensen # # and Fons Rademakers. # # Simplified and adapted for Xrd by G. Ganis # # # # 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 show_pkglist=no noact="no" nohowto="no" strlcpy="noidea" clientonly="no" seconly="no" usearchdirs="yes" suncache="/SunWS_cache" type=`uname -s` compile_log=config.log rm -f $compile.log options=" \ enable_afs \ enable_echo \ enable_gsi \ enable_krb4 \ enable_krb5 \ enable_mon \ enable_perlint \ enable_pwd \ enable_shadowpw \ enable_shared \ enable_ssl \ enable_trace \ enable_posix \ enable_javaint \ enable_oldhdrs " # # This sets all options to "yes" - we turn off those we don't want # on per default explictly afterwards. # for c in $options ; do eval $c="yes" ; done enable_afs=no enable_echo=no enable_mon=yes enable_perlint=no enable_shadowpw=no enable_shared=yes enable_ssl= enable_thread=yes enable_javaint=no enable_oldhdrs=no # # ./configure arguments and defaults set via supported env vars # envvars=" KRB4DIR \ KRB5DIR \ " configenvvars= for c in $envvars ; do cc=`eval echo "$"$c` if test ! "x$cc" = "x" ; then if test ! "x$configenvvars" = "x" ; then configenvvars="$configenvvars $c=$cc" else configenvvars="$c=$cc" fi fi done configargs="$*" # don't write --nohowto to config.h 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 ###################################################################### # ### 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" } #_____________________________________________________________________ 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" while test $# -gt 1 ; do echo $ac_n " $1,$ac_c" shift if test $# -eq 1 ; then echo $ac_n " or$ac_c" fi done echo $ac_n " $1 ... $ac_c" } #_____________________________________________________________________ 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 # Save arguments in local names lib=$1 ; shift shared=$1 ; shift libdirl=$1 ; shift 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 libs="$libs $i$ext" done done slibs="" for i in $lib ; do for ext in .so .sl .dylib ; do slibs="$slibs $i$ext" done done if test ! "x$shared" = "xno" ; then libs="$slibs $libs" else libs="$libs $slibs" fi # Loop over the list of possible directories, and see if we can # find any of the library files as determind above. for i in $libdirs ; do # look first in the lib32 directories if test "x$checklib32" = "xyes" ; then i32=`echo $i | sed 's|lib*|lib32|'` i="$i32 $i" fi # look first in the lib64 directories if test "x$checklib64" = "xyes" ; then i64=`echo $i | sed 's|lib*|lib64|'` i="$i64 $i" fi for l in $i ; do for j in ${libs} ; do # 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 -f $n ; then found_dir=$l found_lib=$j break 4 fi done done done done echo $found_dir unset libs unset slibs unset libdirs if test "x$found_dir" = "xno" || test "$found_lib" = "xno" ; then found_dir="" found_lib="" else flib="" 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 fi done done if test "x$found_lib" = "x$flib" ; then found_lib=${found_dir}/${found_lib} found_dir="" else found_lib=`echo $found_lib | sed 's|^lib\(.*\)\..*|-l\1|'` found_dir=-L${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 found_dir="" fi fi fi unset shared unset lib unset flib unset libdirl } #_____________________________________________________________________ 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. for i in $hdrdirs; do for j in ${hdrs} ; do # 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 found_dir=$i found_hdr=$j break 2 fi done done echo $found_dir if test "x$found_hdr" = "xno" || test "$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 unset hdrs unset hdrdirs unset hdrdir } #_____________________________________________________________________ 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//'` fi # Check if we got a specific argument as to where the library # is to be found symbolfile=$symbollib 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 usrlib="/usr/lib/hpux64" fi for d in "$symboldir" $usrlib ; do if test ! -r $d/$symbollib ; then for i in $exts ; do if test -r $d/$symbollib$i ; then symbolfile=$d/$symbollib$i break 2 fi done else symbolfile=$d/$symbollib break fi done if test "x$symbolfile" = "x" || test ! -r $symbolfile ; then found_symbol=0 echo " Symbol not found" return 1 fi checking_msg "$symbol in $symbolfile" nm $symbolfile 2>&1 | grep $symbol > /dev/null 2>&1 if test $? -eq 0 ; then found_symbol=1 else nm $symbolfile 2>&1 | grep "no symbols" > /dev/null 2>&1 if test $? -eq 0 ; then # 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 testfile="config/test/test-symbol.cc" if test -f $testfile ; then rm -f $testfile fi cat << EOF > $testfile extern int $symbol (); int main() { $symbol (); return 0; } EOF check_prototype "symbol" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then found_symbol=1 else found_symbol=0 fi rm -f $testfile else found_symbol=0 fi fi if test $found_symbol -eq 1 ; then echo "yes" else echo "no" fi } #_____________________________________________________________________ check_prototype() { # This function will try to compile a small test program containing # the function [$1]; the test program path is config/test/test-[$1].cc . # The compiler used is [$2]; (optional) compilation flags can be # passed as [$3]. # If the compliation is successful the variable 'found_prototype' is # set to 'yes'. The variable 'compile_log' can be used to control the # location of the compilation output: if set to a path, the log is # added to the file, otherwise the log is set to /tmp/[$1]-test.log . # The compilation output is deleted in case of success. # Reset the result found_prototype="" # Assert that we got enough arguments if test $# -lt 2 ; then echo "check_prototype: Too few arguments" return 1 fi # Make sure that the test program exists testfile="config/test/test-$1.cc" if test ! -f $testfile ; then echo "check_prototype: no test program for $1" return 1 fi testtmp="test-comp" testcc="/tmp/$testtmp.cc" rm -f "$testcc" cp -rp $testfile "$testcc" # Make sure that the compiler exists xcc=`which $2 2> /dev/null` if test "x$xcc" = "x" ; then echo "check_prototype: compiler $2 not found" return 1 fi # The outfiles outfile="/tmp/test-$1.log" outfiletmp="$outfile.tmp" # Compilation test $2 $3 $testcc > $outfiletmp 2>&1 rm -f $testcc $testtmp.* # Check the result found_prototype="yes" rc=`grep $1 $outfiletmp` if test ! "x$rc" = "x" ; then found_prototype="" if test "x$compile_log" = "x" ; then mv $outfiletmp $outfile compile_log="$outfile" else cat $outfiletmp >> $compile_log fi else rm -fr $outfiletmp fi } #_____________________________________________________________________ guess_architecture () { # 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. type=`uname -s` osys=`uname -s | tr '[A-Z]' '[a-z]'` chip=`uname -m | tr '[A-Z]' '[a-z]'` rele=`uname -r` arch="$osys" ccflv="gcc" echo "Guessing architecture/compiler: "$osys:$chip:$rele case "$osys:$chip:$rele" in aix:*:5*) arch=rs_aix5 ; platform=aix; ccflv=xlC;; osf1*:alpha:*) arch=alphacxx6 ; platform=alpha; ccflv=cxx;; freebsd*:*:7*) arch=FreeBSD7 ; platform=fbsd; ccflv=fbsd;; freebsd*:*:5*) arch=FreeBSD5 ; platform=fbsd; ccflv=gcc;; freebsd*:*:4.2*) arch=FreeBSD42 ; platform=fbsd; ccflv=gcc;; freebsd*:*:4.3*) arch=FreeBSD43 ; platform=fbsd; ccflv=gcc;; freebsd*:*:4.4*) arch=FreeBSD44 ; platform=fbsd; ccflv=gcc;; freebsd*:*:4*) arch=FreeBSD4 ; platform=fbsd; ccflv=gcc;; freebsd*:*:*) arch=FreeBSD ; platform=fbsd; ccflv=gcc;; hp-ux:ia64:*) arch=hpuxia64 ; platform=hpux; ccflv=aCC;; hurd*:*:*) arch=hurddeb ; platform=linux; ccflv=gcc;; linux:athlon:*) arch=i386_linux ; platform=linux; ccflv=gcc;; linux:ia64:2.2*) arch=ia64_linux22 ; platform=linux; ccflv=gcc;; linux:ia64:2.4*) arch=ia64_linux24 ; platform=linux; ccflv=gcc;; linux:ia64:2.6*) arch=ia64_linux26 ; platform=linux; ccflv=gcc;; linux:ia64:*) arch=ia64_linux ; platform=linux; ccflv=gcc;; linux:i*86:2.2*) arch=i386_linux22 ; platform=linux; ccflv=gcc;; linux:i*86:2.4*EL*) arch=i386_rhel30 ; platform=linux; ccflv=gcc;; linux:i*86:2.4*) arch=i386_linux24 ; platform=linux; ccflv=gcc;; linux:i*86:2.6*) arch=i386_linux26 ; platform=linux; ccflv=gcc;; linux:i*86:*) arch=i386_linux ; platform=linux; ccflv=gcc;; linux:u*:2.4*) arch=i386_linux ; platform=linux; ccflv=gcc;; linux:u*:2.6*) arch=i386_linux ; platform=linux; ccflv=gcc;; linux:x86_64:2.2*) arch=x86_64_linux_22 ; platform=linux; ccflv=gccx8664;; linux:x86_64:2.4*) arch=x86_64_linux_24 ; platform=linux; ccflv=gccx8664;; linux:x86_64:2.6*) arch=x86_64_linux_26 ; platform=linux; ccflv=gccx8664;; linux:x86_64:*) arch=x86_64_linux ; platform=linux; ccflv=gccx8664;; linux:alpha:*) arch=alpha_linux ; platform=linux; ccflv=gcc;; linux:arm*:*) arch=arm_linux ; platform=linux; ccflv=gcc;; linux:ppc64:*) arch=ppc_linux ; platform=linux; ccflv=gccppc64;; linux:ppc*:*) arch=ppc_linux ; platform=linux; ccflv=gcc;; linux:sparc*:*) arch=sparc_linux ; platform=linux; ccflv=gcc;; linux:mips*:*) arch=mips_linux ; platform=linux; ccflv=gcc;; linux:parisc*:*) arch=hppa_linux ; platform=linux; ccflv=gcc;; darwin:power*:7.4*) arch=macosx_74 ; platform=macosx; ccflv=macos;; darwin:power*:7*) arch=ppc_darwin_70 ; platform=macosx; ccflv=macos;; darwin:power*:*) arch=macosx ; platform=macosx; ccflv=macos;; darwin:*86*:*) arch=x86_macosx ; platform=macosx; ccflv=macos;; irix*:sgi*:*) arch=sgi ; platform=sgi; ccflv=sgiCC;; sunos:i86pc:*) arch=sunx86_510 ; platform=solaris; ccflv=sunCCamd;; sunos:i386:*) arch=sunx86_510 ; platform=solaris; ccflv=sunCC;; sunos:*:6*) arch=sun4x_6 ; platform=solaris; ccflv=sunCC;; sunos:*:5.6) arch=sun4x_56 ; platform=solaris; ccflv=sunCC;; sunos:*:5.7) arch=sun4x_57 ; platform=solaris; ccflv=sunCC;; sunos:*:5.8) arch=sun4x_58 ; platform=solaris; ccflv=sunCC;; sunos:*:5.9) arch=sun4x_59 ; platform=solaris; ccflv=sunCC;; sunos:*:5.10) arch=sun4x_510 ; platform=solaris; ccflv=sunCC;; sunos:*:5*) arch=sun4x_5 ; platform=solaris; ccflv=sunCC;; sunos:*:4*) arch=sun4x_4 ; platform=solaris; ccflv=sunCC;; *) echo "Attempts at guessing your architecture failed." echo "Please specify the architecture as the first argument." echo "Do '$0 --help' for a list of avaliable architectures." exit 1 ;; esac if [ "$platform" = "macosx" ]; then # the default for macosx is NOT to build xrdposix unless required enable_posix=no 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 ccflv=macos64 arch=${arch/macosx/64_macosx} fi fi fi echo "$osys | $chip | $rele | $arch | $ccflv" } ################################################################### # ### echo %%% Some skeleton and config files # ARCHS=config/ARCHS MAKEIN=config/GNUmakefile.in MAKEOUT=GNUmakefile ENVIN=config/GNUmake.env.in ENVOUT=src/GNUmake.env OPTIN=config/GNUmake.options.in OPTOUT=src/GNUmake.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 # confhelp() { sversion=`grep "define XrdVERSION" src/XrdVersion.hh` vers="" if test ! "x$sversion" = "x" ; then for i in $sversion ; do if test ! "x$i" = "x#define" && test ! "x$i" = "xXrdVERSION" ; then vers="version $i" fi done fi cat < instead of , e.g. with options, prefix with --with-, enables corresponding support afs AFS support, location of AFS distribution afs-incdir AFS support, location of afs/stds.h, afs/kautils.h afs-libdir AFS support, location of libafsauthent.a, libafsrpc.a afs-shared AFS support, controls usage of shared linkage AFS libraries {yes/no} java Path to the Java SDK to be used for the java interface krb4 KerberosIV support, location of Kerberos distribution krb4-incdir KerberosIV support, location of kerberosIV/krb.h krb4-libdir KerberosIV support, location of libkrb4 krb5 Kerberos5 support, location of Kerberos distribution krb5-incdir Kerberos5 support, location of krb5.h krb5-libdir Kerberos5 support, location of libkrb5 perl Path to the perl executable to be used for the perl module ssl OpenSSL support, location of openssl installation ssl-incdir OpenSSL support, location of openssl headers (has priority over ssl-dir) ssl-libdir OpenSSL support, location of libssl, libcrypto (has priority over ssl-dir) ssl-shared OpenSSL support, controls usage of shared linkage SSL libraries {yes/no} thread-libdir Path to libpthread with compiler options, prefix with --with-, overrides default value cxx alternative C++ compiler to be used ld alternative Linker to be used Advanced options: --no-arch-subdirs Do not use architecture dependent names for bin/lib paths --build-client-only Build only the client related stuff --build-sec-only Build only security modules --use-xrd-strlcpy Force use of the xrd implementation of strlcpy --has-getpbynr Do not check for getprotobyname_r --with-gethbynr=dir Do not check for gethostbyname_r, take prototype from 'dir'/netdb.h --with-nameinfo=dir Do not check for getnameinfo, take prototype from 'dir'/netdb.h --has-sigwaitinfo Do not check for sigwaitinfo --has-fstatat Do not check for fstatat --has-readline Do not check for readline Supported Architectures: Platform Default Support Description flavour EOF exec < config/ARCHS read line while [ ! "x$line" = "x" ] do set $line if test ! "x$3" = "xno" ; then echo " $line" fi read line done cat < EOF } ###################################################################### # ### echo %%% See if we got the architecture # if test $# -lt 1 ; then guess_architecture else case $1 in -h|--help) confhelp ; exit 0 ;; -*) # in case the first argument wasn't an architecure but an option guess_architecture ;; *) arch=$1 shift ;; esac fi ###################################################################### # ### echo %%% Command line arguments # hasprotor="" hasgethbyxr="" hasnameinfo="" hassigwti="" hasfstatat="" hasreadline="" afslibdir="" afsincdir="" afsshared="" ssldir="" ssllibdir="" sslincdir="" sslshared="" altcxx="" altld="" nccflv="$ccflv" if test $# -gt 0 ; then while test ! "x$1" = "x" ; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --help|-h) confhelp ; exit 0 ;; ################################################################ # # With options to specifiy third part software # --no-arch-subdirs) usearchdirs="no" ;; --build-client-only) clientonly="yes" ;; --build-sec-only) seconly="yes" ;; --ccflavour=*) nccflv=$optarg ;; --no-create) noact="yes" ;; --nohowto) nohowto="yes" ;; --use-xrd-strlcpy) strlcpy="local" ;; --has-getpbynr) hasprotor="yes" ;; --with-gethbynr=*) hasgethbyxr="$optarg" ;; --with-nameinfo=*) hasnameinfo="$optarg" ;; --has-sigwaitinfo) hassigwti="yes" ;; --has-fstatat) hasfstatat="yes" ;; --has-readline) hasreadline="yes" ;; --with-afs=*) afsdir=$optarg ; enable_afs="yes" ;; --with-afs-incdir=*) afsincdir=$optarg ; enable_afs="yes" ;; --with-afs-libdir=*) afslibdir=$optarg ; enable_afs="yes" ;; --with-afs-shared=*) afsshared=$optarg ; enable_afs="yes" ;; --with-java=*) javadir=$optarg ; enable_javaint="yes" ;; --with-krb4=*) krb4dir=$optarg ; enable_krb4="yes" ;; --with-krb4-incdir=*) krb4incdir=$optarg ; enable_krb4="yes" ;; --with-krb4-libdir=*) krb4libdir=$optarg ; enable_krb4="yes" ;; --with-krb5=*) krb5dir=$optarg ; enable_krb5="yes" ;; --with-krb5-incdir=*) krb5incdir=$optarg ; enable_krb5="yes" ;; --with-krb5-libdir=*) krb5libdir=$optarg ; enable_krb5="yes" ;; --with-perl=*) perlbin=$optarg ; enable_perlint="yes" ;; --with-ssl=*) ssldir=$optarg ; enable_ssl="yes" ;; --with-ssl-incdir=*) sslincdir=$optarg ; enable_ssl="yes" ;; --with-ssl-libdir=*) ssllibdir=$optarg ; enable_ssl="yes" ;; --with-ssl-shared=*) sslshared=$optarg ; enable_ssl="yes" ;; --with-thread-libdir=*) threadlibdir=$optarg ; enable_thread="yes" ;; --with-cxx=*) altcxx=$optarg ;; --with-ld=*) altld=$optarg ;; ################################################################ # # Enable/disable to turn on/off third party software linkage and # features # --enable-*) f=`echo $1 | sed -e 's/--//' -e 's/-/_/'` if test "x$f" = "xenable_sec" ; then enable_gsi=yes enable_krb4=yes enable_krb5=yes enable_pwd=yes enable_ssl=yes else eval $f=yes for c in $options ; do if test "x$c" = "x$f" ; then f="" fi done if test "x$f" != "x" ; then echo "Invalid option '$1'. Try $0 --help" ; exit 1 ; fi fi ;; --disable-*) f=`echo $1 | sed -e 's/--disable/enable/' -e 's/-/_/'` if test "x$f" = "xenable_sec" ; then enable_gsi=no enable_krb4=no enable_krb5=no enable_pwd=no enable_ssl=no else eval $f=no for c in $options ; do if test "x$c" = "x$f" ; then f="" fi done if test "x$f" != "x" ; then echo "Invalid option '$1'. Try $0 --help" ; exit 1 ; fi fi ;; ################################################################ # # Build steering option # --build=*) xrdbuild="$optarg" ;; *) echo "Invalid option '$1'. Try $0 --help" ; exit 1 ;; esac shift done fi ##################################################################### # # Re-tune some flags # if test "$arch" = "linuxegcs" ; then arch="linux" fi if test "x$platform" = "xsolaris"; then if test "x$nccflv" = "xgcc" ; then nccflv="sungcc" else # CC: starting from version 5.5 the template cache is not used CC -V 2> ccout.tmp ccstring=`cat ccout.tmp` ccver="" for i in $ccstring; do case "$i" in 5.*) ccver="$i" ;; esac done if test ! "x$ccver" = "x"; then ccsub=`echo $ccver | sed -e 's/5.//'` fi if test $ccsub -gt 4; then suncache="" fi rm -f ccout.tmp fi fi if test "x$platform" = "xlinux" && test "x$chip" = "xx86_64" ; then if test "x$nccflv" = "xicc" ; then nccflv="iccx8664" fi fi if test "x$platform" = "xlinux" && test "x$chip" = "xia64" ; then if test "x$nccflv" = "xgcc" ; then nccflv="gccia64" fi fi macosx_target_setting="" if test "x$platform" = "xmacosx" ; then finkdir=`which fink 2>&1 | sed -ne "s/\/bin\/fink//p"` # Get minor version for the deployment target message "Checking for MACOSX_DEPLOYMENT_TARGET" macosx_major=`sw_vers -productVersion | cut -d . -f 1` macosx_minor=`sw_vers -productVersion | cut -d . -f 2` if [ "$macosx_major" -ge 10 ] && [ "$macosx_minor" -ge 3 ] ; then macosx_target_setting="export MACOSX_DEPLOYMENT_TARGET=$macosx_major.$macosx_minor; " echo "$macosx_major.$macosx_minor" else echo "$macosx_major.$macosx_minor: OS version not supported (must be >= 10.3). Sorry." exit 1 fi if test "x$nccflv" = "xicc" ; then nccflv="macosicc" fi fi # # Check alternatice compiler / linker # if test ! "x$altcxx" = "x" ; then altcxx="TYPECC = $altcxx" fi if test ! "x$altld" = "x" ; then altld="TYPELD = $altld" fi # # Check architecture support status # support="" exec < config/ARCHS read line while [ ! "x$line" = "x" ] do set $line if test "x$1" = "x$arch" && test "x$2" = "x$nccflv" ; then support="$3" fi read line done # goodarch="no" if test "x$support" = "x" ; then # No support echo "Invalid architecture. Try $0 --help" exit 1 else goodarch="yes" fi # if test "x$support" = "xno" ; then # Support foreseen but not yet available goodarch="no" echo "Architecture not yet supported. Try $0 --help" exit 1 fi # if test "x$support" = "xsec" ; then if test "x$seconly" = "xno" ; then # support is for client modules only echo "Architecture supported for client modules only." clientonly="yes" elif test "x$seconly" = "xyes" ; then # support is for security modules only echo "Architecture supported for security modules only." seconly="yes" fi fi # Notify configuration settings if test ! "x$nccflv" = "x$ccflv" ; then echo "Forcing compiler choice ..." ccflv="$nccflv" fi echo "Configuring for $arch and compiler $ccflv" # Grep out the real compiler program name ccbin="" if test -f config/GNUmake.rules.$ccflv ; then ll=`grep TYPECC config/GNUmake.rules.$ccflv` for i in $ll ; do ccbin=$i done else echo "No rules found for compiler tag $ccflv !" exit 1 fi if test "x$ccbin" = "x" ; then echo "No binary found for compiler tag $ccflv !" exit 1 fi # For gcc on opteron force checking for 64-bit libs if test "x$ccflv" = "xgccx8664" || test "x$ccflv" = "xgccppc64" ; then checklib64="yes" fi # Check if rtrace option has been required tracedbg="-DNODEBUG" if test "x$enable_trace" = "xyes" ; then tracedbg="" else echo "Support for trace statements disabled" fi # Check if it is required to use old header format hasoldhdrs="" if test "x$enable_oldhdrs" = "xyes" ; then hasoldhdrs="-DHAVE_OLD_HDRS" echo "Using old format (.h) for standard headers" else echo "Using new format () for standard headers" fi # Which targets to build targets="\$(XRDSEC) \$(SERVER) \$(XRDCLIENT) " if test "x$clientonly" = "xyes" ; then echo "Building only client ..." targets="\$(XRDSEC) \$(XRDCLIENT)" fi if test "x$seconly" = "xyes" ; then echo "Building only security modules..." targets="\$(XRDSEC)" fi if test "x$enable_mon" = "xyes" ; then echo "Building monitor module ..." targets="$targets \$(XRDMON)" fi if test "x$enable_posix" = "xyes" ; then echo "Building posix module and related ones..." targets="$targets \$(XRDPOSIX)" fi ###################################################################### # ### echo %%% Check for compiler special options: # - need of '-Wno-strict-aliasing' # checkgccopt="no" case "$ccflv" in gcc*) checkgccopt="yes" ;; esac nostrictalias="" if test "x$checkgccopt" = "xyes" ; then message "Checking for gcc special options" if [ `gcc -dumpversion 2>&1 | cut -d'.' -f1` -ge 4 ] ; then nostrictalias="-Wno-strict-aliasing" echo "yes, $nostrictalias" else echo "no" fi fi ###################################################################### # ### echo %%% Check for strlcpy # hasstrlcpy="" if test ! "x$strlcpy" = "xlocal"; then message "Checking for strlcpy" check_prototype "strlcpy" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hasstrlcpy=" -DHAVE_STRLCPY" else echo "no, using built-in implementation" fi else echo "Using xrd implementation of strlcpy" fi ###################################################################### # ### echo %%% Check for getprotobyname_r # if test "x$hasprotor" = "x"; then message "Checking for getprotobyname_r" check_prototype "getprotobyname_r" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hasprotor=" -DHAVE_PROTOR" else echo "no, using getprotobyname" fi else hasprotor=" -DHAVE_PROTOR" fi ###################################################################### # ### echo %%% Check for gethostbyaddr_r # if test "x$hasgethbyxr" = "x"; then message "Checking for gethostbyaddr_r" check_prototype "gethostbyaddr_r" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hasgethbyxr=" -DHAVE_GETHBYXR" else nitmp=`find /usr/include -name netdb.h` for i in $nitmp ; do incdir=`dirname $i` check_prototype "gethostbyaddr_r" $ccbin "-c -I$incdir" if test "x$found_prototype" = "xyes" ; then echo "yes, $i" hasgethbyxr=" -DHAVE_GETHBYXR -I$incdir" break fi done if test "x$hasgethbyxr" = "x"; then echo "no, using gethostbyaddr" fi fi else if test ! "x$hasgethbyxr" = "x/usr/include"; then hasgethbyxr=" -DHAVE_GETHBYXR -I$hasgethbyxr" else hasgethbyxr=" -DHAVE_GETHBYXR" fi fi ###################################################################### # ### echo %%% Check for getnameinfo # if test "x$hasnameinfo" = "x"; then message "Checking for getnameinfo" check_prototype "getnameinfo" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hasnameinfo=" -DHAVE_NAMEINFO" else nitmp=`find /usr/include -name netdb.h` for i in $nitmp ; do incdir=`dirname $i` check_prototype "getnameinfo" $ccbin "-c -I$incdir" if test "x$found_prototype" = "xyes" ; then echo "yes, $i" hasnameinfo=" -DHAVE_NAMEINFO -I$incdir" break fi done if test "x$hasnameinfo" = "x"; then echo "no, using gethostbyname/gethostbyaddr family" fi fi else if test ! "x$hasnameinfo" = "x/usr/include"; then hasnameinfo=" -DHAVE_NAMEINFO -I$hasnameinfo" else hasnameinfo=" -DHAVE_NAMEINFO" fi fi ###################################################################### # ### echo %%% Check for sigwaitinfo # if test "x$hassigwti" = "x"; then message "Checking for sigwaitinfo" check_prototype "sigwaitinfo" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hassigwti=" -DHAVE_SIGWTI" else echo "no, using built-in implementation" fi else hassigwti=" -DHAVE_SIGWTI" fi ###################################################################### # ### echo %%% check for setresuid and setresgid # hassetresuid="" case $platform in linux) message "Checking for setresuid" compile_log="" check_prototype "setresuid" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hassetresuid="-DHAVE_SETRESUID" else echo "no, using built-in implementation" fi ;; esac ###################################################################### # ### echo %%% Check for libz # haslibz="" message "Checking for zlib.h" if test -f /usr/include/zlib.h ; then echo "yes" haslibz="-DHAVE_LIBZ" libz="-lz" else echo "no" fi zlibdirs="/usr/local/lib /opt/lib $finkdir/lib" if test "x$haslibz" != "x"; then check_library "libz" "$enable_shared" "/usr/lib" "$zlibdirs" if test "x$found_lib" = "x" ; then haslibz="" libz="" fi fi ###################################################################### # ### echo %%% Check for fstatat # if test "x$hasfstatat" = "x"; then message "Checking for fstatat" check_prototype "fstatat" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hasfstatat=" -DHAVE_FSTATAT" else echo "no" fi else hasfstatat=" -DHAVE_FSTATAT" fi ###################################################################### # ### echo %%% Check for readline # if test "x$hasreadline" = "x"; then message "Checking for readline" check_prototype "readline" $ccbin "-c" if test "x$found_prototype" = "xyes" ; then echo "yes" hasreadline=" -DHAVE_READLINE" else echo "no" fi else hasreadline=" -DHAVE_READLINE" fi if test ! "x$hasreadline" = "x"; then if test "x$syslibs" = "x" ; then what2look4="/usr/lib /usr/local/lib /opt/lib $finkdir/lib" else what2look4="$syslibs" fi check_library "libreadline" "$enable_shared" "" $what2look4 if test "x$found_lib" = "x" ; then hasreadline="" libreadline="" else libreadline="$found_dir $found_lib" fi check_library "libncurses" "$enable_shared" "" $what2look4 if test "x$found_lib" = "x" ; then check_library "libcurses" "$enable_shared" "" $what2look4 if test "x$found_lib" = "x" ; then hasreadline="" libreadline="" else libreadline="$libreadline $found_dir $found_lib" fi else libreadline="$libreadline $found_dir $found_lib" fi fi ###################################################################### # ### echo %%% Flag for /dev/poll # hasdevpoll="" message "Checking for /dev/poll support" if test -f /usr/include/sys/devpoll.h -a -c /dev/poll ; then echo "yes" hasdevpoll="-D_DEVPOLL" else echo "no" fi ###################################################################### # ### echo %%% Flag for epoll # hasepoll="" message "Checking for epoll support" if test -f /usr/include/sys/epoll.h ; then eprel=`uname -r | cut -d '.' -f 1-2 | tr '.' '0'` if [ $eprel -gt 205 ]; then echo "yes" hasepoll="-D_EPOLL" else echo "not really" fi else echo "no" fi ###################################################################### # ### echo %%% Flag for sendfile # hassendfile="" message "Checking for sendfile support" if test -f /usr/include/sys/sendfile.h ; then echo "yes" hassendfile="-DHAVE_SENDFILE" else echo "no" fi ###################################################################### # ### echo %%% Flags steering echoing of command lines # xrdecho="@" if test "x$enable_echo" = "xyes" ; then xrdecho="" fi ###################################################################### # ### echo %%% Check PERL stuff # if test "x$enable_perlint" = "xyes" ; then message "Checking for perl" if test "x$perlbin" = "x" || test ! -f $perlbin ; then perlbin=`which perl 2> /dev/null` if test "x$perlbin" = "x" ; then enable_perlint="no" echo "no" else echo "yes" fi else echo "yes" fi fi if test "x$enable_perlint" = "xyes" ; then # Check version message "Checking for perl version" # Get major number perl_major=`$perlbin -v | grep "This is perl, " \ | sed -n "s/This is perl, v//p" | cut -d . -f 1` # Get minor number perl_minor=`$perlbin -v | grep "This is perl, " \ | sed -n "s/This is perl, v//p" | cut -d . -f 2` # require perl versions >= 5.8 if [ "$perl_major" -lt 5 ] || [ "$perl_minor" -lt 8 ] ; then echo "$perl_major.$perl_minor: not OK (needs >= 5.8: re-run with --with-perl=)" enable_perlint="no" perlbin="" else echo "$perl_major.$perl_minor: OK" fi fi if test "x$enable_perlint" = "xyes" ; then # Search the location of include files needed inclist="perl.h EXTERN.h XSUB.h" perlincdir="" perlincdirlist=`$perlbin -e 'print "@INC";'` perlincdirs="" for i in $perlincdirlist ; do perlincdirs="$perlincdirs $i $i/CORE" done for i in $inclist ; do check_header "$i" "" "$perlincdirs" if test "x$found_hdr" = "x" ; then perlincdir="" enable_perlint="no" break fi if test "x$perlincdir" = "x" ; then perlincdir="-I$found_dir" else have_already="no" for k in $perlincdir ; do if test "x$k" = "x-I$found_dir" ; then have_already="yes" fi done if test "x$have_already" = "xno" ; then perlincdir="-I$found_dir $perlincdir" fi fi done # The compilation flags perlccflags="" if test "x$enable_perlint" = "xyes" ; then perlccflags=`$perlbin -e 'use Config; print $Config{ccflags};'` fi fi ###################################################################### # ### echo %%% Check JAVA stuff into javacbin, javadir, javainc # if test "x$enable_javaint" = "xyes" ; then message "Checking for javac" if test "x$javadir" = "x" || test ! -f $javadir ; then javacbin=`which javac` if test "x$javacbin" = "x" ; then enable_javaint="no" echo "no" else echo "yes ... $javacbin" fi else javacbin="$javadir/bin/javac" echo "yes ... using given $javacbin" fi fi if test "x$enable_javaint" = "xyes" ; then # Check version message "Checking for java version" # Get major number $javacbin -version 2> /tmp/java_msg.tmp java_major=`cat /tmp/java_msg.tmp | grep "javac 1" \ | sed -n "s/javac //p" | cut -d . -f 2` rm -f /tmp/java_msg.tmp if test "x$java_major" = "x" ; then java_major="5" echo "Unable to determine the version of the local Java JDK. (needs >= 1.5: re-run with --with-java=). Continuing anyway. Good luck." fi # require java versions >= 1.5 if [ "$java_major" -lt 5 ] ; then echo "1.$java_major: not OK (needs >= 1.5: re-run with --with-java=)" enable_javaint="no" javadir="" else echo "1.$java_major: OK" if test "x$javadir" = "x" ; then echo "Trying to guess the java SDK location..." javadir=`echo $javacbin | rev | cut -d / -f 3- | rev` javadir="$javadir/" echo "The java SDK has been guessed to be $javadir" else echo "The java SDK is supposed to be $javadir" fi fi fi if test "x$enable_javaint" = "xyes" ; then # Check for the presence of include files needed inclist="jni.h" javainc="$javadir/include/" if test -f "$javainc/jni.h"; then echo "Found java includes in $javainc" else echo "Unable to find java includes in $javainc" javainc="" enable_javaint="no" fi fi ###################################################################### # ### echo %%% Copy skeletons to temporary files # if test "x$noact" = "xno"; then cp -f $MAKEIN GNUmakefile.tmp cp -f $ENVIN GNUmake.env.tmp cp -f $OPTIN GNUmake.options.tmp fi ###################################################################### # ### echo %%% Check type of build # dbgsfx="" dbgopt="" dbgflg="0" dbgmsg="" buildopt="TYPEOPT" if test "x$xrdbuild" = "xdebug"; then dbgsfx="_dbg" dbgopt="DBGSFX=_dbg" dbgflg="1" dbgmsg="debug" buildopt="TYPEDBG" fi ###################################################################### # ### echo %%% Check if architecure dependent names for bin, lib, obj ### echo %%% have to be used # archdir="/$arch$dbgsfx" if test "x$usearchdirs" = "xno" ; then archdir="" fi ###################################################################### # ### echo %%% Locate standard commands # message "Checking for rm" rmpath="/bin/rm" if test ! -x $rmpath ; then locrm=`which rm 2> /dev/null` if test ! "x$locrm" = "x" ; then rmpath="$locrm" echo "$rmpath" else echo "no: assume $rmpath" fi else echo "$rmpath" fi message "Checking for ln" lnpath="/bin/ln" if test ! -x $lnpath ; then locln=`which ln 2> /dev/null` if test ! "x$locln" = "x" ; then lnpath="$locln" echo "$lnpath" else echo "no: assume $lnpath" fi else echo "$lnpath" fi ###################################################################### # ### echo %%% Should sonames contain version numbers # if test "x$enable_soversion" = "xyes"; then major=`sed 's|\(.*\)\..*/.*|\1|' < build/version_number` minor=`sed 's|.*\.\(.*\)/.*|\1|' < build/version_number` revis=`sed 's|.*\..*/\(.*\)|\1|' < build/version_number` mkliboption="-v $major $minor $revis " unset major unset minor unset revis fi ###################################################################### # ### echo %%% Posix Thread Library # # Check for posix thread library # case $platform in macosx) if test "x$enable_thread" = "x"; then enable_thread="yes" fi ;; linux|fbsd) if test "x$enable_thread" = "x"; then enable_thread="yes" threadlib="-pthread" threadlibdir= fi ;; esac if test "x$enable_thread" = "xyes" && \ test "x$threadlib" = "x" ; then check_library "libpthread" "$enable_shared" "$threadlibdir" \ $THREAD $THREAD/lib /usr/lib /usr/local/lib /usr/lib/X11 \ /usr/local/lib/X11 /usr/X11R6/lib /usr/local/X11R6/lib \ /usr/X11/lib /usr/shlib threadlib=$found_lib threadlibdir=$found_dir if test "x$threadlib" = "x" ; then enable_thread="no" fi fi ###################################################################### # ### Security plugins buildsec="no" xrdcrypto="" xrdsut="" ###################################################################### # ### echo %%% krb4 Support - Third party libraries # # # Check for krb4 (libkrb4.a) # krb4extracflags="" havekrb4="" if test ! "x$enable_krb4" = "xno" ; then enable_krb4="yes" if test "x$KRB4DIR" = "x" && test ! "x$KRB5DIR" = "x" ; then KRB4DIR=$KRB5DIR fi if test "x$krb4dir" = "x" && test ! "x$KRB4DIR" = "x" ; then krb4dir=$KRB4DIR fi if test "x$krb4incdir" = "x" && test ! "x$krb4dir" = "x" ; then krb4incdir=$krb4dir/include fi # We need the domain name domain="" if test "x$platform" = "xlinux" ; then domain=`dnsdomainname 2> /dev/null` fi if test "x$domain" = "x" ; then domain=`domainname 2> /dev/null` fi case $domain in *.stanford.edu) slackrbinc="/afs/slac.stanford.edu/package/krb5/include" slackrblib="/afs/slac.stanford.edu/package/krb5/lib" ;; *) slackrbinc="" slackrblib="" ;; esac check_header "kerberosIV/krb.h" "$krb4incdir" \ "$slackrbinc" /usr/kerberos/include \ /usr/krb5/include /usr/local/kerberos/include \ /usr/include /usr/local/include if test "x$found_dir" = "x" ; then enable_krb4=no else krb4inc=$found_hdr krb4incdir=$found_dir fi krb4libdirorg="" if test ! "x$krb4libdir" = "x" ; then krb4libdirorg=$krb4libdir fi if test "x$krb4libdir" = "x" && test ! "x$krb4dir" = "x" ; then krb4libdirorg=$krb4dir/lib fi krb4libdirs="$slackrblib /usr/kerberos/lib \ /usr/krb4/lib /usr/local/kerberos/lib /usr/lib /usr/local/lib" # check whether using MIT krb5 krb4mit=no krb4lib="" krb4libdir="" check_library libk5crypto "$enable_shared" "$krb4libdirorg" $krb4libdirs if test ! "x$found_lib" = "x" ; then krb5mit=yes fi message "Checking whether we're using MIT Kerberos" echo "$krb5mit" check_library libkrb5 "$enable_shared" "$krb4libdirorg" $krb4libdirs if test "x$found_lib" = "x" ; then enable_krb4=no else # The order is important here if test "x$krb5mit" = "xyes" ; then tmplibs="libkrb4 libkrb5 libdes425 libk5crypto" for i in $tmplibs ; do check_library $i "$enable_shared" "$krb4libdirorg" $krb4libdirs if test "x$found_lib" = "x" ; then enable_krb4=no else krb4lib="$krb4lib $found_lib" if test "x$krb4libdir" = "x" ; then krb4libdir="$found_dir" else have_already=no for j in $krb4libdir ; do if test "x$found_dir" = "x$j" ; then have_already=yes fi done if test "x$have_already" = "xno" ; then have_already=yes krb4libdir="$krb4libdir $found_dir" fi fi fi done elif test "x$cryptolib" = "x" ; then check_library "libcrypto" "$enable_shared" "$krb4libdirorg" \ $krb4libdirs cryptolib=$found_lib cryptolibdir=$found_dir if test -r "$cryptolib" && test "x$enable_shared" = "xno" ; then case $platform in linux) cryptolib="$cryptolib -ldl" esac fi if test "x$cryptolib" = "x" ; then enable_krb4=no fi fi fi if test ! "x$enable_krb4" = "xyes" ; then krb4incdir="" krb4lib="" krb4libdir="" else krb4extracflags="-DR__KRB4" havekrb4="XrdSeckrb4" buildsec="yes" fi fi ###################################################################### # ### echo %%% krb5 Support - Third party libraries # # # Check for krb5 (libkrb5.a) # krb5extracflags="" havekrb5="" if test ! "x$enable_krb5" = "xno" ; then enable_krb5="yes" if test "x$krb5dir" = "x" && test ! "x$KRB5DIR" = "x" ; then krb5dir=$KRB5DIR fi if test "x$krb5incdir" = "x" && test ! "x$krb5dir" = "x" ; then krb5incdir=$krb5dir/include fi # We need the domain name domain="" if test "x$platform" = "xlinux" ; then domain=`dnsdomainname 2> /dev/null` fi if test "x$domain" = "x" ; then domain=`domainname 2> /dev/null` fi case $domain in *.stanford.edu) slackrbinc="/afs/slac.stanford.edu/package/krb5/include" slackrblib="/afs/slac.stanford.edu/package/krb5/lib" ;; *) slackrbinc="" slackrblib="" ;; esac check_header "krb5.h" "$krb5incdir" \ "$slackrbinc" /usr/kerberos/include \ /usr/krb5/include /usr/local/kerberos/include \ /usr/include/et /usr/include /usr/local/include if test "x$found_dir" = "x" ; then enable_krb5=no else krb5inc=$found_hdr krb5incdir="$found_dir" fi krb5libdirorg="" if test ! "x$krb5libdir" = "x" ; then krb5libdirorg=$krb5libdir fi if test "x$krb5libdir" = "x" && test ! "x$krb5dir" = "x" ; then krb5libdirorg=$krb5dir/lib fi krb5libdirs="$slackrblib /usr/kerberos/lib \ /usr/krb5/lib /usr/local/kerberos/lib /usr/lib /usr/local/lib" # check whether using MIT krb5 krb5mit=no krb5lib="" krb5libdir="" check_library libk5crypto "$enable_shared" "$krb5libdirorg" $krb5libdirs if test ! "x$found_lib" = "x" ; then krb5mit=yes krb5lib=$found_lib krb5libdir=$found_dir fi message "Checking whether we're using MIT Kerberos" echo "$krb5mit" check_library libkrb5 "$enable_shared" "$krb5libdirorg" $krb5libdirs if test "x$found_lib" = "x" ; then enable_krb5=no else # The order is important here krb5lib="$found_lib $krb5lib" if test "x$krb5libdir" = "x" ; then krb5libdir="$found_dir" else have_already=no for j in $krb5libdir ; do if test "x$found_dir" = "x$j" ; then have_already=yes fi done if test "x$have_already" = "xno" ; then have_already=yes krb5libdir="$krb5libdir $found_dir" fi fi if test "x$krb5mit" = "xyes" ; then : elif test "x$cryptolib" = "x" ; then check_library "libcrypto" "$enable_shared" "$krb5libdirorg" \ $krb5libdirs cryptolib=$found_lib cryptolibdir=$found_dir if test -r "$cryptolib" && test "x$enable_shared" = "xno" ; then case $platform in linux) cryptolib="$cryptolib -ldl" esac fi if test "x$cryptolib" = "x" ; then enable_krb5=no fi fi fi if test ! "x$enable_krb5" = "xyes" ; then krb5incdir="" krb5lib="" krb5libdir="" else krb5extracflags="-DR__KRB5" havekrb5="XrdSeckrb5" buildsec="yes" fi fi ###################################################################### # ### echo %%% Support for password-based authentication # # pwdextracflags="" havepwd="" if test ! "x$enable_pwd" = "xno" ; then # message "Enabling password-based authentication module" # buildsec="yes" # plug-in name havepwd="XrdSecpwd" # Security utils needed xrdsut="XrdSut" # Cryptography needed xrdcrypto="XrdCrypto" # Enable OpenSSL, if not explicitely disabled if test ! "x$enable_ssl" = "xno" ; then enable_ssl="yes" fi # echo "done" # # shadow passwords checking_msg "shadow passwords" # Here, we allow the option to support shadow passwords. If one # builds in a chroot jail, the file `/etc/shadow' may not exist, # but shadow passwords may still be available. if test -f "/etc/shadow" || test x$enable_shadowpw = xyes; then enable_shadowpw="yes" pwdextracflags="-DR__SHADOWPW " echo "yes" else enable_shadowpw="no" echo "no" fi fi ###################################################################### # ### echo %%% Support for simple-shared-secret authentication # # havesss="" if test ! "x$enable_sss" = "xno" ; then # message "Enabling simple-shared-secret authentication module" # buildsec="yes" # plug-in name havesss="XrdSecsss" # Cryptography needed xrdcrypto="XrdCrypto" # Enable OpenSSL, if not explicitely disabled if test ! "x$enable_ssl" = "xno" ; then enable_ssl="yes" fi # echo "done" fi ###################################################################### # ### echo %%% AFS Support - Third party libraries # # (See http://www.openafs.org) # # Check for AFS # if test ! "x$enable_afs" = "xno" ; then if test ! "x$afsdir" = "x" ; then # Set the search paths, giving priority to explicit settings if test "x$afslibdir" = "x" ; then afslibdir="$afsdir/lib" fi if test "x$afsincdir" = "x" ; then afsincdir="$afsdir/include" fi if test "x$afsshared" = "x" ; then # With external libs, default is static afsshared="no" fi fi if test "x$afsshared" = "x" ; then # Use global default if none set afsshared=$enable_shared fi afslibdirs="/usr/lib /usr/local/lib /opt/lib $finkdir/lib" afslibs="libafsrpc libafsauthent" if test "x$afsshared" = "xyes" ; then # We try to use the shared version of the libraries; however, for OpenAFS # versions <= 1.4.6 these were inconsistent, some needed symbols not being # exported. We need to check the symbols first echo "Checking for shared AFS libs:" check_library libafsrpc "$afsshared" "$afslibdir" $afslibdirs if test "x$found_lib" = "x" ; then afslib="" afslibdir="" enable_afs="no" continue fi # # Check symbols # afssymbols="afs_add_to_error_table strcompose stolower ucstring lcstring AssertionFailed" for s in $afssymbols ; do check_symbol $s "$found_lib" "$found_dir" if test $found_symbol -eq 0 ; then echo "Checking for AFS symbols: '$s' not found" afsshared="no" break fi done # # Save lib, if OK if test "x$afsshared" = "xyes" ; then check_library libafsauthent "$afsshared" "$afslibdir" $afslibdirs if test ! "x$found_lib" = "x" ; then check_symbol ka_GetAFSTicket "$found_lib" "$found_dir" if test ! $found_symbol -eq 0 ; then afslib="$found_lib" afslibdir="$found_dir" afslibs="libafsauthent" else afslib="" afslibdirs="" afsshared="no" fi else afslib="" afslibdirs="" afsshared="no" fi fi fi dirlibafs="" if test "x$enable_afs" = "xyes" ; then # # Static libraries echo "Checking for static AFS libs:" # for i in $afslibs ; do check_library "$i" "$afsshared" "$afslibdir" $afslibdirs if test "x$found_lib" = "x" ; then afslib="" afslibdir="" enable_afs="no" break fi afslib="$found_lib $afslib" if test ! "x$found_dir" = "x" ; then if [ `dirname $found_lib` != $found_dir ] ; then dirlibafs="-L$found_dir $dirlibafs" fi fi done fi # # header files # if test "x$enable_afs" = "xyes" ; then incafs="stds.h kautils.h" for i in $incafs ; do check_header "afs/$i" "$afsincdir" \ /usr/include /usr/local/include /opt/include $finkdir/include if test "x$found_hdr" = "x" ; then afsincdir="" enable_afs="no" break fi done fi if test "x$enable_afs" = "xno" ; then afslib="" afslibdir="" afsincdir="" afsextracflags="" incafs="INCAFS = " libafs="LIBAFS = " else afsextracflags="-DR__AFS" if test ! "x$afsincdir" = "x" ; then incafs="INCAFS = -I$afsincdir" else incafs="INCAFS =" fi libafs="LIBAFS = $dirlibafs $afslib" # Warn about usage of static libs to build a shared object if test "x$afsshared" = "xno" ; then echo "### WARNING: AFS enabled using static libraries: this may lead to relocation-related" echo "### errors or warnings if the static libraries are not compiled with the correct options;" echo "### if this happens, please re-run with --with-afs-shared=yes or rebuild the AFS static" echo "### libs using the script at utils/installOpenAFS.sh." fi fi fi ###################################################################### # ### echo %%% Support for GSI authentication # # gsiextracflags="" havegsi="" if test ! "x$enable_gsi" = "xno" ; then # message "Enabling GSI authentication module" # buildsec="yes" # plug-in name havegsi="XrdSecgsi" # Security utils needed xrdsut="XrdSut" # Cryptography needed xrdcrypto="XrdCrypto" # Require OpenSSL if test ! "x$enable_ssl" = "xno" ; then enable_ssl="yes" echo "done" else # explicitely disabled: warn echo "no: GSI authentication requires OpenSSL" fi # fi ###################################################################### # ### echo %%% OpenSSL support - Third party libraries # # (See www.openssl.org) # ssllib="" sslextracflags="" if test "x$enable_ssl" = "xyes" ; then # # dirs: --with-ssl-incdir and --with-ssl-libdir have priority on --with-ssl-dir # in both cases we link statically unless --with-ssl-shared is 'yes' # if test ! "x$ssldir" = "x" ; then if test "x$sslincdir" = "x" ; then sslincdir=$ssldir/include fi if test "x$ssllibdir" = "x" ; then ssllibdir=$ssldir/lib fi if test "x$sslshared" = "x" ; then sslshared=no fi else if test ! "x$ssllibdir" = "x" ; then if test "x$sslshared" = "x" ; then sslshared=no fi fi fi if test "x$sslshared" = "x" ; then sslshared="$enable_shared" fi # # Version # check_header "openssl/opensslv.h" "$sslincdir" $SSL $SSL/include \ /usr/include /usr/local/include /opt/include $finkdir/include if test "x$found_hdr" = "x" ; then sslincdir="" enable_ssl="no" break fi sslincdir=$found_dir fullincdir=$found_dir verh=$sslincdir/openssl/opensslv.h if test "x$sslincdir" = "xinclude" ; then verh=/usr/include/openssl/opensslv.h fullincdir=/usr/include fi # Get version if test "x$enable_ssl" = "xyes" ; then sslver=`grep OPENSSL_VERSION_NUMBER $verh` if test $? -eq 0 ; then set $sslver sslver=$3 else sslver=unknown fi else sslver=unknown fi # At leat 0.9.6 decref="0090600" decref97="0090700" decref98="0090800" if [ $sslver = 'unknown' ] ; then decver=0 else tmpver=`echo $sslver | cut -c3-8` decver=`expr 10 \* 0"$tmpver"` fi echo "OpenSSL version: $sslver ($decver)" message "Checking for openssl version" openssl96="no" openssl98="no" if [ $decver -lt $decref ] ; then echo "no: minimal version required is 0.9.6" ssl_incdir="" enable_ssl="no" break else if [ $decver -ge $decref98 ] ; then openssl98="yes" elif [ $decver -lt $decref97 ] ; then openssl96="yes" fi echo "ok" fi # # libraries # check_library "libssl" "$sslshared" "$ssllibdir" \ $SSL $SSL/lib /lib /usr/lib /usr/local/lib /opt/lib $finkdir/lib if test "x$found_lib" = "x" ; then ssllib="" ssllibdir="" enable_ssl="no" else ssllib="$found_lib" ssllibdir="$found_dir" fi if test ! "x$enable_ssl" = "xno" ; then if test ! "x$found_lib" = "x-lssl" ; then tmpssllibdir="$ssllibdir" if test "x$tmpssllibdir" = "x" ; then tmpssllibdir=`dirname $found_lib` fi ssllibdir="" if test ! "x$sslshared" = "xno" ; then sslshared=no fi else ssllibdir="$found_dir" tmpssllibdir=`echo $ssllibdir | cut -c3-` fi # All libraries in the same directory check_library "libcrypto" "$sslshared" "$tmpssllibdir" /usr/lib if test "x$found_lib" = "x" ; then ssllib="" ssllibdir="" enable_ssl="no" else ssllib="$ssllib $found_lib" ssllibdir="$found_dir" fi fi if test "x$sslshared" = "xno" ; then echo "Using OpenSSL static libraries" fi # # header files # if test "x$enable_ssl" = "xyes" ; then incssl="asn1.h asn1_mac.h bio.h dh.h evp.h err.h pem.h \ rand.h rsa.h ssl.h x509.h x509v3.h" for i in $incssl ; do check_header "openssl/$i" "" "$fullincdir" if test "x$found_hdr" = "x" ; then sslincdir="" enable_ssl="no" break fi done fi if test "x$enable_ssl" = "xno" ; then ssllib="" ssllibdir="" sslincdir="" sslextracflags="" incssl="INCSSL = " libssl="LIBSSL = " # GSI needs OpenSSL echo "Disabling GSI ... (requires OpenSSL)" havegsi="" if test "x$havepwd" = "x" ; then xrdsut="" xrdcrypto="" fi else sslextracflags="-DR__SSL" if test "x$openssl98" = "xyes" ; then sslextracflags="$sslextracflags -DR__SSL_GE_098" elif test "x$openssl96" = "xyes" ; then sslextracflags="$sslextracflags -DR__SSL_096" fi incssl="INCSSL = -I$sslincdir" libssl="LIBSSL = $ssllibdir $ssllib" xrdsut="XrdSut" xrdcrypto="XrdCrypto" fi fi ###################################################################### # ### Collect security setup xrdsec="XrdSec $xrdsut $xrdcrypto" if test "x$buildsec" = "xyes" ; then xrdsec="$xrdsec $havekrb4 $havekrb5 $havepwd $havesss $havegsi XrdSecunix" fi cryptlib="CRYPTLIB = -lcrypt" if test "x$platform" = "xmacosx" ; then cryptlib="" fi if test "x$arch" = "xsunx86_510" ; then cryptlib="CRYPTLIB = -lcryptoutil" fi ###################################################################### # ### echo %%% Communication of errors library # # This library is needed by both AFS and Kerberos support, so to # avoid duplicate linkage, this is done here. # if test "x$enable_krb5" = "xyes" ; then comerrincdir="/usr/include/et" if test ! "x$krb5incdir" = "x" ; then if test ! "x$comerrincdir" = "x" ; then comerrincdir="$krb5incdir $comerrincdir" else comerrincdir=$krb5incdir fi fi check_header "com_err.h" "$comerrincdir" \ "$slackrbinc" /usr/kerberos/include \ /usr/krb5/include /usr/local/kerberos/include \ /usr/include /usr/local/include ceincdir="." if test ! "x$found_dir" = "x" ; then ceincdir=$found_dir fi if test ! "x$krb5libdirorg" = "x" ; then if test ! "x$comerrlibdir" = "x" ; then comerrlibdir="$comerrlibdir $krb5libdirorg" else comerrlibdir=$krb5libdirorg fi fi check_library libcom_err "$enable_shared" "$comerrlibdir" \ "$afslibdirs $krb5libdirs" inckrb4="INCKRB4 = " libkrb4="LIBKRB4 = " inckrb5="INCKRB5 = " libkrb5="LIBKRB5 = " if test "x$found_lib" = "x" ; then enable_krb4=no enable_krb5=no krb5incdir="" krb5lib="" krb5libdir="" krb5extracflags="" enable_afs=no afslib="" comerrlib="" comerrlibdir="" else comerrlib=$found_lib comerrlibdir=$found_dir if test "x$enable_krb4" = "xyes" ; then # Add header dir, if necessary have_already=no for j in $krb4incdir ; do if test "x$ceincdir" = "x$j" ; then have_already=yes fi done if test "x$have_already" = "xno" ; then inckrb4="INCKRB4 = -I$krb4incdir -I$ceincdir" else inckrb4="INCKRB4 = -I$krb4incdir" fi # Add lib (and lib dir, if necessary) have_already=no for j in $krb4libdir ; do if test "x$comerrlibdir" = "x$j" ; then have_already=yes fi done if test "x$have_already" = "xno" ; then libkrb4="LIBKRB4 = $krb4libdir $krb4lib $comerrlibdir $comerrlib" else libkrb4="LIBKRB4 = $krb4libdir $krb4lib $comerrlib" fi fi if test "x$enable_krb5" = "xyes" ; then # Add header dir, if necessary have_already=no for j in $krb5incdir ; do if test "x$ceincdir" = "x$j" ; then have_already=yes fi done if test "x$have_already" = "xno" ; then inckrb5="INCKRB5 = -I$krb5incdir -I$ceincdir" else inckrb5="INCKRB5 = -I$krb5incdir" fi # Add lib (and lib dir, if necessary) have_already=no for j in $krb5libdir ; do if test "x$comerrlibdir" = "x$j" ; then have_already=yes fi done if test "x$have_already" = "xno" ; then libkrb5="LIBKRB5 = $krb5libdir $krb5lib $comerrlibdir $comerrlib" else libkrb5="LIBKRB5 = $krb5libdir $krb5lib $comerrlib" fi fi fi fi ###################################################################### # ### On some platforms the resolver lives in a separate library case $platform in linux|solaris) resolvlib="RESOLVLIB = -lresolv" ;; esac ###################################################################### # ### echo %%% Exit here if this is a dry run # if test "x$noact" = "xyes" ; then exit 0 fi ###################################################################### # ### echo %%% Writing files # #--------------------------------------------------------------------- # GNUmakefile # message "Writing $MAKEOUT " sed -e "s|@arch@|$arch|" \ -e "s|@xrdecho@|$xrdecho|" \ -e "s|@archdir@|$archdir|" \ -e "s|@targets@|$targets|" \ -e "s|@type@|$type|" \ -e "s|@rmpath@|$rmpath|" \ -e "s|@lnpath@|$lnpath|" \ -e "s|@xrdsec@|$xrdsec|" \ -e "s|@dbgsfx@|$dbgsfx|g" \ -e "s|@dbgmsg@|$dbgmsg|g" \ -e "s|@suncache@|$suncache|" \ < GNUmakefile.tmp > $MAKEOUT rm -f GNUmakefile.tmp echo "done" #--------------------------------------------------------------------- # GNUmake.env # message "Writing $ENVOUT " sed -e "s|@arch@|$arch|" \ -e "s|@type@|$type|" \ -e "s|@xrdecho@|$xrdecho|" \ -e "s|@archdir@|$archdir|" \ -e "s|@ccflv@|$ccflv|" \ -e "s|@threadlib@|$threadlib|" \ -e "s|@threadlibdir@|$threadlibdir|" \ -e "s|@pwdextracflags@|$pwdextracflags|" \ -e "s|@incafs@|$incafs|" \ -e "s|@libafs@|$libafs|" \ -e "s|@afsextracflags@|$afsextracflags|" \ -e "s|@inckrb4@|$inckrb4|" \ -e "s|@libkrb4@|$libkrb4|" \ -e "s|@inckrb5@|$inckrb5|" \ -e "s|@libkrb5@|$libkrb5|" \ -e "s|@resolvlib@|$resolvlib|" \ -e "s|@cryptlib@|$cryptlib|" \ -e "s|@incssl@|$incssl|" \ -e "s|@libssl@|$libssl|" \ -e "s|@sslextracflags@|$sslextracflags|" \ -e "s|@hasdevpoll@|$hasdevpoll|" \ -e "s|@hasepoll@|$hasepoll|" \ -e "s|@haslibz@|$haslibz|" \ -e "s|@libz@|$libz|" \ -e "s|@hassendfile@|$hassendfile|" \ -e "s|@hassigwti@|$hassigwti|" \ -e "s|@hassetresuid@|$hassetresuid|" \ -e "s|@hasgethbyxr@|$hasgethbyxr|" \ -e "s|@hasnameinfo@|$hasnameinfo|" \ -e "s|@hasstrlcpy@|$hasstrlcpy|" \ -e "s|@hasprotor@|$hasprotor|" \ -e "s|@hasfstatat@|$hasfstatat|" \ -e "s|@hasreadline@|$hasreadline|" \ -e "s|@libreadline@|$libreadline|" \ -e "s|@tracedbg@|$tracedbg|" \ -e "s|@suncache@|$suncache|" \ -e "s|@perlbin@|$perlbin|" \ -e "s|@javacbin@|$javacbin|" \ -e "s|@javadir@|$javadir|" \ -e "s|@javainc@|$javainc|" \ -e "s|@perlincdir@|$perlincdir|" \ -e "s|@perlccflags@|$perlccflags|" \ -e "s|@nostrictalias@|$nostrictalias|" \ -e "s|@hasoldhdrs@|$hasoldhdrs|" \ -e "s|@altcxx@|$altcxx|" \ -e "s|@altld@|$altld|" \ < GNUmake.env.tmp > $ENVOUT rm -f GNUmake.env.tmp echo "done" #--------------------------------------------------------------------- # GNUmake.options # message "Writing $OPTOUT " sed -e "s|@dbgsfx@|$dbgsfx|g" \ -e "s|@dbgopt@|$dbgopt|" \ -e "s|@dbgflg@|$dbgflg|" \ -e "s|@makemsg@|$makemsg|" \ -e "s|@buildopt@|$buildopt|" \ -e "s|@macosx_target_setting@|$macosx_target_setting|" \ < GNUmake.options.tmp > $OPTOUT rm -f GNUmake.options.tmp echo "done" exit 0