"Fossies" - the Fresh Open Source Software Archive

Member "sqlupdate-1.6.6/configure" (25 Feb 2012, 4446 Bytes) of package /linux/privat/old/sqlupdate-1.6.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
    4   echo "Usage: ./configure [options]"
    5   echo ""
    6   echo "available options:"
    7   echo ""
    8   echo "  --help                   print this message"
    9   echo ""
   10   exit 1
   11 fi
   12 
   13 rm -f configure.log
   14 DEVNULL=configure.log
   15 
   16 cc_check() {
   17     rm -f conftest*
   18     cat > conftest.cpp << EOF
   19 #include $1
   20 int main () { $3 return 0; }
   21 EOF
   22     echo "  conftest.cpp:" >> $DEVNULL
   23     cat conftest.cpp >> $DEVNULL
   24     echo "  $CXX conftest.cpp $CXXFLAGS $LDFLAGS $2 -o conftest" >> $DEVNULL
   25     $CXX conftest.cpp $CXXFLAGS $LDFLAGS $2 -o conftest 1>>$DEVNULL 2>>$DEVNULL
   26     TMP="$?"
   27     rm -f conftest*
   28     return $TMP
   29 }
   30 
   31 select_tool() {
   32     toolname=$1
   33     shift
   34     echo -n '' > conftest
   35     for tool in $*; do
   36       tool_ver="`$tool -dumpversion 2>&1`"
   37       if test ! "$?" -gt 0; then echo -e "$tool_ver $tool" >> conftest; fi
   38     done
   39     if test -z "`cat conftest`"; then
   40       echo ""
   41       echo "Error: Unable to determine a suitable $toolname".
   42       echo "Configure cannot progress. Try installing $1."
   43       exit 1
   44     fi
   45     cat conftest >> $DEVNULL
   46     sel_tool="`sort -rn < conftest | head -n 1 | sed 's/.*  //'`"
   47     sel_ver="`sort -rn < conftest | head -n 1 | sed 's/ .*//'`"
   48     eval "$toolname"="'$sel_tool'"
   49     do_echo -n "$toolname=$sel_tool($sel_ver) "
   50 }
   51 
   52 do_echo() {
   53   op=""
   54   if test x"$1" = x"-n"; then op="$1"; shift; fi
   55   echo $op "$*"
   56   echo "$*" >> $DEVNULL
   57 }
   58 
   59 CFLAGS=""
   60 CPPFLAGS=""
   61 LDFLAGS=""
   62 OPTIM=""
   63 
   64 do_echo -n "Determining compiler version to use... "
   65 # icc removed temporarily
   66 
   67 select_tool CXX g++  `(IFS=':'; for s in $PATH;do cd "$s"&&echo g++-*;done) 2>/dev/null`
   68 select_tool CPP cpp  `(IFS=':'; for s in $PATH;do cd "$s"&&echo cpp-*;done) 2>/dev/null`
   69 select_tool CC  gcc cc  `(IFS=':'; for s in $PATH;do cd "$s"&&echo gcc-*;done) 2>/dev/null`
   70 do_echo ""
   71 
   72 do_echo -n "Checking if the determined compiler works... "
   73 if cc_check '<stdio.h>' '' 'for(int a=0; a<10;++a) { for(int a=0; a<5;++a) { } } puts("ok");'; then
   74   do_echo Ok
   75 else
   76   do_echo No
   77   do_echo "Error: Configure cannot figure out how to use your compiler."
   78   do_echo "Please try installing some recent version of gcc."
   79   exit 1
   80 fi
   81 
   82 if [ "$CC" = icc ]; then
   83   CPPFLAGS="$CPPFLAGS -w1 -inline-level=2"
   84   do_echo -n "Checking if your compiler supports -ipo... "
   85   if cc_check '<stdio.h>' '-fipo' 'int x,y[100];for(x=0; x<100;++x)y[x]=5;'; then
   86     do_echo Yes
   87     OPTIM="$OPTIM -ipo"
   88   else
   89     do_echo No
   90   fi
   91   
   92   cat > conftest.cpp << EOF
   93   int main() { }
   94 EOF
   95   # Figure out where ICC lives, and by extension, its library paths
   96   ICC_PATH="`"$CC" -v conftest.cpp 2>&1 | grep mcpcom | head -n 1 | sed 's@/mcpcom.*@@'`"
   97   # Explicitly add ICC's libs to the LDFLAGS -- shouldn't be needed,
   98   #  but it is, at least when you're using ICC on a distribution that
   99   #  isn't supported by Intel, such as Debian on x86_64.
  100   LDFLAGS="$LDFLAGS -L$ICC_PATH""/lib -lirc -lguide -lpthread -lstdc++"
  101 fi
  102 
  103 WARNINGS=""
  104 CWARNINGS=""
  105 CXXWARNINGS=""
  106 
  107 if [ ! "$CC" = "icc" ]; then
  108   T_WARNINGS="-Wall \
  109     -Wundef \
  110     -Wcast-qual \
  111     -Wpointer-arith \
  112     -Wconversion \
  113     -Wwrite-strings \
  114     -Wsign-compare \
  115     -Wredundant-decls \
  116     -Winit-self \
  117     -Wextra \
  118     -Wcast-align -Wformat"
  119   T_CWARNINGS="-Waggregate-return -Wshadow -Winline \
  120     -Wstrict-prototypes \
  121     -Wmissing-prototypes"
  122   T_CXXWARNINGS="-Woverloaded-virtual -Weffc++"
  123 
  124   for s in $T_WARNINGS;do
  125     do_echo -n "Checking if your compiler supports -$s... "
  126     if cc_check '<stdio.h>' "$s" ''; then
  127       do_echo Yes
  128       WARNINGS="$WARNINGS $s"
  129     else
  130       do_echo No
  131     fi
  132   done
  133   for s in $T_CWARNINGS;do
  134     do_echo -n "Checking if your compiler supports -$s... "
  135     if cc_check '<stdio.h>' "$s" ''; then
  136       do_echo Yes
  137       CWARNINGS="$CWARNINGS $s"
  138     else
  139       do_echo No
  140     fi
  141   done
  142   for s in $T_CXXWARNINGS;do
  143     do_echo -n "Checking if your compiler supports -$s... "
  144     if cc_check '<stdio.h>' "$s" ''; then
  145       do_echo Yes
  146       CXXWARNINGS="$CXXWARNINGS $s"
  147     else
  148       do_echo No
  149     fi
  150   done
  151 fi
  152 
  153 do_echo "Updating Makefile.sets ..."
  154 
  155 DATE="`LC_ALL=C date`"
  156 UNAME="`uname -a`"
  157 sed_cmd=""
  158 for s in CC CPP CXX OPTIM CPPFLAGS LDFLAGS FUSELIBS DATE UNAME WARNINGS CWARNINGS CXXWARNINGS; do
  159   eval value=\"\$$s\"
  160   sed_cmd="$sed_cmd;s{CONFIG_$s}$value"
  161 done
  162 
  163 sed "$sed_cmd" < Makefile.sets.in > Makefile.sets
  164 
  165 for dir in . lib util; do
  166   rm $dir/.depend $dir/.libdepend; make -C $dir .depend
  167 done &> /dev/null