aboutsummaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-06-13 11:37:11 -0400
committerNick Mathewson <nickm@torproject.org>2012-06-13 11:37:11 -0400
commit62a77f1117335f2ddee86f696379dde106ad1ee0 (patch)
tree232a3e69cf34b0230075441c29019cf2ed6af632 /acinclude.m4
parent9dd4e5a9b0f6415081df752b9cad331009eb5853 (diff)
parent4717951cfaa7bc97ace35b6a542495680844f407 (diff)
downloadtor-62a77f1117335f2ddee86f696379dde106ad1ee0.tar
tor-62a77f1117335f2ddee86f696379dde106ad1ee0.tar.gz
Merge remote-tracking branch 'public/bug5210'
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m442
1 files changed, 42 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index cb33dc36c..43280597a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -42,6 +42,48 @@ AC_DEFUN([TOR_DEFINE_CODEPATH],
AC_SUBST(TOR_LDFLAGS_$2)
])
+dnl 1:flags
+AC_DEFUN([TOR_CHECK_CFLAGS], [
+ AS_VAR_PUSHDEF([VAR],[tor_cv_cflags_$1])
+ AC_CACHE_CHECK([whether the compiler accepts $1], VAR, [
+ tor_saved_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -pedantic -Werror $1"
+ AC_TRY_COMPILE([], [return 0;],
+ [AS_VAR_SET(VAR,yes)],
+ [AS_VAR_SET(VAR,no)])
+ CFLAGS="$tor_saved_CFLAGS"
+ ])
+ if test x$VAR = xyes; then
+ CFLAGS="$CFLAGS $1"
+ fi
+ AS_VAR_POPDEF([VAR])
+])
+
+dnl 1:flags
+dnl 2:extra ldflags
+dnl 3:extra libraries
+AC_DEFUN([TOR_CHECK_LDFLAGS], [
+ AS_VAR_PUSHDEF([VAR],[tor_cv_ldflags_$1])
+ AC_CACHE_CHECK([whether the linker accepts $1], VAR, [
+ tor_saved_CFLAGS="$CFLAGS"
+ tor_saved_LDFLAGS="$LDFLAGS"
+ tor_saved_LIBS="$LIBS"
+ CFLAGS="$CFLAGS -pedantic -Werror"
+ LDFLAGS="$LDFLAGS $2 $1"
+ LIBS="$LIBS $3"
+ AC_TRY_LINK([], [return 0;],
+ [AS_VAR_SET(VAR,yes)],
+ [AS_VAR_SET(VAR,no)])
+ CFLAGS="$tor_saved_CFLAGS"
+ LDFLAGS="$tor_saved_LDFLAGS"
+ LIBS="$tor_saved_LIBS"
+ ])
+ if test x$VAR = xyes; then
+ LDFLAGS="$LDFLAGS $1"
+ fi
+ AS_VAR_POPDEF([VAR])
+])
+
dnl 1:libname
AC_DEFUN([TOR_WARN_MISSING_LIB], [
h=""