Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] autoconf question
Home

[Freeciv-Dev] autoconf question

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv Developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] autoconf question
From: Jason Dorje Short <jshort@xxxxxxxxxxxxxx>
Date: Fri, 05 Dec 2003 16:15:11 -0500
Reply-to: jdorje@xxxxxxxxxxxx

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



[Prev in Thread] Current Thread [Next in Thread]