Commit cdd5da27 authored by Ralf Müller's avatar Ralf Müller
Browse files

Successfully compiled with both '--with-magics' and '--with-libxml2'

removes all HAVE_LIBXML form the source code files
parent d7ed9820
......@@ -242,6 +242,7 @@ THREADS_INCLUDE = @THREADS_INCLUDE@
THREADS_LIBS = @THREADS_LIBS@
USER_NAME = @USER_NAME@
VERSION = @VERSION@
XML2_LIBS = @XML2_LIBS@
ZLIB_INCLUDE = @ZLIB_INCLUDE@
ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
......
......@@ -649,6 +649,7 @@ ENABLE_CDI_LIB_FALSE
ENABLE_CDI_LIB_TRUE
ENABLE_MAGICS_FALSE
ENABLE_MAGICS_TRUE
XML2_LIBS
MAGICS_INCLUDE
MAGICS_ROOT
MAGICS_LIBS
......@@ -825,6 +826,7 @@ enable_extra
enable_ieg
with_proj
with_magics
with_libxml2
enable_cdi_lib
enable_all_static
'
......@@ -1512,6 +1514,9 @@ Optional Packages:
projections.
--with-magics=<yes|no|directory>
location of magics library (lib and include subdirs)
--with-libxml2=<yes|no|directory>
location of libxml2 library (lib and include
subdirs)
 
Some influential environment variables:
CC C compiler command
......@@ -18457,7 +18462,7 @@ $as_echo "suppressed" >&6; }
fi
 
# ----------------------------------------------------------------------
# Compile application with MAGICS
# Compile application with MAGICS (xml required)
MAGICS_ROOT=''
MAGICS_INCLUDE=''
MAGICS_LIBS=''
......@@ -18641,7 +18646,197 @@ fi
 
 
 
if test ! x$with_magics = 'x'; then
# Check whether --with-libxml2 was given.
if test "${with_libxml2+set}" = set; then :
withval=$with_libxml2; case "$with_libxml2" in #(
no) :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml2 library" >&5
$as_echo_n "checking for libxml2 library... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
$as_echo "suppressed" >&6; } ;; #(
yes) :
CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2"
for ac_header in libxml/parser.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libxml/parser.h" "ac_cv_header_libxml_parser_h" "$ac_includes_default"
if test "x$ac_cv_header_libxml_parser_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBXML_PARSER_H 1
_ACEOF
fi
done
for ac_header in libxml/tree.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libxml/tree.h" "ac_cv_header_libxml_tree_h" "$ac_includes_default"
if test "x$ac_cv_header_libxml_tree_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBXML_TREE_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing xmlInitMemory" >&5
$as_echo_n "checking for library containing xmlInitMemory... " >&6; }
if ${ac_cv_search_xmlInitMemory+:} 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 xmlInitMemory ();
int
main ()
{
return xmlInitMemory ();
;
return 0;
}
_ACEOF
for ac_lib in '' xml2; 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_xmlInitMemory=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_xmlInitMemory+:} false; then :
break
fi
done
if ${ac_cv_search_xmlInitMemory+:} false; then :
else
ac_cv_search_xmlInitMemory=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_xmlInitMemory" >&5
$as_echo "$ac_cv_search_xmlInitMemory" >&6; }
ac_res=$ac_cv_search_xmlInitMemory
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
else
as_fn_error $? "Could not link to libxml2 library" "$LINENO" 5
fi
XML2_LIBS=" -lxml2"
;; #(
*) :
if test -d "$with_libxml2"; then :
XML2_ROOT=$with_libxml2
LDFLAGS="-L$XML2_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$XML2_ROOT/include/libxml2 $CPPFLAGS"
for ac_header in libxml2_api.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "libxml2_api.h" "ac_cv_header_libxml2_api_h" "$ac_includes_default"
if test "x$ac_cv_header_libxml2_api_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBXML2_API_H 1
_ACEOF
fi
done
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing xmlInitMemory" >&5
$as_echo_n "checking for library containing xmlInitMemory... " >&6; }
if ${ac_cv_search_xmlInitMemory+:} 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 xmlInitMemory ();
int
main ()
{
return xmlInitMemory ();
;
return 0;
}
_ACEOF
for ac_lib in '' xml2; 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_xmlInitMemory=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_xmlInitMemory+:} false; then :
break
fi
done
if ${ac_cv_search_xmlInitMemory+:} false; then :
else
ac_cv_search_xmlInitMemory=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_xmlInitMemory" >&5
$as_echo "$ac_cv_search_xmlInitMemory" >&6; }
ac_res=$ac_cv_search_xmlInitMemory
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
else
as_fn_error $? "Could not link to libxml2 library" "$LINENO" 5
fi
XML2_LIBS=" -L$XML2_ROOT/lib -lxml2"
XML2_INCLUDE=" -I$XML2_ROOT/include/libxml2"
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: $with_libxml2 is not a directory! XML2 suppressed" >&5
$as_echo "$as_me: $with_libxml2 is not a directory! XML2 suppressed" >&6;}
fi ;; #(
*) :
;;
esac
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML2 library" >&5
$as_echo_n "checking for XML2 library... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5
$as_echo "suppressed" >&6; }
fi
if test ! x$with_magics = 'x' -a ! x$with_libxml2 = 'x'; then
ENABLE_MAGICS_TRUE=
ENABLE_MAGICS_FALSE='#'
else
......
......@@ -174,6 +174,7 @@ THREADS_INCLUDE = @THREADS_INCLUDE@
THREADS_LIBS = @THREADS_LIBS@
USER_NAME = @USER_NAME@
VERSION = @VERSION@
XML2_LIBS = @XML2_LIBS@
ZLIB_INCLUDE = @ZLIB_INCLUDE@
ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
......
......@@ -339,7 +339,7 @@ AC_ARG_WITH([proj],
[AC_MSG_CHECKING([for the PROJ library])
AC_MSG_RESULT([suppressed])])
# ----------------------------------------------------------------------
# Compile application with MAGICS
# Compile application with MAGICS (xml required)
MAGICS_ROOT=''
MAGICS_INCLUDE=''
MAGICS_LIBS=''
......@@ -371,7 +371,34 @@ AC_ARG_WITH([magics],
AC_SUBST([MAGICS_ROOT])
AC_SUBST([MAGICS_INCLUDE])
AC_SUBST([MAGICS_LIBS])
AM_CONDITIONAL([ENABLE_MAGICS],[test ! x$with_magics = 'x'])
AC_ARG_WITH([libxml2],
[AS_HELP_STRING([--with-libxml2=<yes|no|directory>],[location of libxml2 library (lib and include subdirs)])],
[AS_CASE(["$with_libxml2"],
[no],[AC_MSG_CHECKING([for libxml2 library])
AC_MSG_RESULT([suppressed])],
[yes],[CPPFLAGS="$CPPFLAGS -I/usr/include/libxml2"
AC_CHECK_HEADERS([libxml/parser.h])
AC_CHECK_HEADERS([libxml/tree.h])
AC_SEARCH_LIBS([xmlInitMemory],
[xml2],
[AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 for XML2 support])],
[AC_MSG_ERROR([Could not link to libxml2 library])])
AC_SUBST([XML2_LIBS],[" -lxml2"])],
[*],[AS_IF([test -d "$with_libxml2"],
[XML2_ROOT=$with_libxml2
LDFLAGS="-L$XML2_ROOT/lib $LDFLAGS"
CPPFLAGS="-I$XML2_ROOT/include/libxml2 $CPPFLAGS"
AC_CHECK_HEADERS([libxml2_api.h])
AC_SEARCH_LIBS([xmlInitMemory],
[xml2],
[AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 for XML2 support])],
[AC_MSG_ERROR([Could not link to libxml2 library])])
XML2_LIBS=" -L$XML2_ROOT/lib -lxml2"
XML2_INCLUDE=" -I$XML2_ROOT/include/libxml2"],
[AC_MSG_NOTICE([$with_libxml2 is not a directory! XML2 suppressed])])])],
[AC_MSG_CHECKING([for XML2 library])
AC_MSG_RESULT([suppressed])])
AM_CONDITIONAL([ENABLE_MAGICS],[test ! x$with_magics = 'x' -a ! x$with_libxml2 = 'x'])
# ----------------------------------------------------------------------
# How to build CDI into CDO?
INTERNAL_CDI_DIR=libcdi
......
......@@ -11,8 +11,6 @@
#include "magics_api.h"
#if defined (HAVE_LIBXML)
#include<libxml/parser.h>
#include<libxml/tree.h>
#include "template_parser.h"
......@@ -23,8 +21,6 @@
extern xmlNode *magics_node;
#endif
#define DBG 0
......@@ -595,11 +591,9 @@ void *Maggraph(void *argument)
streamClose(streamID);
}
#if defined (HAVE_LIBXML)
/* HARDCODED THE FILE NAME .. TO BE SENT AS COMMAND LINE ARGUMENT FOR THE MAGICS OPERATOR */
init_XMLtemplate_parser( Filename );
updatemagics_and_results_nodes( );
#endif
init_MAGICS( );
......@@ -614,9 +608,7 @@ void *Maggraph(void *argument)
}
maggraph(ofilename, varname, units, nfiles, nts, vdate, vtime, datatab, nparam, pnames);
#if defined (HAVE_LIBXML)
quit_XMLtemplate_parser( );
#endif
quit_MAGICS( );
......@@ -692,12 +684,10 @@ void VerifyGraphParameters( int num_param, char **param_names )
}
else
{
#if defined (HAVE_LIBXML)
/* HARDCODED THE FILE NAME .. TO BE SENT AS COMMAND LINE ARGUMENT FOR THE MAGICS OPERATOR */
fclose(fp);
init_XMLtemplate_parser( split_str[1] );
updatemagics_and_results_nodes( );
#endif
}
}
}
......
......@@ -9,8 +9,6 @@
#include "pstream.h"
#include "magics_api.h"
#if defined (HAVE_LIBXML)
#include<libxml/parser.h>
#include<libxml/tree.h>
#include "template_parser.h"
......@@ -20,8 +18,6 @@
xmlDoc *param_doc = NULL;
xmlNode *root_node = NULL, *magics_node = NULL, *results_node = NULL;
#endif
#define DBG 0
......@@ -257,11 +253,9 @@ void *Magplot(void *argument)
tsID = 0;
#if defined (HAVE_LIBXML)
/* HARDCODED THE FILE NAME .. TO BE SENT AS COMMAND LINE ARGUMENT FOR THE MAGICS OPERATOR */
init_XMLtemplate_parser( Filename );
updatemagics_and_results_nodes( );
#endif
......@@ -316,9 +310,7 @@ void *Magplot(void *argument)
if ( grid_center_lon ) free(grid_center_lon);
if ( grid_center_lat ) free(grid_center_lat);
#if defined (HAVE_LIBXML)
quit_XMLtemplate_parser( );
#endif
cdoFinish();
......
......@@ -10,8 +10,6 @@
#include "magics_api.h"
#if defined (HAVE_LIBXML)
#include<libxml/parser.h>
#include<libxml/tree.h>
#include "template_parser.h"
......@@ -22,8 +20,6 @@
//extern xmlNode *root_node, *magics_node, *results_node;
extern xmlNode *magics_node;
#endif
int VECTOR, STREAM;
static
......@@ -189,11 +185,9 @@ void *Magvector(void *argument)
tsID = 0;
#if defined (HAVE_LIBXML)
/* HARDCODED THE FILE NAME .. TO BE SENT AS COMMAND LINE ARGUMENT FOR THE MAGICS OPERATOR */
init_XMLtemplate_parser( Filename );
updatemagics_and_results_nodes( );
#endif
init_MAGICS( );
......@@ -262,9 +256,7 @@ void *Magvector(void *argument)
if ( grid_center_lon ) free(grid_center_lon);
if ( grid_center_lat ) free(grid_center_lat);
#if defined (HAVE_LIBXML)
quit_XMLtemplate_parser( );
#endif
quit_MAGICS( );
......
......@@ -387,6 +387,7 @@ THREADS_INCLUDE = @THREADS_INCLUDE@
THREADS_LIBS = @THREADS_LIBS@
USER_NAME = @USER_NAME@
VERSION = @VERSION@
XML2_LIBS = @XML2_LIBS@
ZLIB_INCLUDE = @ZLIB_INCLUDE@
ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
......
......@@ -81,6 +81,18 @@
/* Define to 1 for SZIP support */
#undef HAVE_LIBSZ
/* Define to 1 for XML2 support */
#undef HAVE_LIBXML2
/* Define to 1 if you have the <libxml2_api.h> header file. */
#undef HAVE_LIBXML2_API_H
/* Define to 1 if you have the <libxml/parser.h> header file. */
#undef HAVE_LIBXML_PARSER_H
/* Define to 1 if you have the <libxml/tree.h> header file. */
#undef HAVE_LIBXML_TREE_H
/* Define 1 for ZLIB support */
#undef HAVE_LIBZ
......
......@@ -10,8 +10,6 @@
#define DBG 0
#if defined (HAVE_LIBXML)
extern xmlNode *magics_node;
......@@ -92,7 +90,6 @@ int magics_template_parser( xmlNode *a_node )
}
return 0;
}
#endif
int SetMagicsParameterValue( char *param_name, char *param_type, char *param_value )
......
#ifndef MAGICS_TEMPLATE_PARSER_HH
#define MAGICS_TEMPLATE_PARSER_HH
#endif
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<locale.h>
#if defined (HAVE_LIBXML)
#include<libxml/parser.h>
#include<libxml/tree.h>
#endif
#if defined (HAVE_LIBXML)
int magics_template_parser( xmlNode * a_node );
#endif
int SetMagicsParameterValue( char *param_name, char *param_type, char *param_value );
#endif
......@@ -7,8 +7,6 @@
/* extern int GetMagicsParameterInfo( const char *user_name, char **magics_name, char **magics_type ); */
#if defined (HAVE_LIBXML)
extern int GetMagicsParameterInfo( char *user_name, xmlChar *param_value );
extern xmlNode *results_node;
......@@ -121,4 +119,3 @@ int results_template_parser( xmlNode * a_node, const char *varname )
}
return 0;
}
#endif
......@@ -5,11 +5,9 @@
#include<string.h>
#include<stdlib.h>
#if defined (HAVE_LIBXML)
#include<libxml/parser.h>
#include<libxml/tree.h>
int results_template_parser( xmlNode * a_node, const char *varname );
#endif
#endif
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