Skip to content

Commit

Permalink
Add support for detecting libxml for Dmitri's work. He'll
Browse files Browse the repository at this point in the history
commit code in clang that uses this shortly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161252 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Aug 3, 2012
1 parent 8212002 commit 46e6bcf
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Makefile.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ LLVM_HAS_POLLY = @LLVM_HAS_POLLY@
# bfd ld / gold --version-script=file
HAVE_LINK_VERSION_SCRIPT = @HAVE_LINK_VERSION_SCRIPT@

# Flags to control using libxml2
LIBXML2_LIBS := @LIBXML2_LIBS@
LIBXML2_INC := @LIBXML2_INC@

# Flags to control building support for Intel JIT Events API
USE_INTEL_JITEVENTS := @USE_INTEL_JITEVENTS@
INTEL_JITEVENTS_INCDIR := @INTEL_JITEVENTS_INCDIR@
Expand Down
17 changes: 17 additions & 0 deletions autoconf/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,23 @@ AC_ARG_WITH(intel-jitevents,
AC_DEFINE_UNQUOTED([LLVM_USE_INTEL_JITEVENTS],$USE_INTEL_JITEVENTS,
[Define if we have the Intel JIT API runtime support library])

dnl Check for libxml2
dnl Right now we're just checking for the existence, we could also check for a
dnl particular version via --version on xml2-config
AC_CHECK_PROGS(XML2CONFIG, xml2-config)

AC_MSG_CHECKING(for libxml2 includes)
if test "x$XML2CONFIG" = "x"; then
AC_MSG_RESULT(xml2-config not found)
else
LIBXML2_INC=`$XML2CONFIG --cflags`
AC_MSG_RESULT($LIBXML2_INC)
AC_CHECK_LIB(xml2, xmlReadFile,[AC_DEFINE([CLANG_HAVE_LIBXML],1,[Define if we have libxml2])
LIBXML2_LIBS="-lxml2"])
fi
AC_SUBST(LIBXML2_LIBS)
AC_SUBST(LIBXML2_INC)

dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 6: Check for header files
Expand Down
152 changes: 150 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,9 @@ USE_OPROFILE
USE_INTEL_JITEVENTS
INTEL_JITEVENTS_INCDIR
INTEL_JITEVENTS_LIBDIR
XML2CONFIG
LIBXML2_LIBS
LIBXML2_INC
HAVE_PTHREAD
HUGE_VAL_SANITY
MMAP_FILE
Expand Down Expand Up @@ -10231,7 +10234,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 10234 "configure"
#line 10237 "configure"
#include "confdefs.h"

#if HAVE_DLFCN_H
Expand Down Expand Up @@ -13806,6 +13809,148 @@ cat >>confdefs.h <<_ACEOF
_ACEOF


for ac_prog in xml2-config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
if test "${ac_cv_prog_XML2CONFIG+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$XML2CONFIG"; then
ac_cv_prog_XML2CONFIG="$XML2CONFIG" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_XML2CONFIG="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS

fi
fi
XML2CONFIG=$ac_cv_prog_XML2CONFIG
if test -n "$XML2CONFIG"; then
{ echo "$as_me:$LINENO: result: $XML2CONFIG" >&5
echo "${ECHO_T}$XML2CONFIG" >&6; }
else
{ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
fi


test -n "$XML2CONFIG" && break
done


{ echo "$as_me:$LINENO: checking for libxml2 includes" >&5
echo $ECHO_N "checking for libxml2 includes... $ECHO_C" >&6; }
if test "x$XML2CONFIG" = "x"; then
{ echo "$as_me:$LINENO: result: xml2-config not found" >&5
echo "${ECHO_T}xml2-config not found" >&6; }
else
LIBXML2_INC=`$XML2CONFIG --cflags`
{ echo "$as_me:$LINENO: result: $LIBXML2_INC" >&5
echo "${ECHO_T}$LIBXML2_INC" >&6; }
{ echo "$as_me:$LINENO: checking for xmlReadFile in -lxml2" >&5
echo $ECHO_N "checking for xmlReadFile in -lxml2... $ECHO_C" >&6; }
if test "${ac_cv_lib_xml2_xmlReadFile+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lxml2 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* 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 xmlReadFile ();
int
main ()
{
return xmlReadFile ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_try") 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_xml2_xmlReadFile=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5

ac_cv_lib_xml2_xmlReadFile=no
fi

rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlReadFile" >&5
echo "${ECHO_T}$ac_cv_lib_xml2_xmlReadFile" >&6; }
if test $ac_cv_lib_xml2_xmlReadFile = yes; then

cat >>confdefs.h <<\_ACEOF
#define CLANG_HAVE_LIBXML 1
_ACEOF

LIBXML2_LIBS="-lxml2"
fi

fi






Expand Down Expand Up @@ -22081,6 +22226,9 @@ USE_OPROFILE!$USE_OPROFILE$ac_delim
USE_INTEL_JITEVENTS!$USE_INTEL_JITEVENTS$ac_delim
INTEL_JITEVENTS_INCDIR!$INTEL_JITEVENTS_INCDIR$ac_delim
INTEL_JITEVENTS_LIBDIR!$INTEL_JITEVENTS_LIBDIR$ac_delim
XML2CONFIG!$XML2CONFIG$ac_delim
LIBXML2_LIBS!$LIBXML2_LIBS$ac_delim
LIBXML2_INC!$LIBXML2_INC$ac_delim
HAVE_PTHREAD!$HAVE_PTHREAD$ac_delim
HUGE_VAL_SANITY!$HUGE_VAL_SANITY$ac_delim
MMAP_FILE!$MMAP_FILE$ac_delim
Expand All @@ -22106,7 +22254,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF

if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 93; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
Expand Down
3 changes: 3 additions & 0 deletions include/llvm/Config/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
/* Bug report URL. */
#undef BUG_REPORT_URL

/* Define if we have libxml2 */
#undef CLANG_HAVE_LIBXML

/* Relative directory for resource files */
#undef CLANG_RESOURCE_DIR

Expand Down

0 comments on commit 46e6bcf

Please sign in to comment.