Hi,
Attached patch allows to build apr-util with system provided libexpat on
OpenSolaris.
On the machine, there is a expat.h and libexpat.so.* in /usr/sfw/include
and /usr/sfw/lib. But there is no .a or .la file.
It should not be required to have a .la file, not to mention a .a file.
.a is, afaik, an archive file for static link.
Attached patch use AC_CHECK_LIB to ensure a library can be found, and it
uses a for loop to look into potential folders, currently I put lib and
lib64 in there.
Cheers,
Henry
Index: build/apu-conf.m4
===================================================================
--- build/apu-conf.m4 (revision 433720)
+++ build/apu-conf.m4 (working copy)
@@ -63,27 +63,24 @@
expat_ldflags="-L$1/lib"
expat_libs="-lexpat"
expat_libtool="$1/lib/libexpat.la"
- elif test -r "$1/include/expat.h" -a \
- -r "$1/lib/libexpat.la"; then
- dnl Expat 1.95.* installation (with libtool)
- expat_include_dir="$1/include"
- expat_ldflags="-L$1/lib"
- expat_libs="-lexpat"
- expat_libtool="$1/lib/libexpat.la"
- elif test -r "$1/include/expat.h" -a \
- -r "$1/lib64/libexpat.la"; then
- dnl Expat 1.95.* installation on certain 64-bit platforms (with libtool)
- expat_include_dir="$1/include"
- expat_ldflags="-L$1/lib64"
- expat_libs="-lexpat"
- expat_libtool="$1/lib64/libexpat.la"
- elif test -r "$1/include/expat.h" -a \
- -r "$1/lib/libexpat.a"; then
- dnl Expat 1.95.* installation (without libtool)
- dnl FreeBSD textproc/expat2
- expat_include_dir="$1/include"
- expat_ldflags="-L$1/lib"
- expat_libs="-lexpat"
+ elif test -r "$1/include/expat.h"; then
+ old_ldflags="$LDFLAGS"
+ old_cflags="$CFLAGS"
+ for d in $1/lib $1/lib64 ; do
+ CFLAGS="$old_cflags -I$1/include"
+ LDFLAGS="$old_ldflags -L$d"
+ AC_CHECK_LIB(expat, XML_ParserCreate, [
+ expat_include_dir="$1/include"
+ expat_libs="-lexpat"
+ expat_ldflags="-L$d"
+ if test -r "$d/libexpat.la"; then
+ expat_libtool="$d/libexpat.la"
+ fi
+ break
+ ], [])
+ done
+ CFLAGS=$old_cflags
+ LDFLAGS=$old_ldflags
elif test -r "$1/xmlparse.h"; then
dnl maybe an expat-lite. use this dir for both includes and libs
expat_include_dir="$1"