Use udunits package for units conversions

Created a UDUNITS_LDFLAGS to store an link library path and -luduints2.

refs #231
This commit is contained in:
Alex Lin 2016-05-11 14:43:53 -05:00
parent 01fd86a513
commit 929372e863
7 changed files with 20 additions and 6 deletions

View File

@ -196,18 +196,24 @@ AS_IF([test "$UDUNITS_HOME" = ""],
[
AC_CHECK_HEADER([udunits2.h], [UDUNITS_INCLUDES=],
AC_CHECK_HEADER([udunits2/udunits2.h],[UDUNITS_INCLUDES=-I/usr/include/udunits2],AC_MSG_ERROR([could not find udunits development headers])))
UDUNITS_LDFLAGS=-ludunits2
],
[
AC_CHECK_FILE([$UDUNITS_HOME/include/udunits2.h],
[UDUNITS_INCLUDES=-I$UDUNITS_HOME/include],
[UDUNITS_INCLUDES=-I$UDUNITS_HOME/include
UDUNITS_LDFLAGS=-L$UDUNITS_HOME/lib -ludunits2
],
[AC_CHECK_FILE([$UDUNITS_HOME/lib/udunits2.h],
[UDUNITS_INCLUDES=-I$UDUNITS_HOME/lib],
[UDUNITS_INCLUDES=-I$UDUNITS_HOME/lib
UDUNITS_LDFLAGS=-L$UDUNITS_HOME/lib -ludunits2
],
AC_MSG_ERROR([could not find udunits2]))
]
)
]
)
AC_SUBST([UDUNITS_INCLUDES])
AC_SUBST([UDUNITS_LDFLAGS])
dnl process the other optional command line arguments
AX_HDF5_HOME([])

7
configure vendored
View File

@ -627,6 +627,7 @@ BC635_HOME
TPROCTE_HOME
DMTCP_HOME
HDF5_HOME
UDUNITS_LDFLAGS
UDUNITS_INCLUDES
UDUNITS_HOME
CLANG
@ -5688,6 +5689,7 @@ fi
fi
UDUNITS_LDFLAGS=-ludunits2
else
@ -5710,6 +5712,8 @@ eval ac_res=\$$as_ac_File
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
UDUNITS_INCLUDES=-I$UDUNITS_HOME/include
UDUNITS_LDFLAGS=-L$UDUNITS_HOME/lib -ludunits2
else
as_ac_File=`$as_echo "ac_cv_file_$UDUNITS_HOME/lib/udunits2.h" | $as_tr_sh`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $UDUNITS_HOME/lib/udunits2.h" >&5
@ -5730,6 +5734,8 @@ eval ac_res=\$$as_ac_File
$as_echo "$ac_res" >&6; }
if eval test \"x\$"$as_ac_File"\" = x"yes"; then :
UDUNITS_INCLUDES=-I$UDUNITS_HOME/lib
UDUNITS_LDFLAGS=-L$UDUNITS_HOME/lib -ludunits2
else
as_fn_error $? "could not find udunits2" "$LINENO" 5
fi
@ -5745,6 +5751,7 @@ fi
# Check whether --with-hdf5 was given.
if test "${with_hdf5+set}" = set; then :
withval=$with_hdf5; HDF5_HOME="$withval"

View File

@ -39,7 +39,7 @@ export TRICK_SWIG_EXCLUDE
export TRICK_EXT_LIB_DIRS
export TRICK_GTE_EXT
export TRICK_HOST_CPU := $(shell export TRICK_CC=$(TRICK_CC) && $(TRICK_HOME)/bin/trick-gte TRICK_HOST_CPU)
export TRICK_EXEC_LINK_LIBS = ${PTHREAD_LIBS} $(PYTHON_LIB) $(PLATFORM_LIBS) -lm -ldl -lz -ludunits2
export TRICK_EXEC_LINK_LIBS = ${PTHREAD_LIBS} $(PYTHON_LIB) $(UDUNITS_LDFLAGS) $(PLATFORM_LIBS) -lm -ldl -lz
export TRICK_LIBS = ${RPATH} -L${TRICK_LIB_DIR} -ltrick -ltrick_pyip -ltrick_comm -ltrick_math -ltrick_units -ltrick_mm
export TRICK_SYSTEM_CFLAGS
export TRICK_SYSTEM_CXXFLAGS

View File

@ -20,6 +20,7 @@ LLVM_HOME = @LLVM_HOME@
MOTIF_HOME = @MOTIF_HOME@
UDUNITS_INCLUDES = @UDUNITS_INCLUDES@
UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@
HDF5 = @HDF5_HOME@
DMTCP = @DMTCP_HOME@

View File

@ -8,7 +8,7 @@ CXXFLAGS := -g -I$(shell $(LLVM_HOME)/bin/llvm-config --includedir) -D__STDC_CON
CLANG_MINOR_GTEQ5 := $(shell expr `$(LLVM_HOME)/bin/llvm-config --version | cut -f2 -d. ` \>= 5 )
LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/llvm-config --ldflags) -ludunits2
LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/llvm-config --ldflags) $(UDUNITS_LDFLAGS)
OBJ_DIR := object_$(TRICK_HOST_CPU)

View File

@ -35,7 +35,7 @@ DPX_LIBS = -L${DPX_DIR}/lib_${TRICK_HOST_CPU} -lDPC -lDPM
FERMI_WARE_LIB = $(TRICK_HOME)/trick_source/data_products/fermi-ware/object_${TRICK_HOST_CPU}/libfermi.a
#HDF5_LIB is assigned in Makefile.common
ALL_LIBS = $(DPX_LIBS) $(FERMI_WARE_LIB) ${DP_LIBS} ${TRICK_UNIT_LIBS} $(LIBXML) ${HDF5_LIB} -ldl $(FERMI_WARE_DIR) -ludunits2
ALL_LIBS = $(DPX_LIBS) $(FERMI_WARE_LIB) ${DP_LIBS} ${TRICK_UNIT_LIBS} $(LIBXML) ${HDF5_LIB} -ldl $(FERMI_WARE_DIR) $(UDUNITS_LDFLAGS)
#############################################################################
## MODEL TARGETS ##

View File

@ -40,7 +40,7 @@ DP_LIBS = -L../../../lib_${TRICK_HOST_CPU} -llog -lvar -leqparse -L${TRI
MODEL_LIBS = -L${DPX_DIR}/lib_${TRICK_HOST_CPU} -lDPM
CONTROLLER_LIBS = -L${DPX_DIR}/lib_${TRICK_HOST_CPU} -lDPC
ALL_LIBS = $(CONTROLLER_LIBS) $(MODEL_LIBS) ${DP_LIBS} ${TRICK_UNIT_LIBS} ${HDF5_LIB} -ldl -ludunits2
ALL_LIBS = $(CONTROLLER_LIBS) $(MODEL_LIBS) ${DP_LIBS} ${TRICK_UNIT_LIBS} ${HDF5_LIB} -ldl $(UDUNITS_LDFLAGS)
#############################################################################
## MODEL TARGETS ##