]> ruderich.org/simon Gitweb - tlsproxy/tlsproxy.git/blobdiff - configure.ac
configure.ac: Use AX_PTHREAD to check for pthread.
[tlsproxy/tlsproxy.git] / configure.ac
index bab248a30e72e621db1f35da20a7a3955906a450..1d3592a0275eeb2926435f5ade18ba062f6e29bd 100644 (file)
@@ -26,6 +26,13 @@ AM_INIT_AUTOMAKE([foreign -Wall -Werror])
 
 AC_PROG_CC
 
+# Do this before setting additional flags as the code from AX_PTHREAD fails to
+# build with -Werror.
+AX_PTHREAD([],[AC_MSG_ERROR([pthread is required])])
+LIBS="$PTHREAD_LIBS $LIBS"
+CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
+CC="$PTHREAD_CC"
+
 if test "x$GCC" = xyes; then
     CFLAGS="-std=c89 -pedantic -Wall -Wextra -Werror $CFLAGS"
     CFLAGS="-Wno-error=int-to-pointer-cast $CFLAGS"
@@ -36,8 +43,6 @@ if test "x$GCC" = xyes; then
     LDFLAGS="-fPIE -pie -Wl,-z,relro -Wl,-z,now $LDFLAGS"
 fi
 
-AC_CHECK_LIB([pthread], [pthread_create],
-             [], [AC_MSG_ERROR([pthread is required])])
 AC_CHECK_LIB([gnutls], [gnutls_certificate_verify_peers2],
              [], [AC_MSG_ERROR([GnuTLS is required])])
 dnl Check for additional GnuTLS functions.