[krbdev.mit.edu #8928] [PATCH] Constructor/destructor configure check fails on certain compilers
"Misty De Meo via RT" <[email protected]>
| Newsgroups | gmane.comp.encryption.kerberos.bugs |
|---|---|
| Message-ID | <[email protected]> |
Sat Jul 18 20:32:54 2020: Request 8928 was acted upon. Transaction: Ticket created by [email protected] Queue: krb5 Subject: [PATCH] Constructor/destructor configure check fails on certain compilers Owner: Nobody Requestors: [email protected] Status: new Ticket <URL: https://krbdev.mit.edu/rt/Ticket/Display.html?id=8928 > On recent versions of clang, calling functions without first having imported their headers is an error. This causes the constructor/destructor configure check to fail; it doesn't include any headers, and a function it uses goes undefined. Sample error: configure:5947: checking for constructor/destructor attribute support configure:5975: clang -o conftest -g -O2 -fno-common -Wl,-search_paths_first conftest.c -lresolv >&5 conftest.c:25:15: error: implicit declaration of function 'unlink' is invalid in C99 [-Werror,-Wimplicit-function-declaration] void foo1() { unlink("conftest.1"); } ^ Patch: diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 2394f7e..811e987 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -1606,7 +1606,8 @@ fi a=no b=no # blindly assume we have 'unlink'... -AC_TRY_RUN([void foo1() __attribute__((constructor)); +AC_TRY_RUN([#include <unistd.h> +void foo1() __attribute__((constructor)); void foo1() { unlink("conftest.1"); } void foo2() __attribute__((destructor)); void foo2() { unlink("conftest.2"); }