From a8ec014d131a71ec35a527e9bec052c548c4cf87 Mon Sep 17 00:00:00 2001 From: Howard Soh Date: Tue, 10 Oct 2023 17:01:46 -0600 Subject: [PATCH] #2574 Added --enable-ugrid --- INSTALL | 4 +++ Makefile.in | 1 + config.h.in | 3 +++ configure | 69 ++++++++++++++++++++++++++++++++++++++++------------ configure.ac | 41 +++++++++++++++++++++---------- 5 files changed, 90 insertions(+), 28 deletions(-) diff --git a/INSTALL b/INSTALL index c408f5d504..c2a1d3d893 100644 --- a/INSTALL +++ b/INSTALL @@ -179,6 +179,10 @@ sub-directory, or the MET Online Tutorial: Enable compilation of lidar2nc Requires $MET_HDF + --enable-ugrid + Enable compilation of unstructured grid + Requires $MET_ATLAS, $MET_ECKIT, and $MET_UGRID_LD + To configure MET to install all of the available tools in the "bin" subdirectory of your current directory, you would use the following command: diff --git a/Makefile.in b/Makefile.in index 45633a0f95..692b81fde9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -302,6 +302,7 @@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +UGRID_LIBS = @UGRID_LIBS@ VERSION = @VERSION@ YACC = @YACC@ YFLAGS = @YFLAGS@ diff --git a/config.h.in b/config.h.in index a858a69152..c686129b5e 100644 --- a/config.h.in +++ b/config.h.in @@ -84,6 +84,9 @@ /* "build tc_utils" */ #undef ENABLE_TC_UTILS +/* "build unstructured grid with Atlas and eckit libraries" */ +#undef ENABLE_UGRID + /* "build wavelet_stat" */ #undef ENABLE_WAVELET_STAT diff --git a/configure b/configure index 904c15c4f1..a96f888112 100755 --- a/configure +++ b/configure @@ -656,6 +656,9 @@ YACC FC_LIBS ENABLE_DEVELOPMENT_FALSE ENABLE_DEVELOPMENT_TRUE +UGRID_LIBS +ENABLE_UGRID_FALSE +ENABLE_UGRID_TRUE PYTHON_LIBS ENABLE_PYTHON_FALSE ENABLE_PYTHON_TRUE @@ -888,6 +891,7 @@ enable_tc_utils enable_gsi_tools enable_grib2 enable_python +enable_ugrid ' ac_precious_vars='build_alias host_alias @@ -1620,6 +1624,8 @@ Optional Features: --disable-gsi_tools Disable compilation of gsi_tools --enable-grib2 Enable compilation of utilities using GRIB2 --enable-python Enable python embedding + --enable-ugrid Enable unstructured grid with Atlas and eckit + libraries Some influential environment variables: CC C compiler command @@ -1639,16 +1645,16 @@ Some influential environment variables: include files are not under the same main proj directory. If used, MET_PROJINC must also be defined and MET_PROJ will be ignored. - MET_ATLAS Where atlas lib and include subdirectories are located. If they + MET_ATLAS Where Atlas lib and include subdirectories are located. If they are installed in /usr/local, you don't have to specify them. MET_ATLASINC - Where atlas include files are located. Use if the libraries and - include files are not under the same main atlas directory. If + Where Atlas include files are located. Use if the libraries and + include files are not under the same main Atlas directory. If used, MET_ATLASLIB must also be defined and MET_ATLAS will be ignored. MET_ATLASLIB - Where atlas libraries are located. Use if the libraries and - include files are not under the same main atlas directory. If + Where Atlas libraries are located. Use if the libraries and + include files are not under the same main Atlas directory. If used, MET_ATLASINC must also be defined and MET_ATLAS will be ignored. MET_ECKIT Where eckit lib and include subdirectories are located. If they @@ -4624,11 +4630,6 @@ fi # AC_SUBST command line variables. -if (test -n "$MET_ATLASLIB"); then - CPPFLAGS="${CPPFLAGS} -I${MET_ATLASINC}" - LDFLAGS="${LDFLAGS} -L${MET_ATLASLIB}" -fi - # # Look for the Eckit library. # @@ -4656,11 +4657,6 @@ fi # AC_SUBST command line variables. -if (test -n "$MET_ECKITLIB"); then - CPPFLAGS="${CPPFLAGS} -I${MET_ECKITINC}" - LDFLAGS="${LDFLAGS} -L${MET_ECKITLIB}" -fi - # # Look for the NetCDF library. # @@ -6108,6 +6104,45 @@ $as_echo "$as_me: python embedding will not be compiled" >&6;} fi +# Unstructure grid with ECMF libraries (Atlas/ecKit) + +# Check whether --enable-ugrid was given. +if test "${enable_ugrid+set}" = set; then : + enableval=$enable_ugrid; case "${enableval}" in + yes | no ) ENABLE_UGRID="${enableval}" ;; + *) as_fn_error $? "bad value ${enableval} for --enable-ugrid" "$LINENO" 5 ;; + esac +else + ENABLE_UGRID="no" + +fi + + + if test "x$ENABLE_UGRID" = "xyes"; then + ENABLE_UGRID_TRUE= + ENABLE_UGRID_FALSE='#' +else + ENABLE_UGRID_TRUE='#' + ENABLE_UGRID_FALSE= +fi + + +if test "x$ENABLE_UGRID" = "xyes"; then + +$as_echo "#define ENABLE_UGRID /**/" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: unstructured grid will be compiled" >&5 +$as_echo "$as_me: unstructured grid will be compiled" >&6;} + CPPFLAGS="${CPPFLAGS} -I${MET_ATLASINC} -I${MET_ECKITINC} -DWITH_UGRID" + LDFLAGS="${LDFLAGS} -L${MET_ATLASLIB} -L${MET_ECKITLIB} -Wl,-rpath,${MET_ATLASLIB}:${MET_ECKITLIB}" + UGRID_LIBS="-lvx_data2d_ugrid -latlas -leckit -leckit_mpi -leckit_geometry" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: unstructured grid will not be compiled" >&5 +$as_echo "$as_me: unstructured grid will not be compiled" >&6;} + UGRID_LIBS= +fi + + ######################################################################## # Check for the MET_DEVELOPMENT environment variable @@ -9228,6 +9263,10 @@ if test -z "${ENABLE_PYTHON_TRUE}" && test -z "${ENABLE_PYTHON_FALSE}"; then as_fn_error $? "conditional \"ENABLE_PYTHON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_UGRID_TRUE}" && test -z "${ENABLE_UGRID_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_UGRID\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ENABLE_DEVELOPMENT_TRUE}" && test -z "${ENABLE_DEVELOPMENT_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DEVELOPMENT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 7d5d7fef6c..197de3c971 100644 --- a/configure.ac +++ b/configure.ac @@ -53,9 +53,9 @@ fi # Configure the variables. The help text will appear if the user uses "configure --help". -AC_ARG_VAR([MET_ATLAS], [Where atlas lib and include subdirectories are located. If they are installed in /usr/local, you don't have to specify them.]) -AC_ARG_VAR([MET_ATLASINC], [Where atlas include files are located. Use if the libraries and include files are not under the same main atlas directory. If used, MET_ATLASLIB must also be defined and MET_ATLAS will be ignored.]) -AC_ARG_VAR([MET_ATLASLIB], [Where atlas libraries are located. Use if the libraries and include files are not under the same main atlas directory. If used, MET_ATLASINC must also be defined and MET_ATLAS will be ignored.]) +AC_ARG_VAR([MET_ATLAS], [Where Atlas lib and include subdirectories are located. If they are installed in /usr/local, you don't have to specify them.]) +AC_ARG_VAR([MET_ATLASINC], [Where Atlas include files are located. Use if the libraries and include files are not under the same main Atlas directory. If used, MET_ATLASLIB must also be defined and MET_ATLAS will be ignored.]) +AC_ARG_VAR([MET_ATLASLIB], [Where Atlas libraries are located. Use if the libraries and include files are not under the same main Atlas directory. If used, MET_ATLASINC must also be defined and MET_ATLAS will be ignored.]) # Ensure that both or neither are specified. @@ -74,11 +74,6 @@ fi # AC_SUBST command line variables. -if (test -n "$MET_ATLASLIB"); then - CPPFLAGS="${CPPFLAGS} -I${MET_ATLASINC}" - LDFLAGS="${LDFLAGS} -L${MET_ATLASLIB}" -fi - # # Look for the Eckit library. # @@ -106,11 +101,6 @@ fi # AC_SUBST command line variables. -if (test -n "$MET_ECKITLIB"); then - CPPFLAGS="${CPPFLAGS} -I${MET_ECKITINC}" - LDFLAGS="${LDFLAGS} -L${MET_ECKITLIB}" -fi - # # Look for the NetCDF library. # @@ -1098,6 +1088,31 @@ else fi AC_SUBST([PYTHON_LIBS]) +# Unstructure grid with ECMF libraries (Atlas/ecKit) + +AC_ARG_ENABLE(ugrid, + [AS_HELP_STRING([--enable-ugrid], [Enable unstructured grid with Atlas and eckit libraries])], + [case "${enableval}" in + yes | no ) ENABLE_UGRID="${enableval}" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-ugrid) ;; + esac], + [ENABLE_UGRID="no"] +) + +AM_CONDITIONAL([ENABLE_UGRID], [test "x$ENABLE_UGRID" = "xyes"]) + +if test "x$ENABLE_UGRID" = "xyes"; then + AC_DEFINE([ENABLE_UGRID], [], ["build unstructured grid with Atlas and eckit libraries"]) + AC_MSG_NOTICE([unstructured grid will be compiled]) + CPPFLAGS="${CPPFLAGS} -I${MET_ATLASINC} -I${MET_ECKITINC} -DWITH_UGRID" + LDFLAGS="${LDFLAGS} -L${MET_ATLASLIB} -L${MET_ECKITLIB} -Wl,-rpath,${MET_ATLASLIB}:${MET_ECKITLIB}" + UGRID_LIBS="-lvx_data2d_ugrid -latlas -leckit -leckit_mpi -leckit_geometry" +else + AC_MSG_NOTICE([unstructured grid will not be compiled]) + UGRID_LIBS= +fi +AC_SUBST([UGRID_LIBS]) + ######################################################################## # Check for the MET_DEVELOPMENT environment variable