summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2013-12-23 11:31:36 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2013-12-23 11:31:36 +0100
commitaeb2a25fdf5e80d2c138f745276977abf8e11314 (patch)
tree4adf0658515688bbcc52987bc4a532d1eaa12b8c /configure.ac
parentbe06eb600e8805fafc58e27fbb9a8edf3739a3e7 (diff)
downloadgnutls-aeb2a25fdf5e80d2c138f745276977abf8e11314.tar.gz
Ported Alon's patch to correctly check for librt (et al.)
This also makes clock_gettime() check independent of the FIPS140 option.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac82
1 files changed, 43 insertions, 39 deletions
diff --git a/configure.ac b/configure.ac
index 87430804f3..225349f95b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,6 +143,49 @@ AM_GNU_GETTEXT_VERSION([0.18])
AC_C_BIGENDIAN
+dnl No fork on MinGW, disable some self-tests until we fix them.
+dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs)
+AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv localtime vasprintf],,)
+AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
+
+AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>
+#include <signal.h>
+], [timer_create (0,0,0);])
+
+if test "$ac_cv_func_pthread_mutex_lock" != "yes";then
+ AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
+fi
+
+if test "$ac_cv_func_nanosleep" != "yes";then
+ AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>], [nanosleep (0, 0);])
+ gnutls_needs_librt=yes
+fi
+
+if test "$ac_cv_func_clock_gettime" != "yes";then
+ AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>], [clock_gettime (0, 0);])
+ gnutls_needs_librt=yes
+fi
+
+ac_have_unicode=no
+if test "$ac_cv_func_iconv" != "yes";then
+ AC_LIB_HAVE_LINKFLAGS(iconv,, [#include <iconv.h>], [iconv (0, 0, 0, 0, 0);])
+ if test "$HAVE_LIBICONV" = "yes";then
+ ac_have_unicode=yes
+ fi
+else
+ ac_have_unicode=yes
+fi
+
+if test "$ac_have_unicode" != "yes";then
+ if test "$have_win" = "yes";then
+ ac_have_unicode=yes
+ fi
+fi
+
+dnl Note that g*l_INIT are run after we check for library capabilities,
+dnl to prevent issues from caching lib dependencies. See discussion
+dnl in https://bugs.gentoo.org/show_bug.cgi?id=494940 and
+dnl http://gnu-autoconf.7623.n7.nabble.com/Correct-way-to-check-for-clock-gettime-td12276.html
gl_INIT
ggl_INIT
@@ -217,39 +260,6 @@ AC_PROG_LN_S
LT_INIT([disable-static,win32-dll,shared])
-dnl No fork on MinGW, disable some self-tests until we fix them.
-dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs)
-AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv localtime vasprintf],,)
-AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
-
-AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>
-#include <signal.h>
-], [timer_create (0,0,0);])
-
-if test "$ac_cv_func_pthread_mutex_lock" != "yes";then
- AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
-fi
-
-if test "$ac_cv_func_nanosleep" != "yes";then
- AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>], [nanosleep (0, 0);])
- gnutls_needs_librt=yes
-fi
-
-ac_have_unicode=no
-if test "$ac_cv_func_iconv" != "yes";then
- AC_LIB_HAVE_LINKFLAGS(iconv,, [#include <iconv.h>], [iconv (0, 0, 0, 0, 0);])
- if test "$HAVE_LIBICONV" = "yes";then
- ac_have_unicode=yes
- fi
-else
- ac_have_unicode=yes
-fi
-
-if test "$ac_have_unicode" != "yes";then
- if test "$have_win" = "yes";then
- ac_have_unicode=yes
- fi
-fi
AC_ARG_ENABLE(self-checks,
AS_HELP_STRING([--enable-self-checks], [enable self checking functionality]),
@@ -264,12 +274,6 @@ if [ test "$enable_fips" = "yes" ];then
if test "x$HAVE_LIBDL" = "xyes";then
enable_self_checks=yes
- dnl clock_gettime precision is needed on the FIPS140 DRBG.
- if test "$ac_cv_func_clock_gettime" != "yes";then
- AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>], [clock_gettime (0, 0);])
- gnutls_needs_librt=yes
- fi
-
AC_DEFINE([ENABLE_FIPS140], 1, [Enable FIPS140-2 mode])
AC_SUBST([FIPS140_LIBS], $LIBDL)