summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure86
1 files changed, 78 insertions, 8 deletions
diff --git a/configure b/configure
index e318ef17..51e067a9 100755
--- a/configure
+++ b/configure
@@ -84,6 +84,7 @@ opt_flags=-O2
lang_flags='-ansi -D_XOPEN_SOURCE=2'
diag_flags='-Wall -Wmissing-prototypes -Wstrict-prototypes'
debug_flags=-g
+config_flags=' -Werror' # special: used only during configure
inline=
platform_flags=
remove_flags=
@@ -98,6 +99,9 @@ mpi_version=1.8.6
have_quilt=
have_patch=
have_unistd=
+have_timegm=
+need_svid_source=
+need_bsd_source=
#
# Parse configuration variables
@@ -583,7 +587,7 @@ NM := $nm
OPT_FLAGS := $opt_flags
LANG_FLAGS := $lang_flags
-DIAG_FLAGS := $diag_flags
+DIAG_FLAGS := $diag_flags$config_flags
DBG_FLAGS := $debug_flags
PLATFORM_FLAGS := $platform_flags
REMOVE_FLAGS := $remove_flags
@@ -1152,14 +1156,10 @@ printf "Checking whether we have <sys/stat.h> ... "
cat > conftest.c <<!
#include <sys/stat.h>
-int main(void)
-{
- struct stat s;
- return 0;
-}
+struct stat s;
!
rm -f conftest
-if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then
+if ! $make conftest.o > conftest.err 2>&1; then
printf "no\n"
else
printf "yes\n"
@@ -1250,7 +1250,7 @@ fi
# Check for fields inside struct tm
#
-printf "Printf detecting timezone fields in struct tm ..."
+printf "Printf detecting timezone fields in struct tm ... "
tm_gmtoff=
tm_tmzone=
@@ -1283,6 +1283,69 @@ done
printf "done\n"
+printf "Checking for timegm function ... "
+
+cat > conftest.c <<!
+#include <time.h>
+
+int main(void)
+{
+ struct tm tms = { 0 };
+ timegm(&tms);
+ return 0;
+}
+!
+rm -f conftest
+if ! $make EXTRA_FLAGS='-D_SVID_SOURCE' conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then
+ printf "no\n"
+else
+ printf "yes\n"
+ printf "#define HAVE_TIMEGM 1\n" >> config.h
+ have_timegm=y
+ need_svid_source=y
+fi
+
+if [ -z "$have_timegm" ] ; then
+ printf "Checking for setenv and unsetenv functions ... "
+
+ cat > conftest.c <<!
+#include <stdlib.h>
+
+int main(void)
+{
+ setenv("TERM", "foo", 1);
+ unsetenv("TERM");
+ return 0;
+}
+!
+ rm -f conftest
+ if ! $make EXTRA_FLAGS='-D_BSD_SOURCE' conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then
+ printf "no\n"
+ else
+ printf "yes\n"
+ printf "#define HAVE_SETENV 1\n" >> config.h
+ need_bsd_source=y
+ fi
+fi
+printf "Checking for tzset function ... "
+
+cat > conftest.c <<!
+#include <time.h>
+
+int main(void)
+{
+ tzset();
+ return 0;
+}
+!
+rm -f conftest
+if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then
+ printf "no\n"
+else
+ printf "yes\n"
+ printf "#define HAVE_TZSET 1\n" >> config.h
+fi
+
printf "Checking for POSIX sleep function ... "
cat > conftest.c <<!
@@ -1423,6 +1486,13 @@ fi
#
printf "Regenerating config.make ... "
+config_flags=
+if [ -n "$need_svid_source" ] ; then
+ lang_flags="$lang_flags -D_SVID_SOURCE"
+fi
+if [ -n "$need_bsd_source" ] ; then
+ lang_flags="$lang_flags -D_BSD_SOURCE"
+fi
gen_config_make
printf "done\n"