summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-06-05 06:37:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-06-05 06:37:27 -0700
commit3466d04fb72ff63998fb047e39796c9a2845519b (patch)
tree8049b9e44ab05b75007884ebd07a12606a6df52e
parent9ac1698bc322236e503ad8df7411e4cb6e521199 (diff)
downloadtxr-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.
-rw-r--r--ChangeLog13
-rwxr-xr-xconfigure41
2 files changed, 52 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index deb83046..8714e7bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2014-06-05 Kaz Kylheku <kaz@kylheku.com>
+
+ * 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.
+
2014-06-04 Kaz Kylheku <kaz@kylheku.com>
* configure (lang_flags): drop -D_POSIX_C_SOURCE=199309L.
diff --git a/configure b/configure
index 9c3a8dd8..055f8fdf 100755
--- a/configure
+++ b/configure
@@ -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