Get C++ flags from ncxx{4}-config

This commit is contained in:
Peter Hill 2016-08-17 14:45:40 +01:00
parent ce15b1cc2d
commit 6c028fbf5c
2 changed files with 70 additions and 25 deletions

View File

@ -95,9 +95,13 @@ has_cxx="no"
has_cxx4="no"
if type -p ncxx4-config > /dev/null 2>&1; then
cxx4=`ncxx4-config --cxx`
cxx4flags=`ncxx4-config --cflags`
cxx4libs=`ncxx4-config --libs`
has_cxx4="yes"
elif type -p ncxx-config > /dev/null 2>&1; then
cxx=`ncxx-config --cxx`
cxxflags=`ncxx-config --cflags`
cxxlibs=`ncxx-config --libs`
has_cxx="yes"
fi
@ -112,6 +116,8 @@ Available values for OPTION include:
--all display all options
--cc C compiler
--cflags pre-processor and compiler flags
--has-c++ whether C++ API is installed
--has-c++4 whether netCDF-4 C++ API is installed
--has-fortran whether Fortran API is installed
--has-dap whether OPeNDAP is enabled in this build
--has-nc2 whether NetCDF-2 API is enabled
@ -128,19 +134,17 @@ Available values for OPTION include:
--version Library version
EOF
# When supported by ncxx4-config and ncxx-config, add
# --cxxflags flags needed to compile a netCDF-4 C++ program
# --cxxlibs libraries needed to link a netCDF-4 C++ program
if type -p ncxx4-config > /dev/null 2>&1; then
cat <<EOF
--cxx4 C++ compiler for netCDF-4 C++ library
--has-c++4 whether netCDF-4 C++ API is installed
--cxx4 C++ compiler for netCDF-4 C++ library
--cxx4flags flags needed to compile a C++ program
--cxx4libs libraries needed to link a C++ program
EOF
elif type -p ncxx-config > /dev/null 2>&1; then
cat <<EOF
--cxx C++ compiler
--has-c++ whether C++ API is installed
--cxxflags flags needed to compile a C++ program
--cxxlibs libraries needed to link a C++ program
EOF
fi
if [ -f "$nfconf" ]; then
@ -167,10 +171,17 @@ all()
echo " --has-c++ -> $has_cxx"
echo " --cxx -> $cxx"
# echo " --cxxflags -> $cxxflags"
# echo " --cxxlibs -> $cxxlibs"
if type -p ncxx-config > /dev/null 2>&1; then
echo " --cxxflags -> $cxxflags"
echo " --cxxlibs -> $cxxlibs"
fi
echo
echo " --has-c++4 -> $has_cxx4"
echo " --cxx4 -> $cxx4"
if type -p ncxx4-config > /dev/null 2>&1; then
echo " --cxx4flags -> $cxx4flags"
echo " --cxx4libs -> $cxx4libs"
fi
echo
echo " --has-fortran-> $has_fortran"
@ -289,6 +300,14 @@ while test $# -gt 0; do
echo $cxx
;;
--cxxflags)
echo $cxxflags
;;
--cxxlibs)
echo $cxxlibs
;;
--has-c++4)
echo $has_cxx4
;;
@ -297,13 +316,13 @@ while test $# -gt 0; do
echo $cxx4
;;
# --cxxflags)
# echo $cxxflags
# ;;
#
# --cxxlibs)
# echo $cxxlibs
# ;;
--cxx4flags)
echo $cxx4flags
;;
--cxx4libs)
echo $cxx4libs
;;
--has-fortran)
echo $has_fortran

View File

@ -42,9 +42,13 @@ has_cxx="no"
has_cxx4="no"
if type -p ncxx4-config > /dev/null 2>&1; then
cxx4=`ncxx4-config --cxx`
cxx4flags=`ncxx4-config --cflags`
cxx4libs=`ncxx4-config --libs`
has_cxx4="yes"
elif type -p ncxx-config > /dev/null 2>&1; then
cxx=`ncxx-config --cxx`
cxxflags=`ncxx-config --cflags`
cxxlibs=`ncxx-config --libs`
has_cxx="yes"
fi
@ -59,6 +63,8 @@ Available values for OPTION include:
--all display all options
--cc C compiler
--cflags pre-processor and compiler flags
--has-c++ whether C++ API is installed
--has-c++4 whether netCDF-4 C++ API is installed
--has-fortran whether Fortran API is installed
--has-dap whether OPeNDAP is enabled in this build
--has-nc2 whether NetCDF-2 API is enabled
@ -75,19 +81,17 @@ Available values for OPTION include:
--version Library version
EOF
# When supported by ncxx4-config and ncxx-config, add
# --cxxflags flags needed to compile a netCDF-4 C++ program
# --cxxlibs libraries needed to link a netCDF-4 C++ program
if type -p ncxx4-config > /dev/null 2>&1; then
cat <<EOF
--cxx4 C++ compiler for netCDF-4 C++ library
--has-c++4 whether netCDF-4 C++ API is installed
--cxx4 C++ compiler for netCDF-4 C++ library
--cxx4flags flags needed to compile a C++ program
--cxx4libs libraries needed to link a C++ program
EOF
elif type -p ncxx-config > /dev/null 2>&1; then
cat <<EOF
--cxx C++ compiler
--has-c++ whether C++ API is installed
--cxxflags flags needed to compile a C++ program
--cxxlibs libraries needed to link a C++ program
EOF
fi
if [ -f "$nfconf" ]; then
@ -114,10 +118,17 @@ all()
echo " --has-c++ -> $has_cxx"
echo " --cxx -> $cxx"
# echo " --cxxflags -> $cxxflags"
# echo " --cxxlibs -> $cxxlibs"
if type -p ncxx-config > /dev/null 2>&1; then
echo " --cxxflags -> $cxxflags"
echo " --cxxlibs -> $cxxlibs"
fi
echo
echo " --has-c++4 -> $has_cxx4"
echo " --cxx4 -> $cxx4"
if type -p ncxx4-config > /dev/null 2>&1; then
echo " --cxx4flags -> $cxx4flags"
echo " --cxx4libs -> $cxx4libs"
fi
echo
echo " --has-fortran-> $has_fortran"
@ -236,6 +247,14 @@ while test $# -gt 0; do
echo $cxx
;;
--cxxflags)
echo $cxxflags
;;
--cxxlibs)
echo $cxxlibs
;;
--has-c++4)
echo $has_cxx4
;;
@ -244,6 +263,13 @@ while test $# -gt 0; do
echo $cxx4
;;
--cxx4flags)
echo $cxx4flags
;;
--cxx4libs)
echo $cxx4libs
;;
--has-fortran)
echo $has_fortran