From a222922d7bd5b0a7452d0075d911f646b82571dd Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Wed, 25 Sep 2024 12:15:55 -0500 Subject: [PATCH] Add legacy macro option to cmake build system. Changed netcdf_plugin_install_dir to use /usr/local/hdf5/lib/plugin by default unless a 'prefix' is specified by the user, in which case it becomes prefix/hdf5/lib/plugin. This can still be overridden with the build flags appropriate to the build system. --- CMakeLists.txt | 19 ++++++++++++------- configure.ac | 11 +++++++++-- libnetcdf.settings.in | 1 + 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ff12b6957..d2d99b501c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -667,14 +667,18 @@ if(ENABLE_PLUGIN_INSTALL) set(NETCDF_PLUGIN_INSTALL_DIR "$ENV{HDF5_PLUGIN_PATH}") else() if(ISMSVC OR ISMINGW) - set(NETCDF_PLUGIN_INSTALL_DIR "$ENV{ALLUSERSPROFILE}\\hdf5\\lib\\plugin") - else() - set(NETCDF_PLUGIN_INSTALL_DIR "/usr/local/hdf5/lib/plugin") - endif() - endif() - message(STATUS "Defaulting to -DPLUGIN_INSTALL_DIR=${NETCDF_PLUGIN_INSTALL_DIR}") + set(NETCDF_PLUGIN_INSTALL_DIR "$ENV{ALLUSERSPROFILE}\\hdf5\\lib\\plugin") + else() + if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(NETCDF_PLUGIN_INSTALL_DIR "/usr/local/hdf5/lib/plugin") + else() + set(NETCDF_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/hdf5/lib/plugin") + endif(NOT DEFINED CMAKE_INSTALL_PREFIX) + endif(ISMSVC OR ISMINGW) + endif(DEFINED ENV{HDF5_PLUGIN_PATH}) + message(STATUS "Defaulting to -DPLUGIN_INSTALL_DIR=${NETCDF_PLUGIN_INSTALL_DIR}") endif() -endif() +endif(ENABLE_PLUGIN_INSTALL) if(ENABLE_PLUGIN_INSTALL) # Use the lowest priority dir in the path @@ -1699,6 +1703,7 @@ is_enabled(NETCDF_ENABLE_PARALLEL4 HAS_PARALLEL4) is_enabled(NETCDF_ENABLE_DAP HAS_DAP) is_enabled(NETCDF_ENABLE_DAP2 HAS_DAP2) is_enabled(NETCDF_ENABLE_DAP4 HAS_DAP4) +is_enabled(NETCDF_ENABLE_LEGACY_MACROS HAS_LEGACY_MACROS) is_enabled(NETCDF_ENABLE_BYTERANGE HAS_BYTERANGE) is_enabled(NETCDF_ENABLE_DISKLESS HAS_DISKLESS) is_enabled(USE_MMAP HAS_MMAP) diff --git a/configure.ac b/configure.ac index fba3fe5364..4894430924 100644 --- a/configure.ac +++ b/configure.ac @@ -1943,6 +1943,7 @@ AM_CONDITIONAL(USE_DAP, [test "x$enable_dap" = xyes]) # Alias # Provide protocol specific flags AM_CONDITIONAL(NETCDF_ENABLE_DAP, [test "x$enable_dap" = xyes]) AM_CONDITIONAL(NETCDF_ENABLE_DAP4, [test "x$enable_dap4" = xyes]) +AM_CONDITIONAL(NETCDF_ENABLE_LEGACY_MACROS, [test "x$netcdf_enable_legacy_macros" = xyes]) AM_CONDITIONAL(USE_STRICT_NULL_BYTE_HEADER_PADDING, [test x$enable_strict_null_byte_header_padding = xyes]) AM_CONDITIONAL(NETCDF_ENABLE_CDF5, [test "x$enable_cdf5" = xyes]) AM_CONDITIONAL(NETCDF_ENABLE_DAP_REMOTE_TESTS, [test "x$enable_dap_remote_tests" = xyes]) @@ -2061,6 +2062,7 @@ AC_SUBST(NC_LIBS,[$NC_LIBS]) AC_SUBST(HAS_DAP,[$enable_dap]) AC_SUBST(HAS_DAP2,[$enable_dap]) AC_SUBST(HAS_DAP4,[$enable_dap4]) +AC_SUBST(HAS_LEGACY_MACROS,[$enable_legacy_macros]) AC_SUBST(HAS_NC2,[$nc_build_v2]) AC_SUBST(HAS_CDF5,[$enable_cdf5]) AC_SUBST(HAS_HDF4,[$enable_hdf4]) @@ -2167,8 +2169,13 @@ elif test "x$with_plugin_dir" = xyes ; then # --with-plugin-dir, no argument if test "x$ISMSVC" = xyes || test "x$ISMINGW" = xyes; then PLUGIN_PATH="${ALLUSERSPROFILE}\\hdfd5\\lib\\plugin" else - PLUGIN_PATH="/usr/local/hdf5/lib/plugin" - fi + if test "x${prefix}" = x ; then + PLUGIN_PATH="/usr/local/hdf5/lib/plugin" + else + PLUGIN_PATH="${prefix}/hdf5/lib/plugin" + fi + + fi fi # Use the lowest priority dir in the path if test "x$ISMSVC" = xyes || test "x$ISMINGW" = xyes; then diff --git a/libnetcdf.settings.in b/libnetcdf.settings.in index 4cf899a47b..4aac31c1c9 100644 --- a/libnetcdf.settings.in +++ b/libnetcdf.settings.in @@ -24,6 +24,7 @@ Shared Library: @enable_shared@ Static Library: @enable_static@ Extra libraries: @LIBS@ XML Parser: @XMLPARSER@ +Legacy Macros: @HAS_LEGACY_MACROS@ # Features --------