aboutsummaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-03-13 00:25:36 +0000
committerNick Mathewson <nickm@torproject.org>2006-03-13 00:25:36 +0000
commit0c132ee2a1be2a4f6ce081bc883d88dcd810e8b8 (patch)
treeb65b1a626cb3486ef8a3a3078760e9460223efb0 /configure.in
parentbd8ffccae7e1bb4030f9ca5e6dd9c8918256de75 (diff)
downloadtor-0c132ee2a1be2a4f6ce081bc883d88dcd810e8b8.tar.gz
tor-0c132ee2a1be2a4f6ce081bc883d88dcd810e8b8.zip
Instead of listing a set of compilers that prefers __func__ to __FUNCTION__, use autoconf. Also, prefer __func__ in our own code: __func__ is a C99 standard, whereas __FUNCTION__ is not. [Fixes bug 254.]
svn:r6144
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in39
1 files changed, 39 insertions, 0 deletions
diff --git a/configure.in b/configure.in
index ed8f94130e..c744049803 100644
--- a/configure.in
+++ b/configure.in
@@ -491,6 +491,45 @@ AC_CHECK_FUNC(gethostbyname_r, [
CFLAGS=$OLD_CFLAGS
])
+AC_CACHE_CHECK([whether the C compiler supports __func__],
+ ac_cv_have_func_macro,
+ AC_COMPILE_IFELSE([
+#include <stdio.h>
+int main(int c, char **v) { puts(__func__); }],
+ ac_cv_have_func_macro=yes,
+ ac_cv_have_func_macro=no))
+
+AC_CACHE_CHECK([whether the C compiler supports __FUNC__],
+ ac_cv_have_FUNC_macro,
+ AC_COMPILE_IFELSE([
+#include <stdio.h>
+int main(int c, char **v) { puts(__FUNC__); }],
+ ac_cv_have_FUNC_macro=yes,
+ ac_cv_have_FUNC_macro=no))
+
+AC_CACHE_CHECK([whether the C compiler supports __FUNCTION__],
+ ac_cv_have_FUNCTION_macro,
+ AC_COMPILE_IFELSE([
+#include <stdio.h>
+int main(int c, char **v) { puts(__FUNCTION__); }],
+ ac_cv_have_FUNCTION_macro=yes,
+ ac_cv_have_FUNCTION_macro=no))
+
+if test $ac_cv_have_func_macro = 'yes'; then
+ AC_DEFINE(HAVE_MACRO__func__, 1, [Defined if the compiler supports __func__])
+fi
+
+
+if test $ac_cv_have_FUNC_macro = 'yes'; then
+ AC_DEFINE(HAVE_MACRO__FUNC__, 1, [Defined if the compiler supports __FUNC__])
+fi
+
+if test $ac_cv_have_FUNCTION_macro = 'yes'; then
+ AC_DEFINE(HAVE_MACRO__FUNCTION__, 1,
+ [Defined if the compiler supports __FUNCTION__])
+fi
+
+
# $prefix stores the value of the --prefix command line option, or
# NONE if the option wasn't set. In the case that it wasn't set, make
# it be the default, so that we can use it to expand directories now.