D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Autoconf help

 

Hi Guys,

Having a small issue with autoconf

I'm doing a test for libxml2 such so this can be enabled with a 
--with-shared-libxml2 option....

AC_ARG_WITH([shared-libxml],[  --with-shared-libxml=[location]  Use 
system shared libxml2 as xmlparser],[
if test "x$withval" = "xyes"; then
    withval=
fi
LIBXML2_LOCATION=$withval;

AC_CHECK_HEADERS([libxml/parser.h], [], [AC_MSG_ERROR([Sorry 
libxml/parser.h not found, is libxmlrpc and libxmlrpc-dev installed?])],[])

AC_DEFINE([HAVE_LIBXML])
HAVE_LIBXML=1;
],
[])


The code is a bit rough but the question is:-

if a with option specifies a location how to i use this. I am catching 
the $withval but on Debian libxml/parser.h is infact under 
/usr/include/libxml2/libxml/parser.h

I can force libxml2 to be found by specifying 
CFLAGS=-I/usr/include/libxml2 on the command line when i call configure 
i get a warning about the preprocessor not being able to find parser.h 
but the compiler is ok so it continues and builds ok. Is this the 
correct way to build in this situation?

what should i do with $withval in general (or in this case 
$LIBXML_LOCATION) should something like this happen :-

AC_SUBST(LIBXML2_LOCATION)
LIBS="-L/usr/lib -L$LIBXML2_LOCATION/lib"
CFLAGS="-I$LIBXML2_LOCATION/include"

Which is ok if you move things to /usr/local/ or 
/home/robin/tests/include and /home/robin/tests/lib but it still breaks 
in this particular Debian case where the headers are in an additional 
subfolder. I want a solution that can be fixed from the configure line 
so that packagers don't start patching the package for something silly 
like this that could be correctly implemented upstream.




If anyone can understand my random rant and knows the answer many thanks!

Regards

Robin


-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html