diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-11 15:08:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-11 15:08:16 -0400 |
commit | e36cd016337f26188f572e0bd511a4f8b72c07dc (patch) | |
tree | 6abd9705c4b1922b3b62940ee73b3315239a8776 /acinclude.m4 | |
parent | 62f3121a3d209fb4f826988d53b1aac93842502c (diff) | |
download | tor-e36cd016337f26188f572e0bd511a4f8b72c07dc.tar.gz tor-e36cd016337f26188f572e0bd511a4f8b72c07dc.zip |
Try to manually test for whether the compiler hardening flags work
Also, make the check for whether they're on by default work; there's
no need to mess around with this "$enableval" silliness.
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index ccfecff28d..c482e37546 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -41,6 +41,40 @@ 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 $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 +AC_DEFUN([TOR_CHECK_LDFLAGS], [ + AS_VAR_PUSHDEF([VAR],[tor_cv_ldflags_$1]) + AC_CACHE_CHECK([whether the linker accepts $1], VAR, [ + tor_saved_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $1" + AC_TRY_LINK([], [return 0;], + [AS_VAR_SET(VAR,yes)], + [AS_VAR_SET(VAR,no)]) + LDFLAGS="$tor_saved_LDFLAGS" + ]) + if test x$VAR = xyes; then + LDFLAGS="$LDFLAGS $1" + fi + AS_VAR_POPDEF([VAR]) +]) + dnl 1:libname AC_DEFUN([TOR_WARN_MISSING_LIB], [ h="" |