diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-06-05 06:37:27 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-06-05 06:37:27 -0700 |
commit | 3466d04fb72ff63998fb047e39796c9a2845519b (patch) | |
tree | 8049b9e44ab05b75007884ebd07a12606a6df52e /configure | |
parent | 9ac1698bc322236e503ad8df7411e4cb6e521199 (diff) | |
download | txr-3466d04fb72ff63998fb047e39796c9a2845519b.tar.gz txr-3466d04fb72ff63998fb047e39796c9a2845519b.tar.bz2 txr-3466d04fb72ff63998fb047e39796c9a2845519b.zip |
* configure (lang_flags): Removing -D_BSD_SOURCE
from lang_flags. Adding a test for determining
which flag reveals BSD functions. This is due to the
braindamaged way feature selection macros work on
FreeBSD. There is no way to say "give me only the
functions from a certain version of the Unix spec,
plus traditional BSD functions", so we have to resort to
using the internal symbol __BSD_VISIBLE. Also, changing
the detection test for daemon function to the
pointer-based approach.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 41 |
1 files changed, 39 insertions, 2 deletions
@@ -97,7 +97,7 @@ yacc='$(cross)$(tool_prefix)$(yaccname)' yacc_given= nm='$(cross)$(tool_prefix)nm' opt_flags=-O2 -lang_flags='-ansi -D_BSD_SOURCE -D_XOPEN_SOURCE=500' +lang_flags='-ansi -D_XOPEN_SOURCE=500' diag_flags='-Wall -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=strict-prototypes' debug_flags=-g inline= @@ -803,6 +803,42 @@ case "$ccname" in esac # +# Detect stupid FreeBSD problem: no defined way to reveal +# traditional BSD functions if Unix compliance is selected with +# _XOPEN_SOURCE. Heaven help these troglodytes. +# + +printf "Detecting what symbol reveals BSD functions ... " + +cat > conftest.c <<! +#include <unistd.h> +#include <stdlib.h> + +int main(int argc, char **argv) +{ + int (*pdaemon)(int, int) = &daemon; +} +! + +if conftest ; then + printf "none needed\n" +else + for flag in _BSD_SOURCE __BSD_VISIBLE _GNU_SOURCE _X_OOPS; do + if [ $flag = _X_OOPS ] ; then + printf "failed\n" + break + fi + + if conftest EXTRA_FLAGS=-D$flag ; then + printf "%s\n" $flag + lang_flags="$lang_flags -D$flag" + gen_config_make + break + fi + done +fi + +# # Check for annoying warnings from ctype.h macros # @@ -1552,11 +1588,12 @@ fi printf "Checking for BSD daemon function ... " cat > conftest.c <<! +#include <stdlib.h> #include <unistd.h> int main(int argc, char **argv) { - return daemon(0, 0); + int (*pdaemon)(int, int) = &daemon; } ! if conftest ; then |