NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/53314: strncasecmp conflict when cross-compiling libgroff on FreeBSD

The following reply was made to PR toolchain/53314; it has been noted by GNATS.

From: Taylor R Campbell <>
Subject: Re: toolchain/53314: strncasecmp conflict when cross-compiling libgroff on FreeBSD
Date: Tue, 6 Nov 2018 01:58:25 +0000

 The problem is not with FreeBSD's headers.  Doubtless there are bugs
 in FreeBSD's headers, but in this case, the logic in our tree is doing
 something wrong and we can straightforwardly fix it in our tree.
 The problem in our tree is that there was a bodgy autoconf feature
 that got baked into the groff configure script to attempt to _guess_
 the correct declaration of the exit function by enumerating several
 options, none of which is the one that FreeBSD uses now.
 Because the autoconf-generated configure script fails to find the
 declaration of exit, it gets confused and generates the wrong test
 programs, leading it to infer that the system's strncasecmp
 declaration is missing too.  On the basis of that, groff decides to
 fantasize its own strncasecmp declaration, which, incidentally, also
 disagrees with the standard one.
 The bodgy autoconf feature was a combination of a workaround for a bug
 dating back to 1988 in SunOS and difficulty with finding a usable
 declaration for exit when the C++ compiler is being abused as a C
 compiler[1].  Fortunately, this autoconf feature was removed in
 2006[2], 12 years ago, when the bug it worked around was only 18 years
 There are two obvious ways to fix this:
 1. Patch the groff configure script to try an exit declaration that
    FreeBSD actually uses:
 diff --git a/external/gpl2/groff/dist/configure b/external/gpl2/groff/dist/=
 index 107aadcae070..972b95703f29 100755
 --- a/external/gpl2/groff/dist/configure
 +++ b/external/gpl2/groff/dist/configure
 @@ -2511,6 +2511,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
     'extern "C" void std::exit (int); using std::exit;' \
     'extern "C" void exit (int) throw ();' \
     'extern "C" void exit (int);' \
 +   'extern "C" [[noreturn]] void exit (int);' \
 +   'extern "C" _Noreturn void exit (int);' \
     'void exit (int);'
    cat >conftest.$ac_ext <<_ACEOF
 2. Regenerate the groff configure script with a modern autoconf that
    doesn't twist itsef into knots trying to guess how to declare exit.
 Neither of these requires changing FreeBSD; it is a legitimate bug in
 NetBSD that the toolchain doesn't build on FreeBSD right now, and
 rather embarrassing that it has been the case for months.

Home | Main Index | Thread Index | Old Index