Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Problem with autoconf

Thread Tools

Problem with autoconf

Amit Gangrade
Posts: n/a
I am trying to make a configure script for a c++ library . The library can
be compiled with some optional header files,depending on the users
decision . So basically I need to check for the headers in the path that the
user gives in the --with-somelibrary-include="somedirectory" .

I am appending the path of "somedirectory" to CPPFLAGS and then using
AC_TRY_COMPILE macro , I am trying to compile a program
which includes those optional header files .
I am putting the part of code from file

# part of code from

AC_ARG_WITH(spec_include, [ --with-spec-include=DIR SPEC include
directory], with_spec_include=$withval)

if test -d "$with_spec_include"; then
CPPFLAGS="$CPPFLAGS -I$with_spec_include"

#include "OptionalHeader.hh"
], , AC_MSG_RESULT(yes),
AC_MSG_ERROR([Optional header missing in the given path])])

# ends

The problem is that OptionalHeader.hh is a c++ header file . When i checked
the config.log file ,i find that
configure is using gcc to compile conftest.c file which includes c++
header(OptionalHeader.hh) . To be more clear I am putting
the line from config.log after which the configure fails.

gcc -c -g -O2 -I"somedirectory" conftest.c

When I compiled the program using g++ or by renaming conftest.c to
conftest.cpp ,it is compilng . So i guess the error is because that
while testing for headers in AC_TRY_COMPILE macro used gcc by default.
Is there any way to use g++ to compile the code in AC_TRY_COMPILE instead of
or is there some other way to check for header files in the path provided by
user .(not using AC_CHECK_HEADER because i want to look for header only in
the path that the user provides while running configure)
Ex. configure --check-in-path="path_provided_by_user"

Thanks in Advance
Amit Gangrade

Reply With Quote
Victor Bazarov
Posts: n/a
"Amit Gangrade" <(E-Mail Removed)> wrote...
> I am trying to make a configure script for a c++ library [...]

Sorry, this is off-topic here. Try


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedding python in package using autoconf Hallvard B Furuseth Python 0 05-15-2006 02:42 PM vs autoconf install/uninstall, R. Bernstein Python 0 01-12-2006 11:38 AM
autoconf wizard wanted Heiko Wundram Python 0 05-01-2005 08:09 PM
autoconf macros and distutils Mark Asbach Python 0 03-01-2004 08:03 AM
autoconf-style checking for installed libs with DistUtils =?ISO-8859-1?Q?Michael_Str=F6der?= Python 2 07-28-2003 11:19 AM