Skip to content

Commit

Permalink
Modify nc-config --libs and --static arguments in support of #3032
Browse files Browse the repository at this point in the history
  • Loading branch information
WardF committed Oct 1, 2024
1 parent 0ad7164 commit 042c0b7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ else
NC_LIBS="$with_netcdf_c_lib"
fi
if test "x$enable_shared" != xyes; then
NC_LIBS="$LDFLAGS $NC_LIBS $LIBS"
NC_LIBS="$LDFLAGS $NC_LIBS"
fi

case "x$target_os" in
Expand Down
12 changes: 9 additions & 3 deletions nc-config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ cc="@CMAKE_C_COMPILER@"
cflags="-I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@"
libs="-L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ @NC_LIBS@"
libsprivate="@LIBS@"
HAS_STATIC=""
HAS_STATIC="FALSE"
PRINTLIBS="FALSE"

has_dap2="@NETCDF_ENABLE_DAP2@"
if [ -z $has_dap2 -o "$has_dap2" = "OFF" ]; then
Expand Down Expand Up @@ -228,6 +229,9 @@ fi

for i in "$@"; do
case $i in
--libs)
PRINTLIBS="TRUE"
;;
--static)
HAS_STATIC="TRUE"
;;
Expand Down Expand Up @@ -349,7 +353,7 @@ while test $# -gt 0; do

--libs)
if [ "x$HAS_STATIC" = "xTRUE" ]; then
echo $libs $libsprivate
echo $LDFLAGS $libs $libsprivate
else
echo $libs
fi
Expand All @@ -369,7 +373,9 @@ while test $# -gt 0; do

;;
--static)

if [ "x$PRINTLIBS" != "xTRUE" ]; then
echo $LDFLAGS $libs $libsprivate
fi
;;

--prefix)
Expand Down
16 changes: 10 additions & 6 deletions nc-config.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ has_multifilters="yes"
has_quantize="@HAS_QUANTIZE@"
has_stdfilters="@STD_FILTERS@"
version="@PACKAGE_NAME@ @PACKAGE_VERSION@"
HAS_STATIC=""

HAS_STATIC="FALSE"
PRINTLIBS="FALSE"
usage()
{
cat <<EOF
Expand Down Expand Up @@ -128,6 +128,9 @@ fi

for i in "$@"; do
case $i in
--libs)
PRINTLIBS="TRUE"
;;
--static)
HAS_STATIC="TRUE"
;;
Expand Down Expand Up @@ -249,10 +252,11 @@ while test $# -gt 0; do
echo $libs
fi
;;
--static)

;;

--static)
if [ "x$PRINTLIBS" != "xTRUE" ]; then
echo $libs $libsprivate
fi
;;
--prefix)
echo "${prefix}"
;;
Expand Down

0 comments on commit 042c0b7

Please sign in to comment.