More weird stuff

Russ Allbery rra at stanford.edu
Wed Jan 28 17:32:22 UTC 2009


Julien ÉLIE <julien at trigofacile.com> writes:

> OK.
> As for setproctitle, we will need another variable because HAVE_SETPROCTITLE
> should be 0 for the first occurrence and 1 for the second on BSD/OS.
> Otherwise, there are compilation errors.
> (Maybe HAVE_SETPROCTITLE_INIT?)

If I'm understanding you correctly, the Autoconf standard is
HAVE_DECL_SETPROCTITLE:

 - Macro: AC_CHECK_DECLS (SYMBOLS, [ACTION-IF-FOUND],
          [ACTION-IF-NOT-FOUND], [INCLUDES = `default-includes'])
     For each of the SYMBOLS (_comma_-separated list), define
     `HAVE_DECL_SYMBOL' (in all capitals) to `1' if SYMBOL is declared,
     otherwise to `0'.  If ACTION-IF-NOT-FOUND is given, it is
     additional shell code to execute when one of the function
     declarations is needed, otherwise ACTION-IF-FOUND is executed.

     This macro uses an m4 list as first argument:
          AC_CHECK_DECLS(strdup)
          AC_CHECK_DECLS([strlen])
          AC_CHECK_DECLS([malloc, realloc, calloc, free])

     Unlike the other `AC_CHECK_*S' macros, when a SYMBOL is not
     declared, `HAVE_DECL_SYMBOL' is defined to `0' instead of leaving
     `HAVE_DECL_SYMBOL' undeclared.  When you are _sure_ that the check
     was performed, use `HAVE_DECL_SYMBOL' just like any other result
     of Autoconf:

          #if !HAVE_DECL_SYMBOL
          extern char *symbol;
          #endif

     If the test may have not been performed, however, because it is
     safer _not_ to declare a symbol than to use a declaration that
     conflicts with the system's one, you should use:

          #if defined HAVE_DECL_MALLOC && !HAVE_DECL_MALLOC
          void *malloc (size_t *s);
          #endif

     You fall into the second category only in extreme situations:
     either your files may be used without being configured, or they
     are used during the configuration.  In most cases the traditional
     approach is enough.

So we would separately probe for the existence of the fuction and the
existence of the declaration, and then can make decisions in the
implementation based on whatever combination of the two the local host
has.

setproctitle_init() is my own invention and is local to INN.  It does
setup for systems that don't have a proper setproctitle().

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.



More information about the inn-workers mailing list