Author: borisk
Date: Thu Nov 12 05:57:31 2009
New Revision: 835245
URL: http://svn.apache.org/viewvc?rev=835245&view=rev
Log:
Rework the way we search for and detect the ICU and libcurl libraries
(XERCESC-1892).
Modified:
xerces/c/trunk/m4/xerces_curl_prefix.m4
xerces/c/trunk/m4/xerces_icu_prefix.m4
xerces/c/trunk/m4/xerces_msgloader_selection.m4
xerces/c/trunk/m4/xerces_netaccessor_selection.m4
xerces/c/trunk/m4/xerces_transcoder_selection.m4
xerces/c/trunk/src/Makefile.am
xerces/c/trunk/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp
Modified: xerces/c/trunk/m4/xerces_curl_prefix.m4
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_curl_prefix.m4?rev=835245&r1=835244&r2=835245&view=diff
==============================================================================
--- xerces/c/trunk/m4/xerces_curl_prefix.m4 (original)
+++ xerces/c/trunk/m4/xerces_curl_prefix.m4 Thu Nov 12 05:57:31 2009
@@ -13,29 +13,67 @@
[
AC_ARG_WITH([curl],
[AS_HELP_STRING([--with-curl[[[[=DIR]]]]],[Specify location of
libcurl])],
- [with_curl=m4_if($with_curl, [yes], [], $with_curl)],
+ [
+ if test x"$with_curl" = x"yes"; then
+ with_curl=
+ fi
+ ],
[with_curl=])
# Determine if curl is available
- AC_CACHE_CHECK([for libcurl], [xerces_cv_curl_prefix],
- [
- xerces_cv_curl_prefix=
+ AC_CACHE_VAL([xerces_cv_curl_present],
+ [
+ xerces_cv_curl_present=no
if test x"$with_curl" != x"no"; then
- pfix=$prefix
- if test x"$pfix" == x"NONE"; then
- pfix=
- fi
- search_list="$with_curl $pfix /usr/local /usr"
- for i in $search_list; do
- if test -r "$i/include/curl/easy.h" -a -r
"$i/include/curl/multi.h" -a -x "$i/bin/curl-config" ; then
- xerces_cv_curl_prefix=$i
- break
- fi
- done
+
+ # See if we were given a prefix.
+ #
+ if test -n "$with_curl"; then
+ AC_PATH_PROG([curl_config],
[curl-config],[],[$with_curl/bin])
+ else
+ AC_PATH_PROG([curl_config], [curl-config],[])
+ fi
+
+ if test -n "$curl_config"; then
+ curl_flags=`$curl_config --cflags`
+ curl_libs=`$curl_config --libs`
+ else
+ if test -n "$with_curl"; then
+ curl_flags="-I$with_curl/include"
+ curl_libs="-L$with_curl/lib -lcurl"
+ else
+ # Default compiler paths.
+ #
+ curl_flags=
+ curl_libs=-lcurl
+ fi
+ fi
+
+ # Check that the headers exist and can be compiled.
+ #
+ orig_cppflags=$CPPFLAGS
+ if test -n "$curl_flags"; then
+ CPPFLAGS="$curl_flags $CPPFLAGS"
+ fi
+ AC_CHECK_HEADER([curl/curl.h], [xerces_cv_curl_present=yes])
+ CPPFLAGS=$orig_cppflags
+
+ if test x"$xerces_cv_curl_present" != x"no"; then
+ # Check that the library can be linked.
+ #
+ orig_ldflags=$LDFLAGS
+ LDFLAGS="$curl_libs $LDFLAGS"
+ AC_CHECK_LIB([curl], [curl_multi_init], [],
[xerces_cv_curl_present=no])
+ LDFLAGS=$orig_ldflags
+ fi
fi
])
- AC_SUBST([CURL_PREFIX], [$xerces_cv_curl_prefix])
+ AC_CACHE_VAL([xerces_cv_curl_flags],
[xerces_cv_curl_flags=$curl_flags])
+ AC_CACHE_VAL([xerces_cv_curl_libs], [xerces_cv_curl_libs=$curl_libs])
+
+ AC_SUBST([CURL_PRESENT], [$xerces_cv_curl_present])
+ AC_SUBST([CURL_FLAGS], [$xerces_cv_curl_flags])
+ AC_SUBST([CURL_LIBS], [$xerces_cv_curl_libs])
]
)
-
Modified: xerces/c/trunk/m4/xerces_icu_prefix.m4
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_icu_prefix.m4?rev=835245&r1=835244&r2=835245&view=diff
==============================================================================
--- xerces/c/trunk/m4/xerces_icu_prefix.m4 (original)
+++ xerces/c/trunk/m4/xerces_icu_prefix.m4 Thu Nov 12 05:57:31 2009
@@ -13,29 +13,112 @@
[
AC_ARG_WITH([icu],
[AS_HELP_STRING([--with-icu[[[[=DIR]]]]],[Specify location of
icu])],
- [with_icu=m4_if($with_icu, [yes], [], $with_icu)],
+ [
+ if test x"$with_icu" = x"yes"; then
+ with_icu=
+ fi
+ ],
[with_icu=])
# Determine if icu is available
- AC_CACHE_CHECK([for icu], [xerces_cv_icu_prefix],
- [
- xerces_cv_icu_prefix=
+ AC_CACHE_VAL([xerces_cv_icu_present],
+ [
+ xerces_cv_icu_present=no
if test x"$with_icu" != x"no"; then
- pfix=$prefix
- if test x"$pfix" == x"NONE"; then
- pfix=
- fi
- search_list="$with_icu $pfix /usr/local /usr"
- for i in $search_list; do
- if test -r $i/include/unicode/ucnv.h; then
- xerces_cv_icu_prefix=$i
- break
- fi
- done
+
+ # See if we were given a prefix.
+ #
+ if test -n "$with_icu"; then
+ AC_PATH_PROG([icu_config], [icu-config],[],[$with_icu/bin])
+ else
+ AC_PATH_PROG([icu_config], [icu-config],[])
+ fi
+
+ # Add trailing slash to bin and sbin vars so that we
+ # can use them uniformly whether they are empty or not.
+ #
+ if test -n "$icu_config"; then
+ icu_flags=`$icu_config --cppflags-searchpath`
+ icu_libs=`$icu_config --ldflags`
+ icu_bin=`$icu_config --bindir`
+ icu_sbin=`$icu_config --sbindir`
+
+ if test -n "$icu_bin"; then
+ icu_bin="$icu_bin/"
+ fi
+
+ if test -n "$icu_sbin"; then
+ icu_sbin="$icu_sbin/"
+ fi
+
+ else
+ if test -n "$with_icu"; then
+ icu_flags="-I$with_icu/include"
+ icu_libs="-L$with_icu/lib -licuuc -licudata"
+ icu_bin="$with_icu/bin/"
+ icu_sbin="$with_icu/sbin/"
+ else
+ # Default compiler paths.
+ #
+ icu_flags=
+ icu_libs="-licuuc -licudata"
+ icu_bin=
+ icu_sbin=
+ fi
+ fi
+
+ # Check that the headers exist and can be compiled.
+ #
+ orig_cppflags=$CPPFLAGS
+ if test -n "$icu_flags"; then
+ CPPFLAGS="$icu_flags $CPPFLAGS"
+ fi
+ AC_CHECK_HEADER([unicode/ucnv.h],
[xerces_cv_icu_present=yes])
+
+
+ if test x"$xerces_cv_icu_present" != x"no"; then
+
+ # Check that the library can be linked.
+ #
+ AC_MSG_CHECKING([for ucnv_open in -licuuc])
+
+ orig_ldflags=$LDFLAGS
+ LDFLAGS="$icu_libs $LDFLAGS"
+
+ AC_LINK_IFELSE(
+ AC_LANG_SOURCE[[
+ #include <unicode/ucnv.h>
+
+ int main ()
+ {
+ ucnv_open (0, 0);
+ return 0;
+ }
+ ]],
+ [], [xerces_cv_icu_present=no])
+
+ LDFLAGS=$orig_ldflags
+
+ if test x"$xerces_cv_icu_present" != x"no"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+
+ CPPFLAGS=$orig_cppflags
fi
])
-
- AC_SUBST([ICU_PREFIX], [$xerces_cv_icu_prefix])
+
+ AC_CACHE_VAL([xerces_cv_icu_flags], [xerces_cv_icu_flags=$icu_flags])
+ AC_CACHE_VAL([xerces_cv_icu_libs], [xerces_cv_icu_libs=$icu_libs])
+ AC_CACHE_VAL([xerces_cv_icu_bin], [xerces_cv_icu_bin=$icu_bin])
+ AC_CACHE_VAL([xerces_cv_icu_sbin], [xerces_cv_icu_sbin=$icu_sbin])
+
+ AC_SUBST([ICU_PRESENT], [$xerces_cv_icu_present])
+ AC_SUBST([ICU_FLAGS], [$xerces_cv_icu_flags])
+ AC_SUBST([ICU_LIBS], [$xerces_cv_icu_libs])
+ AC_SUBST([ICU_BIN], [$xerces_cv_icu_bin])
+ AC_SUBST([ICU_SBIN], [$xerces_cv_icu_sbin])
]
)
-
Modified: xerces/c/trunk/m4/xerces_msgloader_selection.m4
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_msgloader_selection.m4?rev=835245&r1=835244&r2=835245&view=diff
==============================================================================
--- xerces/c/trunk/m4/xerces_msgloader_selection.m4 (original)
+++ xerces/c/trunk/m4/xerces_msgloader_selection.m4 Thu Nov 12 05:57:31 2009
@@ -41,7 +41,7 @@
AC_REQUIRE([XERCES_ICU_PREFIX])
AC_MSG_CHECKING([whether we support the ICU MsgLoader])
list_add=
- AS_IF([test x"$xerces_cv_icu_prefix" != x -a -x
$xerces_cv_icu_prefix/bin/genrb], [
+ AS_IF([test x"$xerces_cv_icu_present" != x"no"], [
AC_ARG_ENABLE([msgloader-icu],
AS_HELP_STRING([--enable-msgloader-icu],
[Enable ICU-based MsgLoader support]),
@@ -105,7 +105,7 @@
*-icu-*)
AC_DEFINE([XERCES_USE_MSGLOADER_ICU], 1, [Define to use
the ICU-based MsgLoader])
msgloader=icu
- LIBS="${LIBS} -L${xerces_cv_icu_prefix}/lib -licuuc
-licudata"
+ LIBS="${LIBS} ${xerces_cv_icu_libs}"
break
;;
Modified: xerces/c/trunk/m4/xerces_netaccessor_selection.m4
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_netaccessor_selection.m4?rev=835245&r1=835244&r2=835245&view=diff
==============================================================================
--- xerces/c/trunk/m4/xerces_netaccessor_selection.m4 (original)
+++ xerces/c/trunk/m4/xerces_netaccessor_selection.m4 Thu Nov 12 05:57:31 2009
@@ -29,8 +29,6 @@
AC_CHECK_LIB([socket], [socket])
AC_CHECK_LIB([nsl], [gethostbyname])
- XERCES_CURL_PREFIX
-
######################################################
# Test for availability of each netaccessor on this host.
# For each netaccessor that's available, and hasn't been disabled, add
it to our list.
@@ -41,7 +39,7 @@
AC_REQUIRE([XERCES_CURL_PREFIX])
AC_MSG_CHECKING([whether we can support the libcurl-based NetAccessor])
list_add=
- AS_IF([test x"$xerces_cv_curl_prefix" != x], [
+ AS_IF([test x"$xerces_cv_curl_present" != x"no"], [
AC_ARG_ENABLE([netaccessor-curl],
AS_HELP_STRING([--enable-netaccessor-curl],
[Enable libcurl-based NetAccessor support]),
@@ -152,10 +150,7 @@
*-curl-*)
netaccessor=curl
AC_DEFINE([XERCES_USE_NETACCESSOR_CURL], 1, [Define to
use the CURL NetAccessor])
- CURL_LIBS=`${xerces_cv_curl_prefix}/bin/curl-config
--libs`
- CURL_CFLAGS=`${xerces_cv_curl_prefix}/bin/curl-config
--cflags`
- LIBS="${LIBS} $CURL_LIBS"
- CXXFLAGS="${CXXFLAGS} ${CURL_CFLAGS}"
+ LIBS="${LIBS} ${xerces_cv_curl_libs}"
break
;;
Modified: xerces/c/trunk/m4/xerces_transcoder_selection.m4
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/m4/xerces_transcoder_selection.m4?rev=835245&r1=835244&r2=835245&view=diff
==============================================================================
--- xerces/c/trunk/m4/xerces_transcoder_selection.m4 (original)
+++ xerces/c/trunk/m4/xerces_transcoder_selection.m4 Thu Nov 12 05:57:31 2009
@@ -25,8 +25,8 @@
no_GNUiconv=false
AC_CHECK_HEADERS([iconv.h wchar.h string.h stdlib.h stdio.h ctype.h
locale.h errno.h], [], [no_GNUiconv=true])
# The code in iconv needs just on of these include files
- AC_CHECK_HEADER([endian.h],
- [],
+ AC_CHECK_HEADER([endian.h],
+ [],
[
AC_CHECK_HEADER([machine/endian.h],
[],
@@ -75,7 +75,7 @@
AC_REQUIRE([XERCES_ICU_PREFIX])
AC_MSG_CHECKING([whether we can support the ICU Transcoder])
list_add=
- AS_IF([test x"$xerces_cv_icu_prefix" != x], [
+ AS_IF([test x"$xerces_cv_icu_present" != x"no"], [
AC_ARG_ENABLE([transcoder-icu],
AS_HELP_STRING([--enable-transcoder-icu],
[Enable icu-based transcoder support]),
@@ -163,8 +163,7 @@
*-icu-*)
transcoder=icu
AC_DEFINE([XERCES_USE_TRANSCODER_ICU], 1, [Define to
use the ICU-based transcoder])
- AC_SUBST([ICU_CXXFLAGS],
[-I$xerces_cv_icu_prefix/include])
- LIBS="${LIBS} -L${xerces_cv_icu_prefix}/lib -licuuc
-licudata"
+ LIBS="${LIBS} ${xerces_cv_icu_libs}"
break
;;
Modified: xerces/c/trunk/src/Makefile.am
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/Makefile.am?rev=835245&r1=835244&r2=835245&view=diff
==============================================================================
--- xerces/c/trunk/src/Makefile.am (original)
+++ xerces/c/trunk/src/Makefile.am Thu Nov 12 05:57:31 2009
@@ -32,7 +32,6 @@
# make pretty-printing won't work.
#
AM_CPPFLAGS =
-AM_CXXFLAGS = $(ICU_CXXFLAGS)
libxerces_c_la_LDFLAGS = -release ${INTERFACE_VER_D}
@@ -60,13 +59,12 @@
EXTRA_DIST = stricmp.h strnicmp.h towlower.h towupper.h
libxerces_c_la_LIBADD = ${LTLIBOBJS}
-
# NetAccessors, conditionally built based on settings from configure
#
if XERCES_USE_NETACCESSOR_CURL
libxerces_c_la_SOURCES += ${curl_sources}
nobase_libxerces_c_la_HEADERS += ${curl_headers}
-AM_CPPFLAGS += -I${CURL_PREFIX}/include/curl
+AM_CPPFLAGS += ${CURL_FLAGS}
endif
if XERCES_USE_NETACCESSOR_SOCKET
@@ -90,7 +88,7 @@
if XERCES_USE_TRANSCODER_ICU
libxerces_c_la_SOURCES += ${icu_sources}
nobase_libxerces_c_la_HEADERS += ${icu_headers}
-AM_CPPFLAGS += -I${ICU_PREFIX}/include
+AM_CPPFLAGS += ${ICU_FLAGS}
endif
if XERCES_USE_TRANSCODER_GNUICONV
@@ -125,7 +123,7 @@
libxerces_c_la_SOURCES += ${msgicu_sources}
nodist_libxerces_c_la_SOURCES = ${msgicu_nodist_sources}
nobase_libxerces_c_la_HEADERS += ${msgicu_headers}
-AM_CPPFLAGS += -I${ICU_PREFIX}/include
+AM_CPPFLAGS += ${ICU_FLAGS}
EXTRA_DIST += xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt \
xercesc/util/MsgLoaders/ICU/resources/root.txt
@@ -136,12 +134,12 @@
CLEANFILES = xercesc_messages.c root_res.c root.res
BUILT_SOURCES = xercesc_messages.c root_res.c
xercesc_messages.c:
${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt
- ${ICU_PREFIX}/sbin/gencmn --name ${PKGNAME} -S ${PKGNAME}_dat.c -d .
${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt
+ ${ICU_SBIN}gencmn --name ${PKGNAME} -S ${PKGNAME}_dat.c -d .
${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/res-file-list.txt
@mv ${PKGNAME}_dat.c xercesc_messages.c
root_res.c: ${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt
- ${ICU_PREFIX}/bin/genrb -d .
${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt
- ${ICU_PREFIX}/sbin/genccode --name ${PKGNAME} -d . root.res
+ ${ICU_BIN}genrb -d .
${top_srcdir}/src/xercesc/util/MsgLoaders/ICU/resources/root.txt
+ ${ICU_SBIN}genccode --name ${PKGNAME} -d . root.res
endif
Modified:
xerces/c/trunk/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp
URL:
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp?rev=835245&r1=835244&r2=835245&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp
(original)
+++ xerces/c/trunk/src/xercesc/util/NetAccessors/Curl/CurlURLInputStream.hpp
Thu Nov 12 05:57:31 2009
@@ -22,9 +22,9 @@
#if !defined(XERCESC_INCLUDE_GUARD_CURLURLINPUTSTREAM_HPP)
#define XERCESC_INCLUDE_GUARD_CURLURLINPUTSTREAM_HPP
-#include <curl.h>
-#include <multi.h>
-#include <easy.h>
+#include <curl/curl.h>
+#include <curl/multi.h>
+#include <curl/easy.h>
#include <xercesc/util/XMLURL.hpp>
#include <xercesc/util/XMLExceptMsgs.hpp>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]