diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2013-04-22 22:24:37 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2013-04-22 22:24:37 (GMT) |
commit | 82869120a9285025f4aee7f1839c24730885cde1 (patch) | |
tree | 95876ae1517ad5c4d81ccdd07479357f1579b3d2 /config | |
parent | 0421089a1326f3f0080806b3eca86f60be55d509 (diff) | |
download | hdf5-82869120a9285025f4aee7f1839c24730885cde1.zip hdf5-82869120a9285025f4aee7f1839c24730885cde1.tar.gz hdf5-82869120a9285025f4aee7f1839c24730885cde1.tar.bz2 |
[svn-r23610] Improvement: DFFV-8245
Use Clang as the compiler for the Mac platform.
Changed all Mac to use clang/clang++ as the default C and CXX compilers if
not provided by the user. Still use gfortran as the default fortran
compiler since Apple does not provide any fortran compiler.
HDFFV-8245: bug fix. Snow Leopard (darwin 10.X) does not have clang++.
Reversed it to use gcc/g++ as the default C and CXX compilers for Darwin 10.X
systems.
Tested: h5committest plus duck (darwin 11), wren (darwin 12) and fred
(darwin 10).
Diffstat (limited to 'config')
-rw-r--r-- | config/apple | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/config/apple b/config/apple index c5c0a19..ac93ea5 100644 --- a/config/apple +++ b/config/apple @@ -20,17 +20,25 @@ # # See BlankForm in this directory for details. -# The default compiler is `gcc' +# The default compiler is `clang'. +# No support for OS older than darwin 10.X. if test "X-" = "X-$CC"; then - CC=gcc - CC_BASENAME=gcc + case "$host_os" in + darwin10.*) # Snow Leopard. Use gcc/g++ because clang++ is not available. + CC=gcc + CC_BASENAME=gcc + ;; + *) + CC=clang + CC_BASENAME=clang + ;; + esac fi # Figure out compiler flags . $srcdir/config/gnu-flags # temp patch: if GCC 4.2.1 is used in Lion or Mountain Lion systems, do not # use -O option as it causes failures in test/dt_arith. -#echo host_os=$host_os case "$host_os" in darwin1[12].*) # lion & mountain lion #echo cc_vendor=$cc_vendor'-'cc_version=$cc_version @@ -48,6 +56,11 @@ esac . $srcdir/config/intel-flags if test "X-" = "X-$FC"; then case $CC_BASENAME in + clang) + # clang has no fortran compiler. Use gfortran. + FC=gfortran + FC_BASENAME=gfortran + ;; gcc*) FC=gfortran FC_BASENAME=gfortran @@ -59,8 +72,30 @@ if test "X-" = "X-$FC"; then esac fi +if test "X-" = "X-$CXX"; then + case $CC_BASENAME in + clang) + CXX=clang++ + CXX_BASENAME=clang++ + ;; + gcc) + CXX=g++ + CXX_BASENAME=g++ + ;; + icc) + CXX=icpc + CXX_BASENAME=icpc + ;; + esac +fi + # compiler version strings case $CC in + clang) + cc_version_info=`$CC $CFLAGS $H5_CFLAGS --version 2>&1 |\ + grep 'Apple' | sed 's/(.*//'` + ;; + *gcc*) cc_version_info=`$CC $CFLAGS $H5_CFLAGS --version 2>&1 | grep -v 'PathScale' |\ grep 'GCC' | sed 's/.*\((GCC) [-a-z0-9\. ]*.*\)/\1/'` @@ -97,6 +132,11 @@ esac # get c++ version info case $CXX in + clang++) + cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ + grep 'Apple' | sed 's/(.*//'` + ;; + *g++*) cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\ grep 'GCC' | sed 's/.*\((GCC) [-a-z0-9\. ]*.*\)/\1/'` |