Commit 7c3a88ef authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added configure option for udunits2

parent 74430008
......@@ -240,6 +240,8 @@ SZLIB_INCLUDE = @SZLIB_INCLUDE@
SZLIB_LIBS = @SZLIB_LIBS@
THREADS_INCLUDE = @THREADS_INCLUDE@
THREADS_LIBS = @THREADS_LIBS@
UDUNITS_INCLUDE = @UDUNITS_INCLUDE@
UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@
USER_NAME = @USER_NAME@
VERSION = @VERSION@
XML2_LIBS = @XML2_LIBS@
......
......@@ -40,6 +40,7 @@ case "${HOSTNAME}" in
--with-hdf5=$HOME/local \
--with-szlib=$HOME/local \
--with-proj=/opt/local \
--with-udunits2=/opt/local \
--with-magics=/Users/m214003/local/magics-2.14.9 \
CC=gcc CFLAGS="-g -pipe -D_REENTRANT -Wall -W -Wfloat-equal -pedantic -O3 -fopenmp -DHAVE_LIBXML -I/usr/include/libxml2 -I/opt/include" \
LIBS="-L/usr/lib -lxml2 -L/opt/local/lib -lopenjpeg"
......
......@@ -653,6 +653,8 @@ XML2_LIBS
MAGICS_INCLUDE
MAGICS_ROOT
MAGICS_LIBS
UDUNITS_INCLUDE
UDUNITS_LDFLAGS
PROJ_INCLUDE
PROJ_LDFLAGS
ENABLE_IEG
......@@ -824,6 +826,7 @@ enable_service
enable_extra
enable_ieg
with_proj
with_udunits2
with_magics
with_libxml2
enable_cdi_lib
......@@ -1511,6 +1514,8 @@ Optional Packages:
--with-jasper-root
--with-proj=<directory> Specify location of PROJ library for cartographic
projections.
--with-udunits2=<directory>
Specify location of UDUNITS2 library.
--with-magics=<yes|no|directory>
location of magics library (lib and include subdirs)
--with-libxml2=<yes|no|directory>
......@@ -18502,6 +18507,188 @@ $as_echo_n "checking for the PROJ library... " >&6; }
$as_echo "suppressed" >&6; }
fi
 
# ----------------------------------------------------------------------
# Link application with UDUNITS2 library
# Check whether --with-udunits2 was given.
if test "${with_udunits2+set}" = set; then :
withval=$with_udunits2; case "$with_udunits2" in #(
no) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for udunits2 library" >&5
$as_echo_n "checking for udunits2 library... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
$as_echo "suppressed" >&6; } ;; #(
yes) :
for ac_header in udunits2.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "udunits2.h" "ac_cv_header_udunits2_h" "$ac_includes_default"
if test "x$ac_cv_header_udunits2_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UDUNITS2_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
$as_echo_n "checking for library containing ut_parse... " >&6; }
if ${ac_cv_search_ut_parse+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ut_parse ();
int
main ()
{
return ut_parse ();
;
return 0;
}
_ACEOF
for ac_lib in '' udunits2; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_ut_parse=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_ut_parse+:} false; then :
break
fi
done
if ${ac_cv_search_ut_parse+:} false; then :
else
ac_cv_search_ut_parse=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ut_parse" >&5
$as_echo "$ac_cv_search_ut_parse" >&6; }
ac_res=$ac_cv_search_ut_parse
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_LIBUDUNITS2 1" >>confdefs.h
else
as_fn_error $? "Could not link to udunits2 library!" "$LINENO" 5
fi
UDUNITS_LDFLAGS=" -ludunits2"
UDUNITS_INCLUDE=""
;; #(
*) :
UDUNITS_ROOT=$with_udunits2
if test -d "$UDUNITS_ROOT"; then :
LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include/udunits2"
for ac_header in udunits2.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "udunits2.h" "ac_cv_header_udunits2_h" "$ac_includes_default"
if test "x$ac_cv_header_udunits2_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_UDUNITS2_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing ut_parse" >&5
$as_echo_n "checking for library containing ut_parse... " >&6; }
if ${ac_cv_search_ut_parse+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ut_parse ();
int
main ()
{
return ut_parse ();
;
return 0;
}
_ACEOF
for ac_lib in '' udunits2; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_ut_parse=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_ut_parse+:} false; then :
break
fi
done
if ${ac_cv_search_ut_parse+:} false; then :
else
ac_cv_search_ut_parse=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_ut_parse" >&5
$as_echo "$ac_cv_search_ut_parse" >&6; }
ac_res=$ac_cv_search_ut_parse
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_LIBUDUNITS2 1" >>confdefs.h
else
as_fn_error $? "Could not link to udunits2 library!" "$LINENO" 5
fi
UDUNITS_LDFLAGS=" -L$UDUNITS_ROOT/lib -ludunits2"
UDUNITS_INCLUDE=" -I$UDUNITS_ROOT/include/udunits2"
else
as_fn_error $? "$UDUNITS_ROOT is not a directory! UDUNITS2 suppressed" "$LINENO" 5
fi ;; #(
*) :
;;
esac
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the UDUNITS2 library" >&5
$as_echo_n "checking for the UDUNITS2 library... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
$as_echo "suppressed" >&6; }
fi
# ----------------------------------------------------------------------
# Compile application with MAGICS (xml required)
MAGICS_ROOT=''
......
......@@ -172,6 +172,8 @@ SZLIB_INCLUDE = @SZLIB_INCLUDE@
SZLIB_LIBS = @SZLIB_LIBS@
THREADS_INCLUDE = @THREADS_INCLUDE@
THREADS_LIBS = @THREADS_LIBS@
UDUNITS_INCLUDE = @UDUNITS_INCLUDE@
UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@
USER_NAME = @USER_NAME@
VERSION = @VERSION@
XML2_LIBS = @XML2_LIBS@
......
......@@ -339,6 +339,33 @@ AC_ARG_WITH([proj],
[AC_MSG_CHECKING([for the PROJ library])
AC_MSG_RESULT([suppressed])])
# ----------------------------------------------------------------------
# Link application with UDUNITS2 library
AC_ARG_WITH([udunits2],
[AS_HELP_STRING([--with-udunits2=<directory>],
[Specify location of UDUNITS2 library.])],
[AS_CASE(["$with_udunits2"],
[no],[AC_MSG_CHECKING([for udunits2 library])
AC_MSG_RESULT([suppressed])],
[yes],[AC_CHECK_HEADERS([udunits2.h])
AC_SEARCH_LIBS([ut_parse],[udunits2],[AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
[AC_MSG_ERROR([Could not link to udunits2 library!])])
AC_SUBST([UDUNITS_LDFLAGS],[" -ludunits2"])
AC_SUBST([UDUNITS_INCLUDE],[""])],
[*],[UDUNITS_ROOT=$with_udunits2
AS_IF([test -d "$UDUNITS_ROOT"],
[LDFLAGS="$LDFLAGS -L$UDUNITS_ROOT/lib"
CPPFLAGS="$CPPFLAGS -I$UDUNITS_ROOT/include/udunits2"
AC_CHECK_HEADERS([udunits2.h])
AC_SEARCH_LIBS([ut_parse],
[udunits2],
[AC_DEFINE([HAVE_LIBUDUNITS2],[1],[Define to 1 for UDUNITS2 support])],
[AC_MSG_ERROR([Could not link to udunits2 library!])])
AC_SUBST([UDUNITS_LDFLAGS],[" -L$UDUNITS_ROOT/lib -ludunits2"])
AC_SUBST([UDUNITS_INCLUDE],[" -I$UDUNITS_ROOT/include/udunits2"])],
[AC_MSG_ERROR([$UDUNITS_ROOT is not a directory! UDUNITS2 suppressed])])])],
[AC_MSG_CHECKING([for the UDUNITS2 library])
AC_MSG_RESULT([suppressed])])
# ----------------------------------------------------------------------
# Compile application with MAGICS (xml required)
MAGICS_ROOT=''
MAGICS_INCLUDE=''
......
......@@ -385,6 +385,8 @@ SZLIB_INCLUDE = @SZLIB_INCLUDE@
SZLIB_LIBS = @SZLIB_LIBS@
THREADS_INCLUDE = @THREADS_INCLUDE@
THREADS_LIBS = @THREADS_LIBS@
UDUNITS_INCLUDE = @UDUNITS_INCLUDE@
UDUNITS_LDFLAGS = @UDUNITS_LDFLAGS@
USER_NAME = @USER_NAME@
VERSION = @VERSION@
XML2_LIBS = @XML2_LIBS@
......
......@@ -82,6 +82,9 @@
/* Define to 1 for SZIP support */
#undef HAVE_LIBSZ
/* Define to 1 for UDUNITS2 support */
#undef HAVE_LIBUDUNITS2
/* Define to 1 for XML2 support */
#undef HAVE_LIBXML2
......@@ -163,6 +166,9 @@
/* Define to 1 if you have the <szlib.h> header file. */
#undef HAVE_SZLIB_H
/* Define to 1 if you have the <udunits2.h> header file. */
#undef HAVE_UDUNITS2_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment