You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/06/12 09:45:09 UTC
svn commit: r784016 -
/commons/sandbox/runtime/trunk/src/main/native/configure
Author: mturk
Date: Fri Jun 12 07:45:09 2009
New Revision: 784016
URL: http://svn.apache.org/viewvc?rev=784016&view=rev
Log:
Add generic have_function test to the configure
Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=784016&r1=784015&r2=784016&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Fri Jun 12 07:45:09 2009
@@ -484,39 +484,25 @@
echo $rc
}
-have_strerror_r()
+have_function()
{
- printf "Checking for %-32s" "strerror_r" 1>&2
+ printf "Checking for %-32s" "$1" 1>&2
cat > $test.c << EOF
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-int main() {char b[256]; strerror_r(1, b, sizeof(b)); return 0;}
-EOF
- rc=0
- $cc $ccflags $cppopts $test.c -o $test$exe >/dev/null 2>&1
- if [ -x $test$exe ]; then
- ./$test$exe
- rv=$?
- if [ ".$rv" = ".0" ]; then rc=1; fi
- fi
- rm -rf $test.* $test *.pdb >/dev/null 2>&1 || true
- if [ $rc = 1 ]; then
- echo ok 1>&2
- else
- echo "not found" 1>&2
- fi
- echo $rc
-}
-
-have_sock_cloexec()
-{
- printf "Checking for %-32s" "SOCK_CLOEXEC flag" 1>&2
- cat > $test.c << EOF
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-int main() {return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1;}
+#define $1 innocuous_$1
+#ifdef __STDC__
+#include <limits.h>
+#else
+#include <assert.h>
+#endif
+#undef $1
+#ifdef __cplusplus
+extern "C"
+#endif
+char $1 ();
+#if defined __stub_$1 || defined __stub___$1
+choke me
+#endif
+int main() { return (int) $1 ();}
EOF
rc=0
co="`$cc $ccflags $cppopts $test.c -o $test$exe 2>&1`"
@@ -536,14 +522,14 @@
echo $rc
}
-have_epoll_create1()
+have_sock_cloexec()
{
- printf "Checking for %-32s" "epoll_create1" 1>&2
+ printf "Checking for %-32s" "SOCK_CLOEXEC flag" 1>&2
cat > $test.c << EOF
#include <stdlib.h>
#include <sys/types.h>
-#include <sys/epoll.h>
-int main() {return epoll_create1(EPOLL_CLOEXEC) == -1;}
+#include <sys/socket.h>
+int main() {return socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0) == -1;}
EOF
rc=0
co="`$cc $ccflags $cppopts $test.c -o $test$exe 2>&1`"
@@ -668,9 +654,9 @@
#define HAVE_NETINET_IN_H `have_include netinet/in`
#define HAVE_ARPA_INET_H `have_include arpa/inet`
#define HAVE_SYS_UN_H `have_include sys/un`
-#define HAVE_STRERROR_R `have_strerror_r`
+#define HAVE_STRERROR_R `have_function strerror_r`
+#define HAVE_EPOLL_CREATE1 `have_function epoll_create1`
#define HAVE_SOCK_CLOEXEC `have_sock_cloexec`
-#define HAVE_EPOLL_CREATE1 `have_epoll_create1`
#define CC_SIZEOF_INT $sizeof_int
#define CC_SIZEOF_WCHAR_T $sizeof_wchar