Commit 721157f5 authored by Mikael Ronstrom's avatar Mikael Ronstrom

Made it possible to set CC and CXX on commandline before calling script

for those cases when gcc, cc-5.0, icpc or icc isn't in the path.

Fixed handling of 32 and 64 bits.

Downgraded Solaris builds on Forte to use -xO2 rather than -xO3.

Made it possible to build 64-bits on Mac OS X

Fixed some bugs in setting CC, CXX, ASFLAGS, LDFLAGS

Fixed bugs relating to use of SunStudio/Forte in check-cpu

Reorganized code a bit

Removed the use of --with-fast-mutexes since they aren't really
fast, rather slow.

Added -static-libgcc when using gcc

Added optimising compilation flags on BSD

Added use of curses library on Solaris

Removed the use of MY_ATOMIC_MODE_RWLOCKS which removed use of
atomic instructions

Added support for Forte on Solaris/x86
parent 818d68ab
...@@ -170,7 +170,7 @@ Usage: $0 [options] ...@@ -170,7 +170,7 @@ Usage: $0 [options]
--error-inject Enable error injection into MySQL Server and --error-inject Enable error injection into MySQL Server and
data nodes data nodes
--valgrind Build with valgrind --valgrind Build with valgrind
--fast Optimise for CPU architecture buildt on --fast Optimise for CPU architecture built on
--static-linking Statically link system libraries into binaries --static-linking Statically link system libraries into binaries
--with-flags * Pass extra --with-xxx options to configure --with-flags * Pass extra --with-xxx options to configure
EOF EOF
...@@ -314,10 +314,6 @@ extended_usage() ...@@ -314,10 +314,6 @@ extended_usage()
In addition there are some configure options that are specific to In addition there are some configure options that are specific to
Linux operating systems: Linux operating systems:
--with-fast-mutexes
Include an alternative implementation of mutexes that is faster on
Linux systems
--enable-assembler --enable-assembler
Include assembler code optimisations for a number of mostly string Include assembler code optimisations for a number of mostly string
methods. Used for x86 processors only. methods. Used for x86 processors only.
...@@ -376,6 +372,10 @@ extended_usage() ...@@ -376,6 +372,10 @@ extended_usage()
Use of the --debug option adds -g to the C/C++ flags. Use of the --debug option adds -g to the C/C++ flags.
In all cases it is possible to override the definition of CC and CXX
by calling the script as follows:
CC="/usr/local/bin/gcc" CXX="/usr/local/bin/gcc" BUILD/build_mccge.sh
FreeBSD/x86/gcc FreeBSD/x86/gcc
--------------- ---------------
No flags are used. Instead, configure determines the proper flags to No flags are used. Instead, configure determines the proper flags to
...@@ -383,8 +383,7 @@ extended_usage() ...@@ -383,8 +383,7 @@ extended_usage()
Linux/x86+Itanium/gcc Linux/x86+Itanium/gcc
------------- -------------
No flags are used. Instead the configure script determines the For debug builds -O is used and otherwise -O3 is used.Discovery of a
proper flags to use for both normal and debug builds. Discovery of a
Nocona or Core 2 Duo CPU causes a 64-bit binary to be built; Nocona or Core 2 Duo CPU causes a 64-bit binary to be built;
otherwise, the binary is 32-bit. To build a 64-bit binary, -m64 is otherwise, the binary is 32-bit. To build a 64-bit binary, -m64 is
added to the C/C++ flags. (To build a 32-bit binary on a 64-bit CPU, added to the C/C++ flags. (To build a 32-bit binary on a 64-bit CPU,
...@@ -393,11 +392,11 @@ extended_usage() ...@@ -393,11 +392,11 @@ extended_usage()
Linux/x86+Itanium/icc Linux/x86+Itanium/icc
------------- -------------
Flags used: Flags used:
CC = icc -static-libgcc -static-libcxa -i-static CC = icc -static-libgcc -static-intel
C++ = icpc -static-libgcc -static-libcxa -i-static C++ = icpc -static-libgcc -static-intel
C/C++ flags = -mp -restrict C/C++ flags = -mp -restrict
On Itanium we also add -no-ftz and -no-prefetch to CC and C++ flags. On Itanium we also add -no-ftz and to CC and C++ flags.
The non-debug versions also add the following: The non-debug versions also add the following:
C/C++ flags += -O3 unroll2 -ip C/C++ flags += -O3 unroll2 -ip
...@@ -411,12 +410,18 @@ extended_usage() ...@@ -411,12 +410,18 @@ extended_usage()
Solaris/x86/gcc Solaris/x86/gcc
--------------- ---------------
All builds on Solaris are 64-bit, so -m64 is always used in the All builds on Solaris are by default 64-bit, so -m64 is always used in
C/C++ flags. LDFLAGS is set to -m64 -static-libgcc -O/-O2. the C/C++ flags. LDFLAGS is set to -m64 -static-libgcc -O/-O2. If for
some reason a 32-bit Solaris is used it is necessary to add the flag
--32 to the script invocation. Due to bugs in compiling with -O3 on
Solaris only -O2 is used by default, when --fast flag is used -O3 will
be used instead.
Solaris/Sparc/Forte Solaris/Sparc/Forte
------------------- -------------------
Uses cc-5.0 as CC Uses cc-5.0 as CC
Set -m64 (default) or -m32 (if specifically set) in ASFLAGS,
LDFLAGS and C/C++ flags.
Sets ASFLAGS=LDFLAGS=xarch=v9, so that we compile Sparc v9 binaries Sets ASFLAGS=LDFLAGS=xarch=v9, so that we compile Sparc v9 binaries
C flags = -Xa -strconst -xc99=none C flags = -Xa -strconst -xc99=none
C++ flags = -noex C++ flags = -noex
...@@ -424,7 +429,7 @@ extended_usage() ...@@ -424,7 +429,7 @@ extended_usage()
For non-debug builds, the following flags are also used: For non-debug builds, the following flags are also used:
C/C++ flags = -xO3 C/C++ flags = -xO2
MacOSX/x86/gcc MacOSX/x86/gcc
-------------- --------------
...@@ -433,6 +438,10 @@ extended_usage() ...@@ -433,6 +438,10 @@ extended_usage()
Non-debug versions also add -Os -felide-constructors, where "-Os" Non-debug versions also add -Os -felide-constructors, where "-Os"
means the build is space-optimised as long as the space optimisations means the build is space-optimised as long as the space optimisations
do not negatively affect performance. Debug versions use -O. do not negatively affect performance. Debug versions use -O.
Mac OS X builds will always be 32-bit by default, when --64 is added
the build will be 64 bit instead. Thus the flag --m64 is added only
when specifically given as an option.
EOF EOF
} }
with_usage() with_usage()
...@@ -775,9 +784,17 @@ set_cpu_base() ...@@ -775,9 +784,17 @@ set_cpu_base()
check_cpu_cflags="" check_cpu_cflags=""
fi fi
if test "x$os" = "xMacOSX" ; then if test "x$os" = "xMacOSX" ; then
m64="no" if test "x$m64" = "xyes" ; then
m64="yes"
else
m64="no"
fi
elif test "x$os" = "xSolaris" ; then elif test "x$os" = "xSolaris" ; then
m64="yes" if test "x$m32" = "x" ; then
m64="yes"
else
m64="no"
fi
elif test "x$m32" = "x" ; then elif test "x$m32" = "x" ; then
if test "x$cpu_arg" = "xnocona" || test "x$cpu_arg" = "xcore2" || \ if test "x$cpu_arg" = "xnocona" || test "x$cpu_arg" = "xcore2" || \
test "x$cpu_arg" = "xathlon64" || test "x$cpu_arg" = "xopteron" ; then test "x$cpu_arg" = "xathlon64" || test "x$cpu_arg" = "xopteron" ; then
...@@ -791,8 +808,10 @@ set_cpu_base() ...@@ -791,8 +808,10 @@ set_cpu_base()
echo "Discovered CPU of type $cpu_base_type ($cpu_arg) on $os" echo "Discovered CPU of type $cpu_base_type ($cpu_arg) on $os"
if test "x$m64" = "xyes" ; then if test "x$m64" = "xyes" ; then
echo "Will compile 64-bit binaries" echo "Will compile 64-bit binaries"
else elif test "x$m32" = "xyes" ; then
echo "Will compile 32-bit binaries" echo "Will compile 32-bit binaries"
else
echo "Will compile default-sized (32 or 64 bit) binaries"
fi fi
return 0 return 0
} }
...@@ -806,18 +825,15 @@ init_configure_commands() ...@@ -806,18 +825,15 @@ init_configure_commands()
cxxflags="$cxx_warnings $base_cxxflags $compiler_flags" cxxflags="$cxx_warnings $base_cxxflags $compiler_flags"
configure="./configure $base_configs $with_flags" configure="./configure $base_configs $with_flags"
commands="$commands flags="CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\""
CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\""
if test "x$LDFLAGS" != "x" ; then if test "x$LDFLAGS" != "x" ; then
commands="$commands flags="$flags LDFLAGS=\"$LDFLAGS\""
LDFLAGS=\"$LDFLAGS\""
fi fi
if test "x$ASFLAGS" != "x" ; then if test "x$ASFLAGS" != "x" ; then
commands="$commands flags="$flags ASFLAGS=\"$ASFLAGS\""
ASFLAGS=\"$ASFLAGS\""
fi fi
commands="$commands commands="$commands
$configure" $flags $configure"
} }
# #
...@@ -920,7 +936,7 @@ set_libtoolize_version() ...@@ -920,7 +936,7 @@ set_libtoolize_version()
# We do not use ccache when gcov is used. Also only when # We do not use ccache when gcov is used. Also only when
# gcc is used. # gcc is used.
# #
set_up_ccache() set_ccache_usage()
{ {
if test "x$compiler" = "xgcc" ; then if test "x$compiler" = "xgcc" ; then
if ccache -V > /dev/null 2>&1 && test "$USING_GCOV" != "1" if ccache -V > /dev/null 2>&1 && test "$USING_GCOV" != "1"
...@@ -1046,7 +1062,7 @@ set_base_configs() ...@@ -1046,7 +1062,7 @@ set_base_configs()
base_configs="$base_configs --enable-local-infile" base_configs="$base_configs --enable-local-infile"
base_configs="$base_configs --enable-thread-safe-client" base_configs="$base_configs --enable-thread-safe-client"
base_configs="$base_configs --with-big-tables" base_configs="$base_configs --with-big-tables"
base_configs="$base_configs --with-extra-charsets=all" base_configs="$base_configs --with-extra-charsets=complex"
base_configs="$base_configs --with-ssl" base_configs="$base_configs --with-ssl"
base_configs="$base_configs --with-pic" base_configs="$base_configs --with-pic"
base_configs="$base_configs --with-csv-storage-engine" base_configs="$base_configs --with-csv-storage-engine"
...@@ -1059,17 +1075,27 @@ set_base_configs() ...@@ -1059,17 +1075,27 @@ set_base_configs()
# #
set_base_engines() set_base_engines()
{ {
engine_configs="$engine_configs --with-archive-storage-engine" engine_configs="--with-archive-storage-engine"
engine_configs="$engine_configs --with-blackhole-storage-engine" engine_configs="$engine_configs --with-blackhole-storage-engine"
engine_configs="$engine_configs --with-example-storage-engine" engine_configs="$engine_configs --without-example-storage-engine"
engine_configs="$engine_configs --with-federated-storage-engine" engine_configs="$engine_configs --with-federated-storage-engine"
engine_configs="$engine_configs --with-partition" engine_configs="$engine_configs --with-partition"
base_configs="$base_configs $engine_configs"
} }
set_pro_package() set_innodb_engine()
{ {
base_configs="$base_configs $engine_configs"
base_configs="$base_configs --with-innodb" base_configs="$base_configs --with-innodb"
}
set_ndb_engine()
{
base_configs="$base_configs --with-ndbcluster"
base_configs="$base_configs --without-ndb-debug"
}
set_pro_package()
{
base_configs="$base_configs --with-comment=\"MySQL Pro $version_text built from source\"" base_configs="$base_configs --with-comment=\"MySQL Pro $version_text built from source\""
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-debug\"" base_configs="$base_configs --with-server-suffix=\"-debug\""
...@@ -1081,10 +1107,6 @@ set_cge_extended_package() ...@@ -1081,10 +1107,6 @@ set_cge_extended_package()
if test "x$gpl" = "xno" ; then if test "x$gpl" = "xno" ; then
echo "Cannot build Extended Carrier Grade Edition as Commercial version" echo "Cannot build Extended Carrier Grade Edition as Commercial version"
fi fi
base_configs="$base_configs --with-ndbcluster"
base_configs="$base_configs --without-ndb-debug"
base_configs="$base_configs $engine_configs"
base_configs="$base_configs --with-innodb"
base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\"" base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Extended Edition $version_text built from source\""
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-cge-extended-debug\"" base_configs="$base_configs --with-server-suffix=\"-cge-extended-debug\""
...@@ -1095,9 +1117,6 @@ set_cge_extended_package() ...@@ -1095,9 +1117,6 @@ set_cge_extended_package()
set_cge_package() set_cge_package()
{ {
base_configs="$base_configs --with-ndbcluster"
base_configs="$base_configs --without-ndb-debug"
base_configs="$base_configs $engine_configs"
base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\"" base_configs="$base_configs --with-comment=\"MySQL Cluster Carrier Grade Edition $version_text built from source\""
if test "x$with_debug_flag" = "xyes" ; then if test "x$with_debug_flag" = "xyes" ; then
base_configs="$base_configs --with-server-suffix=\"-cge-debug\"" base_configs="$base_configs --with-server-suffix=\"-cge-debug\""
...@@ -1139,6 +1158,36 @@ set_gcc_special_options() ...@@ -1139,6 +1158,36 @@ set_gcc_special_options()
fi fi
} }
set_cc_and_cxx_for_gcc()
{
if test "x$CC" = "x" ; then
CC="gcc -static-libgcc"
fi
if test "x$CXX" = "x" ; then
CXX="gcc -static-libgcc"
fi
}
set_cc_and_cxx_for_icc()
{
if test "x$CC" = "x" ; then
CC="icc -static-intel -static-libgcc"
fi
if test "x$CXX" = "x" ; then
CXX="icpc -static-intel -static-libgcc"
fi
}
set_cc_and_cxx_for_forte()
{
if test "x$CC" = "x" ; then
CC="cc-5.0"
fi
if test "x$CXX" = "x" ; then
CXX="cc-5.0"
fi
}
# #
# If we discover a Core 2 Duo architecture and we have enabled the fast # If we discover a Core 2 Duo architecture and we have enabled the fast
# flag, we enable a compile especially optimised for Core 2 Duo. This # flag, we enable a compile especially optimised for Core 2 Duo. This
...@@ -1166,8 +1215,12 @@ set_bsd_configs() ...@@ -1166,8 +1215,12 @@ set_bsd_configs()
exit 1 exit 1
fi fi
base_configs="$base_configs --enable-assembler" base_configs="$base_configs --enable-assembler"
CC="gcc" if test "x$fast_flag" != "xno" ; then
CXX="gcc" compiler_flags="$compiler_flags -O3"
else
compiler_flags="$compiler_flags -O"
fi
set_cc_and_cxx_for_gcc
} }
# #
...@@ -1177,24 +1230,28 @@ set_linux_configs() ...@@ -1177,24 +1230,28 @@ set_linux_configs()
{ {
if test "x$cpu_base_type" != "xx86" && \ if test "x$cpu_base_type" != "xx86" && \
test "x$cpu_base_type" != "xitanium" ; then test "x$cpu_base_type" != "xitanium" ; then
usage "Only x86 and Itanium CPUs supported for 32-bit Linux" usage "Only x86 and Itanium CPUs supported for Linux"
exit 1 exit 1
fi fi
base_configs="$base_configs --with-fast-mutexes"
if test "x$cpu_base_type" = "xx86" ; then if test "x$cpu_base_type" = "xx86" ; then
base_configs="$base_configs --enable-assembler" base_configs="$base_configs --enable-assembler"
fi fi
if test "x$compiler" = "xgcc" ; then if test "x$compiler" = "xgcc" ; then
CC="gcc" set_cc_and_cxx_for_gcc
CXX="gcc"
if test "x$m64" = "xyes" ; then if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64" compiler_flags="$compiler_flags -m64"
elif test "x$m32" = "xyes" ; then
compiler_flags="$compiler_flags -m32"
fi
if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -O2"
else
compiler_flags="$compiler_flags -O"
fi fi
# configure will set proper compiler flags for gcc on Linux # configure will set proper compiler flags for gcc on Linux
elif test "x$compiler" = "xicc" ; then elif test "x$compiler" = "xicc" ; then
compiler_flags="$compiler_flags -mp -restrict" compiler_flags="$compiler_flags -mp -restrict"
CC="icc -static-intel" set_cc_and_cxx_for_icc
CXX="icpc -static-intel"
if test "x$cpu_base_type" = "xitanium" ; then if test "x$cpu_base_type" = "xitanium" ; then
compiler_flags="$compiler_flags -no-ftz" compiler_flags="$compiler_flags -no-ftz"
fi fi
...@@ -1215,12 +1272,15 @@ set_linux_configs() ...@@ -1215,12 +1272,15 @@ set_linux_configs()
# #
set_solaris_configs() set_solaris_configs()
{ {
# Use mtmalloc as malloc, see Tim Cook blog
base_configs="$base_configs --with-mysqld-libs=-lmtmalloc" base_configs="$base_configs --with-mysqld-libs=-lmtmalloc"
base_configs="$base_configs --with-named-curses=-lcurses"
case "`uname -a`" in case "`uname -a`" in
*5.10*|*5.11*) *5.8* | *5.9* | *5.10* | *5.11*)
;; ;;
*) *)
die "Only versions 10 and 11 supported for Solaris" die "Only versions 8,9, 10 and 11 supported for Solaris"
esac esac
if test "x$cpu_base_type" != "xx86" && \ if test "x$cpu_base_type" != "xx86" && \
test "x$cpu_base_type" != "xsparc" ; then test "x$cpu_base_type" != "xsparc" ; then
...@@ -1228,13 +1288,17 @@ set_solaris_configs() ...@@ -1228,13 +1288,17 @@ set_solaris_configs()
exit 1 exit 1
fi fi
if test "x$compiler" = "xgcc" ; then if test "x$compiler" = "xgcc" ; then
CC="gcc" set_cc_and_cxx_for_gcc
CXX="gcc"
if test "x$cpu_base_type" != "xx86" ; then if test "x$cpu_base_type" != "xx86" ; then
usage "Only gcc supported for Solaris 10/11 on SPARC" usage "Only gcc supported for Solaris 10/11 on SPARC"
fi fi
compiler_flags="$compiler_flags -m64 -DMY_ATOMIC_MODE_RWLOCKS" if test "x$m64" = "xyes" ; then
LDFLAGS="-m64 -static-libgcc" compiler_flags="$compiler_flags -m64"
LDFLAGS="-m64"
elif test "x$m32" = "xyes" ; then
compiler_flags="$compiler_flags -m32"
LDFLAGS="-m32"
fi
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
LDFLAGS="$LDFLAGS -O2" LDFLAGS="$LDFLAGS -O2"
compiler_flags="$compiler_flags -O2" compiler_flags="$compiler_flags -O2"
...@@ -1243,21 +1307,40 @@ set_solaris_configs() ...@@ -1243,21 +1307,40 @@ set_solaris_configs()
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O"
fi fi
elif test "x$compiler" = "xforte" ; then elif test "x$compiler" = "xforte" ; then
set_cc_and_cxx_for_forte
if test "x$cpu_base_type" = "xx86" ; then if test "x$cpu_base_type" = "xx86" ; then
usage "Only gcc supported for Solaris/x86" if test "x$fast_flag" != "xno" ; then
fi compiler_flags="$compiler_flags -xO2"
if test "x$cpu_base_type" != "xsparc" ; then fi
usage "Forte compiler supported for Solaris 9/SPARC only" compiler_flags="$compiler_flags -mt"
fi compiler_flags="$compiler_flags -fsimple=1"
CC="cc-5.0" compiler_flags="$compiler_flags -ftrap=%none"
CXX=CC compiler_flags="$compiler_flags -nofstore"
ASFLAGS="xarch=v9" compiler_flags="$compiler_flags -xbuiltin=%all"
LDFLAGS="xarch=v9" compiler_flags="$compiler_flags -xlibmil"
base_cflags="$base_cflags -Xa -xstrconst -xc99=none" compiler_flags="$compiler_flags -xlibmopt"
base_cxxflags="$base_cxxflags -noex" compiler_flags="$compiler_flags -xtarget=generic"
compiler_flags="$compiler_flags -mt -D_FORTEC -xarch=v9" base_cxx_flags="$base_cxx_flags -features=no%except"
if test "x$fast_flag" != "xno" ; then elif test "x$cpu_base_type" != "xsparc" ; then
compiler_flags="$compiler_flags -xO3" usage "Forte compiler supported for Solaris on x86 and SPARC only"
else
ASFLAGS="$ASFLAGS xarch=v9"
LDFLAGS="$LDFLAGS xarch=v9"
if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64"
ASFLAGS="$ASFLAGS -m64"
LDFLAGS="$LDFLAGS -m64"
elif test "x$m32" = "xyes" ; then
compiler_flags="$compiler_flags -m32"
ASFLAGS="$ASFLAGS -m32"
LDFLAGS="$LDFLAGS -m32"
fi
base_cflags="$base_cflags -Xa -xstrconst -xc99=none"
base_cxxflags="$base_cxxflags -noex"
compiler_flags="$compiler_flags -mt -D_FORTEC -xarch=v9"
if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -xO2"
fi
fi fi
else else
usage "Only gcc and Forte compilers supported for Solaris" usage "Only gcc and Forte compilers supported for Solaris"
...@@ -1270,10 +1353,7 @@ set_solaris_configs() ...@@ -1270,10 +1353,7 @@ set_solaris_configs()
# #
set_macosx_configs() set_macosx_configs()
{ {
base_cxxflags="$base_cxxflags -fno-common" if test "x$cpu_base_type" != "xx86" || test "x$compiler" != "xgcc" ; then
if test "x$cpu_base_type" = "xx86" && test "x$compiler" = "xgcc" ; then
compiler_flags="$compiler_flags -arch i386"
else
usage "Only gcc/x86 supported for Mac OS X" usage "Only gcc/x86 supported for Mac OS X"
exit 1 exit 1
fi fi
...@@ -1281,14 +1361,23 @@ set_macosx_configs() ...@@ -1281,14 +1361,23 @@ set_macosx_configs()
# Optimize for space as long as it doesn't affect performance, use some # Optimize for space as long as it doesn't affect performance, use some
# optimisations also when not in fast mode. # optimisations also when not in fast mode.
# #
base_cxxflags="$base_cxxflags -felide-constructors"
base_cxxflags="$base_cxxflags -fno-common"
if test "x$m64" = "xyes" ; then
compiler_flags="$compiler_flags -m64"
compiler_flags="$compiler_flags -arch x86_64"
elif test "x$m32" = "xyes" ; then
compiler_flags="$compiler_flags -m32"
compiler_flags="$compiler_flags -arch i386"
else
compiler_flags="$compiler_flags -arch i386"
fi
if test "x$fast_flag" != "xno" ; then if test "x$fast_flag" != "xno" ; then
compiler_flags="$compiler_flags -Os" compiler_flags="$compiler_flags -Os"
base_cxxflags="$base_cxxflags -felide-constructors"
else else
compiler_flags="$compiler_flags -O" compiler_flags="$compiler_flags -O"
fi fi
CC="gcc" set_cc_and_cxx_for_gcc
CXX="gcc"
} }
# #
...@@ -1402,6 +1491,9 @@ m64= ...@@ -1402,6 +1491,9 @@ m64=
datadir= datadir=
commands= commands=
use_autotools= use_autotools=
engine_configs=
ASFLAGS=
LDFLAGS=
set_defaults_based_on_environment set_defaults_based_on_environment
...@@ -1418,7 +1510,13 @@ set -e ...@@ -1418,7 +1510,13 @@ set -e
# This call sets the cpu_arg and check_cpu_args parameters # This call sets the cpu_arg and check_cpu_args parameters
# #
path=`dirname $0` path=`dirname $0`
if test "x$compiler" = "xgcc" ; then
compiler=
fi
. "$path/check-cpu" . "$path/check-cpu"
if test "x$compiler" = "x" ; then
compiler="gcc"
fi
set_cpu_base set_cpu_base
if test "x$?" = "x1" ; then if test "x$?" = "x1" ; then
exit 1 exit 1
...@@ -1446,17 +1544,23 @@ set_icc_special_options ...@@ -1446,17 +1544,23 @@ set_icc_special_options
# including all storage engines except InnoDB, and to use GPL libraries. # including all storage engines except InnoDB, and to use GPL libraries.
# #
set_base_configs set_base_configs
set_base_engines
if test "x$gpl" = "xyes" ; then if test "x$gpl" = "xyes" ; then
version_text="GPL version" version_text="GPL version"
else else
version_text="Commercial version" version_text="Commercial version"
fi fi
if test "x$package" = "xpro" ; then if test "x$package" = "xpro" ; then
set_base_engines
set_innodb_engine
set_pro_package set_pro_package
elif test "x$package" = "xextended" ; then elif test "x$package" = "xextended" ; then
set_base_engines
set_ndb_engine
set_innodb_engine
set_cge_extended_package set_cge_extended_package
elif test "x$package" = "xcge" ; then elif test "x$package" = "xcge" ; then
set_base_engines
set_ndb_engine
set_cge_package set_cge_package
elif test "x$package" = "xclassic" ; then elif test "x$package" = "xclassic" ; then
set_classic_package set_classic_package
...@@ -1490,7 +1594,7 @@ fi ...@@ -1490,7 +1594,7 @@ fi
# proper libtoolize versions, and to determine whether to use ccache. # proper libtoolize versions, and to determine whether to use ccache.
# #
set_make_version set_make_version
set_up_ccache set_ccache_usage
# #
# Set up commands variable from variables prepared for base # Set up commands variable from variables prepared for base
......
...@@ -175,67 +175,69 @@ check_cpu () { ...@@ -175,67 +175,69 @@ check_cpu () {
cc=$CC cc=$CC
fi fi
cc_ver=`$cc --version | sed 1q` if test "x$compiler" = "x" ; then
cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'` cc_ver=`$cc --version | sed 1q`
set -- `echo $cc_verno | tr '.' ' '` cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
cc_major=$1 set -- `echo $cc_verno | tr '.' ' '`
cc_minor=$2 cc_major=$1
cc_patch=$3 cc_minor=$2
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor` cc_patch=$3
cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
case "$cc_ver--$cc_verno" in case "$cc_ver--$cc_verno" in
*GCC*) *GCC*)
# different gcc backends (and versions) have different CPU flags # different gcc backends (and versions) have different CPU flags
case `gcc -dumpmachine` in case `gcc -dumpmachine` in
i?86-* | x86_64-*) i?86-* | x86_64-*)
if test "$cc_comp" -lt 304 ; then if test "$cc_comp" -lt 304 ; then
check_cpu_cflags="-mcpu=${cpu_arg}" check_cpu_cflags="-mcpu=${cpu_arg}"
elif test "$cc_comp" -ge 402 ; then elif test "$cc_comp" -ge 402 ; then
check_cpu_cflags="-mtune=native" check_cpu_cflags="-mtune=native"
else else
check_cpu_cflags="-mtune=${cpu_arg}" check_cpu_cflags="-mtune=${cpu_arg}"
fi fi
;; ;;
ppc-*) ppc-*)
check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}" check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
;; ;;
*) *)
check_cpu_cflags="" check_cpu_cflags=""
return return
;; ;;
esac esac
;; ;;
2.95.*) 2.95.*)
# GCC 2.95 doesn't expose its name in --version output # GCC 2.95 doesn't expose its name in --version output
check_cpu_cflags="-m${cpu_arg}" check_cpu_cflags="-m${cpu_arg}"
;; ;;
*) *)
check_cpu_cflags="" check_cpu_cflags=""
return return
;; ;;
esac esac
# now we check whether the compiler really understands the cpu type
touch __test.c
# now we check whether the compiler really understands the cpu type while [ "$cpu_arg" ] ; do
touch __test.c printf "testing $cpu_arg ... " >&2
# compile check
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if test "x$?" = "x0" ; then
echo ok >&2
break;
fi
echo failed >&2
check_cpu_cflags=""
break;
done
rm __test.*
fi
if test "x$core2" = "xyes" ; then if test "x$core2" = "xyes" ; then
cpu_arg="core2" cpu_arg="core2"
fi fi
while [ "$cpu_arg" ] ; do return 0
printf "testing $cpu_arg ... " >&2
# compile check
eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
if test "x$?" = "x0" ; then
echo ok >&2
break;
fi
echo failed >&2
check_cpu_cflags=""
break;
done
rm __test.*
} }
check_cpu check_cpu
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment