[Box Backup-dev] RC 3 testing: NetBSD 3.0 fails

Martin Ebourne boxbackup-dev at fluffy.co.uk
Tue Feb 21 18:18:27 GMT 2006


Ben Summers <ben at fluffy.co.uk> wrote:
> Is is possible to use autoconf to test for the type of a structure  member?

It's probably possible to do anything in autoconf if you're keen enough. :)

I don't think there's an explicit type test, but something like the 
following is very flexible:

AC_CACHE_CHECK(whether the compiler supports exceptions,
ac_cv_cxx_exceptions,
[AC_TRY_COMPILE(,[try { throw  1; } catch (int i) { return i; }],
                ac_cv_cxx_exceptions=yes, ac_cv_cxx_exceptions=no)])
if test "$ac_cv_cxx_exceptions" = yes; then
  AC_DEFINE(HAVE_EXCEPTIONS,,[define if the compiler supports exceptions])
fi

Just change the names and stick in a piece of C++ code that either 
compiles or fails depending on what you get. I guess something like:

void* ptr = NULL;
struct kevent ev;
ev.udata = ptr;
return 0;

would probably do the trick. Or use the EV_SET macro similarly.

Cheers,

Martin.



More information about the Boxbackup-dev mailing list