#!/bin/sh # Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; version 2 # of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1335 USA ######################################################################## get_key_value() { echo "$1" | sed 's/^--[a-zA-Z_-]*=//' } usage() { cat < /dev/null 2>&1 then make=gmake else make=make fi if test -z "$CC" ; then CC=gcc fi if test -z "$CXX" ; then CXX=g++ fi # # Set -Wuninitialized to debug flags for gcc 4.4 and above # because it is allowed there without -O # if test `$CC -v 2>&1 | tail -1 | sed 's/ .*$//'` = 'gcc' ; then GCCVERSION=`$CC -v 2>&1 | tail -1 | \ sed 's/^[a-zA-Z][a-zA-Z]* [a-zA-Z][a-zA-Z]* //' | sed 's/ .*$//'` GCCV1=`echo $GCCVERSION | sed 's/\..*$//'` GCCV2=`echo $GCCVERSION | sed 's/[0-9][0-9]*\.//'|sed 's/\..*$//'` if test '(' "$GCCV1" -gt '4' ')' -o \ '(' '(' "$GCCV1" -eq '4' ')' -a '(' "$GCCV2" -ge '4' ')' ')' then debug_cflags="$debug_cflags -DFORCE_INIT_OF_VARS -Wuninitialized" fi if (test '(' "$GCCV1" -gt '6' ')') then c_warnings="$c_warnings -Wimplicit-fallthrough=2" cxx_warnings="$cxx_warnings -Wimplicit-fallthrough=2" fi fi # If ccache (a compiler cache which reduces build time) # (http://samba.org/ccache) is installed, use it. # We use 'grep' and hope 'grep' will work as expected # (returns 0 if finds lines) # As cmake doesn't like CC and CXX with a space, use symlinks from # /usr/lib64/ccache if they exits. if ccache -V > /dev/null 2>&1 && test "$CCACHE_DISABLE" != "1" && test "$CC" = "gcc" then if test -x /usr/lib64/ccache/gcc then CC=/usr/lib64/ccache/gcc fi if test -x /usr/lib64/ccache/g++ then CXX=/usr/lib64/ccache/g++ fi fi # gcov # The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the # code with profiling information used by gcov. # The -DDISABLE_TAO_ASM is needed to avoid build failures in Yassl. # The -DHAVE_gcov enables code to write out coverage info even when crashing. gcov_compile_flags="-fprofile-arcs -ftest-coverage" gcov_compile_flags="$gcov_compile_flags -DDISABLE_TAO_ASM" gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov" # # The following plugins doesn't work on 32 bit systems disable_64_bit_plugins="--without-plugin-rocksdb" # GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well # as on the compiler command line), and this requires setting LDFLAGS for BDB. gcov_link_flags="-fprofile-arcs -ftest-coverage -lgcov" gcov_configs="--with-gcov" # gprof gprof_compile_flags="-O2" # Rest of the flags are set in CmakeFile.txt gprof_link_flags="--disable-shared $static_link" disable_gprof_plugins="--with-zlib-dir=bundled --without-plugin-oqgraph --without-plugin-mroonga --with-gprof" disable_asan_plugins="--without-plugin-rocksdb"