[Freeciv-Dev] autoconf question
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
If I run an autoconf check for functions or headers, like
AC_CHECK_FUNCS([strcasecmp])
or
AC_CHECK_HEADERS([limits.h])
all this does as a result of the check is set HAVE_STRCASECMP or
HAVE_LIMITS_H in config.h.
Of course, these values can be used within the code:
#ifdef HAVE_LIMITS_H
# include <limits.h>
#endif
or
#ifdef HAVE_STRCASECMP
result = strcasecmp(str1, str2);
#else
result = strcmp(str1, str2);
#endif
but in most cases we don't do this; there's no alternative to using the
function or header. So if it weren't present configure wouldn't find
it, would continue configuring, and would succeed...and then compilation
would fail.
These macros take an action-if-not-found argument. I believe the
correct configure test for most functions & headers should therefore be
AC_CHECK_FUNCS([strcasecmp], [], AC_MSG_ERROR([no strcasecmp]))
or
AC_CHECK_HEADERS([limits.h], [], AC_MSG_ERROR([no limits.h]))
which will cause configure to fail if the headers or functions aren't
present.
Is this correct? Does anyone here really know autoconf?
jason
- [Freeciv-Dev] autoconf question,
Jason Dorje Short <=
|
|