aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-02-07 18:13:40 +0000
committerYang Tse <yangsita@gmail.com>2007-02-07 18:13:40 +0000
commit7a39b98471fcf5c4fc61d6fbdaa69bdb1acb1115 (patch)
tree04db46f3c5f2030feba7ba604caba2d0127f91ec
parent4ab91a93e8a895fd8c2f9b4523c3129110def8fc (diff)
use same AIX XLC compiler options as curl's
-rw-r--r--ares/configure.ac78
1 files changed, 78 insertions, 0 deletions
diff --git a/ares/configure.ac b/ares/configure.ac
index 05262b965..fc8ac4bd4 100644
--- a/ares/configure.ac
+++ b/ares/configure.ac
@@ -78,6 +78,13 @@ AC_MSG_RESULT($need_no_undefined)
AM_CONDITIONAL(NO_UNDEFINED, test x$need_no_undefined = xyes)
dnl **********************************************************************
+dnl check if this is the Intel ICC compiler, and if so make it stricter
+dnl (convert warning 147 into an error) so that it properly can detect the
+dnl gethostbyname_r() version
+dnl **********************************************************************
+CURL_DETECT_ICC([CFLAGS="$CFLAGS -we 147"])
+
+dnl **********************************************************************
dnl Checks for libraries.
dnl **********************************************************************
@@ -198,6 +205,77 @@ AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
AC_MSG_RESULT(no)
)
+
+dnl Default is to try the thread-safe versions of a few functions
+OPT_THREAD=on
+
+dnl detect AIX 4.3 or later
+AC_MSG_CHECKING([AIX 4.3 or later])
+AC_PREPROC_IFELSE([
+#if defined(_AIX) && defined(_AIX43)
+printf("just fine");
+#else
+#error "this is not AIX 4.3 or later"
+#endif
+],
+ [ AC_MSG_RESULT([yes])
+ RECENTAIX=yes
+ OPT_THREAD=off ],
+ [ AC_MSG_RESULT([no]) ]
+)
+
+AC_ARG_ENABLE(thread,dnl
+AC_HELP_STRING([--disable-thread],[don't look for thread-safe functions])
+AC_HELP_STRING([--enable-thread],[look for thread-safe functions]),
+[ case "$enableval" in
+ no)
+ OPT_THREAD=off
+ AC_MSG_WARN(c-ares will not get built using thread-safe functions)
+ ;;
+ *)
+ ;;
+ esac
+]
+)
+
+if test X"$OPT_THREAD" = Xoff
+then
+ AC_DEFINE(DISABLED_THREADSAFE, 1,
+ [Set to explicitly specify we don't want to use thread-safe functions])
+fi
+
+dnl for recent AIX versions, we skip all the thread-safe checks above since
+dnl they claim a thread-safe libc using the standard API. But there are
+dnl some functions still not thread-safe. Check for these!
+
+dnl Let's hope this split URL remains working:
+dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
+dnl genprogc/thread_quick_ref.htm
+
+if test "x$RECENTAIX" = "xyes"; then
+
+ AC_DEFINE(_THREAD_SAFE, 1, [define this if you need it to compile thread-safe code])
+
+ dnl check if this is the IBM xlc compiler
+ dnl Details thanks to => http://predef.sourceforge.net/
+ AC_MSG_CHECKING([if this is the xlc compiler])
+ AC_EGREP_CPP([^__xlC__], [__xlC__],
+ dnl action if the text is found, this it has not been replaced by the
+ dnl cpp
+ XLC="no"
+ AC_MSG_RESULT([no]),
+ dnl the text was not found, it was replaced by the cpp
+ XLC="yes"
+ AC_MSG_RESULT([yes])
+ CFLAGS="$CFLAGS -qthreaded"
+ dnl AIX xlc has to have strict aliasing turned off. If not,
+ dnl the optimizer assumes that pointers can only point to
+ dnl an object of the same type.
+ CFLAGS="$CFLAGS -qnoansialias"
+ )
+fi
+
+
dnl **********************************************************************
dnl Back to "normal" configuring
dnl **********************************************************************