#!/bin/sh ############################################################## # # Copyright(c) 1995~2008 Masaharu Goto (root-cint@cern.ch) # # For the licensing terms see the file COPYING # ############################################################## # # This is a bash script, which works with any reasonable sh. # Solaris sh is not, so we have to start bash, and call ourselves again. [ "x$1" != "x__have_the_proper_shell@" ] && ( \ WHICHSH=`which sh`; \ NEEDBASH=`uname -a | grep -i sunos 2> /dev/null;ls -l $WHICHSH | grep dash 2> /dev/null `; \ [ "x$NEEDBASH" != "x" ] && bash $0 __have_the_proper_shell@ "$@"; \ [ "x$NEEDBASH" = "x" ] && sh $0 __have_the_proper_shell@ "$@" \ ) [ "x$1" != "x__have_the_proper_shell@" ] && exit shift # configure settings to build CINT ARCHS=(linux linuxicc macos macosx64 djgpp cygwin mingw mwerks hpux aix msvc7 msvc8 msvc9 msvc10 solaris solarisgcc freebsd) ############################################################# ### ### Architecture Settings ### ############################################################# # These are the variables that can be set by the different architectures. # They are prepended by "G__CFG_" when writing out to Makefile.conf and $COREVERSION/inc/configcint.h. EXPORTS=(CINTVERSION ARCH COREVERSION CC CFLAGS CMACROS COMP CPP COUT COUTEXE INCP CXX CXXFLAGS CXXMACROS \ LD LDFLAGS LDOUT LIBP LIBL SOFLAGS SOOUT OBJEXT EXEEXT \ SOEXT LIBEXT IMPLIBEXT DEBUG DEFAULTLIBS \ MANGLEPATHS MANGLEPATHSU STREAMDIR PLATFORMO EXPLLINK \ READLINELIB CURSESLIB LINK_READLINELIB LINK_CURSESLIB READLINELIB4SHLIB CURSESLIB4SHLIB RM MV WITHPREFIX \ INPUTMODE INPUTMODELOCK AR EXTRACTSYMBOLS MAKEIMPLIB) unset ${EXPORTS[*]} # Lines demonstrating the use of the available variables. # Only one of DBGFLAGS or OPTFLAGS is actually used, depending # on the value of DEBUG (see --debug) # $CC $CFLAGS $CMACROS $COPTFLAGS $CDBGFLAGS ${COMP}@source@ ${COUT}@object@$OBJEXT ${INCP}@inclpath@ @header@ # $CXX $CXXFLAGS $CXXMACROS $CXXOPTFLAGS $CXXDBGFLAGS ${COMP}@source@ ${COUT}@object@$OBJEXT ${INCP}@inclpath@ @header@ # $LD $LDFLAGS $LDOPTFLAGS $LDDBGFLAGS ${LDOUT}@exe@$EXEEXT ${OBJ}@obj@$OBJEXT ${LIBP}@libpath@ $(subst @lib@,$LIBEXT,${LIBL}) $DEFAULTLIBS # $LD $SOFLAGS $LDOPTFLAGS $LDDBGFLAGS ${SOOUT}@so@$SOEXT ${OBJ}@obj@$OBJEXT ${LIBP}@libpath@ $(subst @lib@,$LIBEXT,${LIBL}) $DEFAULTLIBS # common defaults: INPUTMODELOCK=off INPUTMODE=cint COMP=-c INCP=-I function config_unix_defaults { COUT="-o " COUTEXE="-o " CDBGFLAGS=-g COPTFLAGS=-O2 CMACROS="$CMACROS -DG__SHAREDLIB -DG__OSFDLL -DG__ANSI -DG__ERRORCALLBACK -DG__SIGNEDCHAR -DG__NEWSTDHEADER -DG__CINT_VER6 -DG__NATIVELONGLONG -DG__P2FCAST -DG__STD_EXCEPTION" CXXDBGFLAGS="$CDBGFLAGS" CXXOPTFLAGS="$COPTFLAGS" CXXMACROS="$CXXMACROS $CMACROS" DEFAULTLIBS="-lm -ldl" LDOUT="-o " SOOUT="$LDOUT" LIBP=-L LIBL=-l@imp@ LDDBGFLAGS=-g LDOPTFLAGS=-O2 SOFLAGS=-shared SODBGFLAGS=-g RM="rm -rf" MV="mv -f" OBJEXT=.o EXEEXT= SOEXT=.so LIBEXT=.a IMPLIBEXT=.a AR="ar qcs " [ "x$TAILOPT" = "x" ] && TAILOPT=-n } function config_GCC_defaults { config_unix_defaults CC=gcc CPP="gcc -E -C" CXX="g++ " LD="g++ " GCCVER=`echo __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__|$CC -E -|tail ${TAILOPT}1` if [ ${GCCVER%% *} -gt 3 ]; then STREAMDIR=gcc4strm elif [ ${GCCVER%% *} -gt 2 ]; then STREAMDIR=gcc3strm else STREAMDIR=stream fi } function config_linux { config_GCC_defaults } function config_freebsd { config_GCC_defaults CFLAGS="${CFLAGS} -fPIC" CXXFLAGS="${CXXFLAGS} -fPIC" DEFAULTLIBS="`echo $DEFAULTLIBS | sed 's/-ldl//'`" } function config_linuxx8664gcc { config_GCC_defaults EXTRA_LIB_DIR="/usr/local/lib64 /usr/lib64" CPP="gcc -E -C -m64" CXXFLAGS="-m64 -fPIC -DG__64BIT ${CXXFLAGS}" CFLAGS="-m64 -fPIC -DG__64BIT ${CFLAGS}" LDFLAGS="-m64 ${LDFLAGS}" } function config_linuxicc { config_GCC_defaults CXX=icc CC=icc LD=icc CPP="icc -E -C" CXXFLAGS="${CXXFLAGS} -wd1476 -wd21 -wd191" CFLAGS="${CFLAGS} -wd1476 -wd21 -wd191" STREAMDIR=iccstrm } function config_macos { config_GCC_defaults CXXFLAGS="${CXXFLAGS} -pipe -W -Wall -Wno-long-double -Woverloaded-virtual -fsigned-char -fno-common" CFLAGS="${CFLAGS} -pipe -W -Wall -Wno-long-double -fsigned-char -fno-common" SOFLAGS="-dynamiclib -single_module" CMACROS="$CMACROS -DG__MACOSX__ -DG__APPLE" EXTRA_LIB_DIR="/sw/lib/ncurses" # PLATFORMO=macos AR="ar -r -cs " IMPLIBEXT=.dylib MAKEIMPLIB="ln -sf @so@ @imp@" EXPLLINK=1 MACOSX_MINOR=`sw_vers | sed -n 's/ProductVersion://p' | cut -d . -f 2` if [ `echo $MACOSX_MINOR | cut -d ' ' -f 2` -gt 4 ]; then # this is set for 64 but not for 32 bit CMACROS="${CMACROS} -D__DARWIN_UNIX03=1" CXXFLAGS="${CXXFLAGS} -D__DARWIN_UNIX03=1" fi } function config_macosx64 { config_macos CFLAGS="${CFLAGS} -DG__64BIT -m64" CXXFLAGS="${CXXFLAGS} -DG__64BIT -m64" LDFLAGS="${LDFLAGS} -m64" SOFLAGS="${SOFLAGS} -m64" } function config_djgpp { config_GCC_defaults CFLAGS="-I$(DJGPPDIR)/include" CMACROS="-DG__DJGPP -DG__DJGPP" CXXFLAGS="$CXXFLAGS $CFLAGS" CXXMACROS="$CMACROS" DEFAULTLIBS="-L$(DJGPPDIR)/lib -lm" EXPLLINK=1 } function config_cygwin { config_GCC_defaults EXEEXT=.exe SOEXT=.dll IMPLIBEXT=.dll.a CMACROS="-DG__SHAREDLIB -DG__OSFDLL -DG__NEWSTDHEADER -DG__CYGWIN -DG__NATIVELONGLONG -DG__STD_EXCEPTION" CXXMACROS="$CMACROS" EXPLLINK=1 LDFLAGS="$LDFLAGS -Wl,--enable-auto-import" SOFLAGS="$SOFLAGS --export-all-symbols" } function config_mingw { config_cygwin CFLAGS="$CFLAGS -mno-cygwin" CMACROS="-DG__MINGW -DG__STD_EXCEPTION" CXXFLAGS="$CXXFLAGS $CFLAGS" CXXMACROS="$CMACROS" EXPLLINK=1 } function config_mwerks { echo "Not implemented yet." exit 1 } function configcint_hpux { echo "Not implemented yet." exit 1 } function config_aix { echo "Not implemented yet." exit 1 } function config_msvc7 { OBJEXT=.obj EXEEXT=.exe LIBEXT=.lib SOEXT=.dll IMPLIBEXT=.lib CC=cl CFLAGS="-G5 -nologo -wd4996 -GX" CMACROS="-DG__REDIRECTIO -DG__SHAREDLIB -DG__WIN32 -DWIN32 -D_WIN32 -DG__NEWSTDHEADER" CPP="cl -E -C -nologo" COUT=-Fo COUTEXE=-Fe COPTFLAGS="-O2 -MD" CDBGFLAGS="-Zi -MDd" CXX=cl CXXFLAGS="$CXXFLAGS $CFLAGS -TP -GR -wd4181" CXXMACROS="$CMACROS" CXXOPTFLAGS="$COPTFLAGS" CXXDBGFLAGS="$CDBGFLAGS" LD=link LDFLAGS="-nologo -ignore:4049 -ignore:4217 -ignore:4221 -incremental:no" LDOUT=-out: LIBP=-LIBPATH: LIBL=lib@imp@$IMPLIBEXT LDOPTFLAGS=-OPT:REF LDDBGFLAGS=-DEBUG DEFAULTLIBS="kernel32.lib user32.lib" EXPLLINK=1 # hack to get the implib and def in SOFLAGS="$LDFLAGS -DLL -implib:@so@$LIBEXT" SODBGFLAGS="-debug" SOOUT=-out: EXTRACTSYMBOLS="dumpbin.exe /SYMBOLS @obj@ | grep -e ' notype ()[[:space:]]\{4\}External '| grep -v ' UNDEF ' | grep -v 'AEPAXI@Z ('| sed 's!^[[:xdigit:]]\{3,\}[[:space:]]\+\([[:xdigit:]]\{8\}\)[[:space:]]\+.*\+External[[:space:]]\+|[[:space:]]\+\([^(]\+\).*\$!\1 \2!'| cut -d' ' -f2" MANGLEPATHS="cygpath -m" MANGLEPATHSU="cygpath -u" STREAMDIR=vc7strm PLATFORMO=winnt RM="rm -f" MV="mv -f" AR="lib /OUT:" NOREADLINE=1 } function config_msvc8 { config_msvc7 CFLAGS="${CFLAGS/-G5/}" CXXFLAGS="${CXXFLAGS/-G5/}" CFLAGS="${CFLAGS/-GX/-EHs}" CMACROS="$CMACROS -D_CRT_SECURE_NO_DEPRECATE=1" CXXFLAGS="${CXXFLAGS/-GX/-EHs}" CXXMACROS="$CXXMACROS -D_CRT_SECURE_NO_DEPRECATE=1" } function config_msvc9 { config_msvc7 CFLAGS="${CFLAGS/-G5/}" CXXFLAGS="${CXXFLAGS/-G5/}" CFLAGS="${CFLAGS/-GX/-EHs}" CMACROS="$CMACROS -D_CRT_SECURE_NO_DEPRECATE=1" CXXFLAGS="${CXXFLAGS/-GX/-EHs}" CXXMACROS="$CXXMACROS -D_CRT_SECURE_NO_DEPRECATE=1" } function config_msvc10 { config_msvc9 STREAMDIR=vc10strm } function config_solarisgcc { TAILOPT=- config_GCC_defaults CFLAGS="${CFLAGS} -fPIC" CXXFLAGS="${CXXFLAGS} -fPIC" } function config_solaris { TAILOPT=- config_unix_defaults CXX=CC CC=cc LD=CC CPP="CC -E -C" CXXFLAGS="$CXXFLAGS -erroff=badargtypel2w,wbadinitl,wbadasgl" LDFLAGS= COPTFLAGS=-O CXXOPTFLAGS=-O LDOPTFLAGS=-O SOFLAGS="-KPIC -G" DEFAULTLIBS="-lm -ltermcap -ldl -L/usr/ccs/lib -lgen" STREAMDIR=sunstrm } ############################################################# ### ### Option Processing ### ############################################################# declare -a OPTS_AVAIL declare -a OPTS_DESCR let numopts=0; function add_opt { OPTS_AVAIL[$numopts]="$1" OPTS_DESCR[$numopts]="$2" let numopts=$numopts+1 } add_opt "--help -h" 'Show this help.' add_opt "--arch=" "Architecture, one of ${ARCHS[*]}" add_opt "--coreversion=" "CINT core version, one of old, current, new [current]" add_opt "--with-prefix" 'Prefix-based build (instead of using CINTSYSDIR)' add_opt "--prefix=" 'Topdir for architecture-independent files [/usr/local]' add_opt "--exec-prefix=" 'Topdir for architecture-dependent files [$PREFIX]' add_opt "--bindir=" 'where to put user executables [$EPREFIX/bin]' add_opt "--libdir=" 'where to put object code libraries [$EPREFIX/lib]' add_opt "--includedir=" 'where to put header files [$PREFIX/include]' add_opt "--datadir=" 'read-only architecture-independent data [$PREFIX/share]' add_opt "--mandir=" 'location of manual files [$PREFIX/share/man]' add_opt "--sbindir=" 'ignored' add_opt "--libexecdir=" 'ignored' add_opt "--sysconfdir=" 'ignored' add_opt "--sharedstatedir=" 'ignored' add_opt "--localstatedir=" 'ignored' add_opt "--oldincludedir=" 'ignored' add_opt "--datarootdir=" 'ignored' add_opt "--infodir=" 'ignored' add_opt "--localedir=" 'ignored' add_opt "--docdir=" 'ignored' add_opt "--htmldir=" 'ignored' add_opt "--dvidir=" 'ignored' add_opt "--pdfdir=" 'ignored' add_opt "--psdir=" 'ignored' add_opt "--readlinelib=" "Readline library "$'\n\t'"(defaults to /usr/(local)/lib/libreadline.a if it exists)" add_opt "--debug" "Build non-optimized Cint with debug symbols" add_opt "--checkstack" "Build with stack checking (GCC only)" add_opt "--pedantic" "Warn on everything that the compiler allows (only supported for GCC)" add_opt "--inputmode=" "Define the inputmode (C++|cint|root)" function processflag_help { echo CINT configure options: let iopt=0 while [ $iopt -lt $numopts ]; do arg="" opts=${OPTS_AVAIL[$iopt]} [ "${opts/=/}" != "$opts" ] && arg='' echo " "${OPTS_AVAIL[$iopt]}"$arg": "${OPTS_DESCR[$iopt]}" let iopt=$iopt+1 done exit 0 } function guess_arch { arch=`uname -s | tr '[A-Z]' '[a-z]'` chip=`uname -m | tr '[A-Z]' '[a-z]'` rele=`uname -r` case "$arch:$chip:$rele" in # aix*) arch=aix5 ;; # osf1*:alpha:*) arch=alphacxx6 ;; # freebsd*:*:6*) arch=freebsd5 ;; # 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 ;; # linux:arm*:*) arch=linuxarm ;; # linux:ppc64*:*) arch=linuxppc64gcc ;; # linux:ppc*:*) arch=linuxppcgcc ;; linux:i*86:*) arch=linux ;; # openbsd*:*:*) arch=openbsd ;; # lynx:*:*) arch=lynxos ;; # 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 ;; cygwin_*:*86:*) arch=win32 ;; cygwin_*:pentium:*) arch=win32 ;; cygwin_*:ia64) arch=win32 ;; # *) # echo "Attempts at guessing your architecture failed." # echo "Please specify the architecture as the first argument." # echo "Do '$0 --help' for a list of available architectures." # exit 1 # ;; esac if [ "x`uname -a|grep -i linux`" != "x" ]; then GUESSEDARCH=$arch elif [ "x`uname -a|grep -i freebsd`" != "x" ]; then GUESSEDARCH=$arch elif cl.exe >/dev/null 2>&1; then if [ "x`cl 2>&1|grep 'Version 16'`" != "x" ]; then GUESSEDARCH=msvc10 elif [ "x`cl 2>&1|grep 'Version 15'`" != "x" ]; then GUESSEDARCH=msvc9 elif [ "x`cl 2>&1|grep 'Version 14'`" != "x" ]; then GUESSEDARCH=msvc8 else GUESSEDARCH=msvc7 fi elif gcc --version >/dev/null 2>&1; then if [ "x`uname -a|grep -i mac`" != "x" -o "$arch" = "macosx" ]; then GUESSEDARCH=macos 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 GUESSARCH=macosx64 fi fi elif [ "x`uname -a|grep -i SunOS`" != "x" ]; then GUESSEDARCH=solarisgcc fi elif [ "x`uname -a|grep -i SunOS`" != "x" ] && CC -V >/dev/null 2>&1; then GUESSEDARCH=solaris fi if [ "x$GUESSEDARCH" = "x" ]; then echo 'Cannot guess architecture, please specify --arch=...!' processflag_help fi echo 'Guessing architecture to be '$GUESSEDARCH } function processflag_arch { if [ "${ARCHS[*]/$1/}" = "${ARCHS[*]}" ]; then echo "Error: invalid architecture. Choose one out of" echo " "${ARCHS[*]} exit 1 fi ARCH=$1 config_$ARCH } function processflag_coreversion { COREVERSION=$1 if [ "x$COREVERSION" = "xnew" ]; then COREVERSION=cint7 elif [ "x$COREVERSION" = "xold" ]; then COREVERSION=cint elif [ "x$COREVERSION" = "xcurrent" ]; then COREVERSION=cint else echo "Error: --coreversion must be one of old, current, new, not \"$1\"." exit 1 fi } function pathtoabs { ABSPATH=$1 if [ "${1:0:1}" != "/" ]; then ABSPATH="`dirname $0`/`dirname $1`" ABSPATH="`cd ABSPATH; pwd`/`basename $1`" fi } function processflag_with_prefix { WITHPREFIX=1 if [ "x$PREFIX" = "x" ]; then PREFIX="/usr/local" fi } function processflag_prefix { WITHPREFIX=1 pathtoabs $1 PREFIX=$ABSPATH } function processflag_exec_prefix { WITHPREFIX=1 pathtoabs $1 EPREFIX=$ABSPATH } function processflag_bindir { WITHPREFIX=1 pathtoabs $1 BINDIR=$ABSPATH } function processflag_libdir { WITHPREFIX=1 pathtoabs $1 LIBDIR=$ABSPATH } function processflag_includedir { WITHPREFIX=1 pathtoabs $1 INCLUDEDIR=$ABSPATH INCLUDEDIRCINT=$ABSPATH/cint } function processflag_datadir { WITHPREFIX=1 pathtoabs $1 DATADIR=$ABSPATH DATADIRCINT=$ABSPATH/cint } function processflag_mandir { WITHPREFIX=1 pathtoabs $1 MANDIR=$ABSPATH } function processflag_debug { DEBUG=1 } function processflag_pedantic { DEBUG=0 CFLAGS="${CXXFLAGS} -Wall -pedantic -Wextra -Wundef -Wendif-labels -Wshadow -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wstrict-prototypes -Wredundant-decls -Winline -Wno-long-long" CXXFLAGS="${CXXFLAGS} -Wall -pedantic -Wextra -Wundef -Wendif-labels -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wsign-compare -Wredundant-decls -Winline -Wno-long-long" # too much noise in system headers: -Wunreachable-code } function processflag_readlinelib { READLINELIB=$1 } function processflag_inputmode { INPUTMODE=$1 if [ "x$INPUTMODE" != "xC++" ] \ && [ "x$INPUTMODE" != "xcint" ] \ && [ "x$INPUTMODE" != "xroot" ]; then echo WARNING: unknown INPUTMODE \"$INPUTMODE\" specified\! fi } function processflag_checkstack { CXXFLAGS="$CXXFLAGS -fstack-check" LDFLAGS="$LDFLAGS -fstack-check " } # process options ALLOPTIONS=(${*:1}) while [ "$1" != "" ]; do let iopt=0; found=0 while [ $found = 0 -a $iopt -lt $numopts ]; do flags=( ${OPTS_AVAIL[$iopt]} ) let numflags=${#flags[*]} let iflag=0 while [ $iflag -lt $numflags ]; do flag=${flags[$iflag]} if [ "${1#$flag}" != "$1" ]; then found=1 # remove leading "-"s, trailing =, replace "-" by "_" func=`echo start ${flags[0]}|sed -e 's,start ,,' -e 's,^-*,,' -e 's,=$,,' -e 's,-,_,g'` if [ ${flag/=/} = $flag ]; then # simple flag without value processflag_$func else value=${1#$flag} processflag_$func "$value" fi break fi let iflag=$iflag+1 done let iopt=$iopt+1 done if [ $found = 0 ]; then echo "Unknown argument $1." echo "" processflag_help fi shift done if [ "$ARCH" = "" ]; then guess_arch ARCH=$GUESSEDARCH config_$ARCH fi if [ "$COREVERSION" = "" ]; then COREVERSION=cint echo Using current CINT core fi if [ "$DEBUG" = "1" ]; then LDFLAGS="$LDDBGFLAGS $LDFLAGS" SOFLAGS="$SODBGFLAGS $SOFLAGS" CFLAGS="$CDBGFLAGS $CFLAGS" CXXFLAGS="$CXXDBGFLAGS $CXXFLAGS" else LDFLAGS="$LDOPTFLAGS $LDFLAGS" SOFLAGS="$SOOPTFLAGS $SOFLAGS" CFLAGS="$COPTFLAGS $CFLAGS" CXXFLAGS="$CXXOPTFLAGS $CXXFLAGS" fi CMACROS="$CMACROS -DG__HAVE_CONFIG -DG__NOMAKEINFO" CXXMACROS="$CXXMACROS -DG__HAVE_CONFIG -DG__NOMAKEINFO" if [ "$NOREADLINE" = "" -a "$READLINELIB" = "" ]; then for ext in $IMPLIBEXT $SOEXT; do for d in $EXTRA_LIB_DIR /usr/local/lib /usr/lib /sw/lib; do if [ -f ${d}/libreadline$ext ]; then READLINELIB=${d}/libreadline$ext if [ "${ext}" = "${SOEXT}" ]; then READLINELIBSHARED=1 fi break 2 fi done done if [ "x$READLINELIB" = "x" ]; then echo 'Please install the package "libreadline or [lib]readline-dev[el]"!' exit 1 fi LINK_READLINELIB="$LIBP`dirname $READLINELIB` ${LIBL/@imp@/readline} " fi # want readline? if [ "$READLINELIB" != "" ]; then CXXFLAGS="$CXXFLAGS -DG__GNUREADLINE" DEFAULTLIBS="$DEFAULTLIBS -ltermcap" echo "Using $READLINELIB" if [ "$EXPLLINK" = "1" ]; then READLINELIB4SHLIB=$READLINELIB fi # look for curses if [ "x${CURSESLIB}" = "x" ]; then for ext in $IMPLIBEXT $SOEXT; do for d in $EXTRA_LIB_DIR /usr/local/lib /usr/lib /sw/lib /sw/lib/ncurses; do if [ -f ${d}/libncurses$ext ]; then CURSESLIB=${d}/libncurses$ext NCURSES=n break 2 elif [ -f ${d}/libcurses$ext ]; then CURSESLIB=${d}/libcurses$ext NCURSES= break 2 fi done done fi if [ "$CURSESLIB" != "" ]; then LINK_CURSESLIB="$LIBP`dirname $CURSESLIB` ${LIBL/@imp@/${NCURSES}curses}" if [ "$EXPLLINK" = "1" ]; then CURSESLIB4SHLIB=$CURSESLIB fi echo "Using $CURSESLIB" fi fi [ "$STREAMDIR" = "" ] && STREAMDIR=stream [ "$MANGLEPATHS" = "" ] && MANGLEPATHS="echo " [ "$MANGLEPATHSU" = "" ] && MANGLEPATHSU="echo " HAVE_CONFIG=1 EXPORTS=(${EXPORTS[*]} HAVE_CONFIG) # now set the default values of the installation directories, if # they were not set explicitly by the user if [ "x$WITHPREFIX" = "x1" ]; then # prefix based build [ "$PREFIX" = "" ] && PREFIX=/usr/local if [ -d "$PREFIX" ]; then if [ "`cd \"$PREFIX\"; pwd`" = "`cd \"$PWD\"; pwd`" ]; then echo ' ' echo ' ' echo 'ERROR: Cannot build within install location!' echo 'Directory '$PREFIX' set as --prefix is the same as the current directory!' echo ' ' exit 1 fi fi [ "$EPREFIX" = "" ] && EPREFIX=$PREFIX [ "$BINDIR" = "" ] && BINDIR=$EPREFIX/bin [ "$LIBDIR" = "" ] && LIBDIR=$EPREFIX/lib [ "$INCLUDEDIR" = "" ] && INCLUDEDIR=$PREFIX/include && INCLUDEDIRCINT=$PREFIX/include/cint [ "$DATADIR" = "" ] && DATADIR=$PREFIX/share && DATADIRCINT=$PREFIX/share/cint [ "$MANDIR" = "" ] && MANDIR=$PREFIX/share/man EXPORTS=(${EXPORTS[*]} PREFIX EPREFIX BINDIR LIBDIR \ INCLUDEDIR INCLUDEDIRCINT DATADIR DATADIRCINT MANDIR) fi # get actual cint version from int/G__ci.h if [ "x${COREVERSION}" = "xcint" ]; then CINTVERSIONTAG=G__CINTVERSIONSTR_V5 else CINTVERSIONTAG=G__CINTVERSIONSTR LREFLEX=-lReflex IREFLEX=${INCP}$CINTSYSDIR/reflex/inc fi CINTVERSION=`grep '#define *'${CINTVERSIONTAG}' ' ${COREVERSION}/inc/G__ci.h | sed 's/^.*"\([^,]*\),.*$/\1/'` ############################################################# ### ### Generate Output ### ############################################################# echo "" echo Creating build dirs... [ -d bin ] || mkdir -p bin [ -d lib ] || mkdir -p lib [ -d include ] || mkdir -p include # generate Makefile.conf file=Makefile.conf echo Writing $file... echo "# Makefile.conf for Cint" > $file echo "# generated by configure with options" >> $file echo "# "${ALLOPTIONS[*]} >> $file for exp in ${EXPORTS[*]}; do # Write out e.g. "CXX:=cl" value="`echo start \"${!exp}\"|sed -e 's,start ,,' -e 's,[$],$$,g'`" [ "$value" != "" ] && echo G__CFG_$exp := "$value" >> $file done # Now do the same for configcint.h - but here we need to write _all_ vars file=${COREVERSION}/inc/configcint.h echo Writing $file... echo "/* configcint.h for Cint */" > $file echo "/* generated by configure with options */" >> $file echo "/* "${ALLOPTIONS[*]}" */">> $file for exp in ${EXPORTS[*]}; do # Write out e.g. "CXX:=cl" [ $exp = EXTRACTSYMBOLS ] && continue value="`echo start \"${!exp}\"|sed -e 's,start ,,' -e 's,\\\\,\\\\\\\\,g'`" echo '#define 'G__CFG_$exp \""$value"\" >> $file done echo Removing Apiif.cxx rm -f ${COREVERSION}/src/dict/Apiif*.* # now write the cint-config script $RM bin/cint-config echo Writing bin/cint-config... [ "x$BINDIR" = "x" ] && BINDIR='$CINTSYSDIR/bin' [ "x$INCLUDEDIR" = "x" ] && INCLUDEDIR='$CINTSYSDIR'/${COREVERSION}/inc && INCLUDEDIRCINT='$CINTSYSDIR'/${COREVERSION}/inc [ "x$LIBDIR" = "x" ] && LIBDIR='$CINTSYSDIR/lib' [ "x$DATADIR" = "x" ] && DATADIR='$CINTSYSDIR/'${COREVERSION}'/' cat > bin/cint-config << ___EOF printhelp() { cat <<_EOF Usage: cint-config [options] --bindir print the directory of cint executables --incdir print the directory of cint header files --cflags print the necessary flags for the compiler --libs print the necessary libs for linking --libdir print the directory of cint libraries --datadir print the location of cint data files --arch print architecture -u|--unix print unix-like paths (makes sense only on win) this arg has effect only on the following args -v|--version print cint version -h|--help print this help _EOF } if [ \$# -eq 0 ]; then printhelp exit 1 fi pathconvert=echo while [ \$# -gt 0 ] ; do case \$1 in --unix|-u) pathconvert="$MANGLEPATHSU" ;; --bindir) \$pathconvert "${BINDIR}" ;; --incdir) \$pathconvert "${INCLUDEDIRCINT}" ;; --cflags) \$pathconvert "${INCP}${INCLUDEDIRCINT} ${IREFLEX}" ;; --libs) \$pathconvert "${LIBP}${LIBDIR} -lCint ${LREFLEX}" ;; --libdir) \$pathconvert "${LIBDIR}" ;; --datadir) \$pathconvert "${DATADIR}/cint" ;; --version|-v) echo "$CINTVERSION" ;; --arch) echo "${ARCH}" ;; -h|--help) printhelp;; *) echo "Unknown option: \$1"; exit 1;; esac shift done ___EOF chmod +x bin/cint-config echo Writing config.status... echo ${ALLOPTIONS[*]} > config.status echo Creating Makefile... cp build/Makefile . echo Creating reconfigure... # we need the "&& exit" below to ensure that the shell doesn't # continue reading reconfigure, where reconfigure will be the # one recreated by the sub-configure: cat > reconfigure <