Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
e46b0a92
Commit
e46b0a92
authored
Oct 07, 2004
by
Andy Cedilnik
Browse files
ENH: Properly detect strerror_r for glibc or posix"
parent
387ffe94
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/CTest/Curl/CMake/CurlTests.c
View file @
e46b0a92
...
...
@@ -476,3 +476,48 @@ main ()
return
0
;
}
#endif
#ifdef HAVE_SO_NONBLOCK
/* headers for SO_NONBLOCK test (BeOS) */
#include
<sys/types.h>
#include
<unistd.h>
#include
<fcntl.h>
int
main
()
{
/* SO_NONBLOCK source code */
long
b
=
1
;
int
socket
;
int
flags
=
setsockopt
(
socket
,
SOL_SOCKET
,
SO_NONBLOCK
,
&
b
,
sizeof
(
b
));
return
0
;
}
#endif
#ifdef HAVE_GLIBC_STRERROR_R
#include
<string.h>
#include
<errno.h>
int
main
()
{
char
buffer
[
1024
];
/* big enough to play with */
char
*
string
=
strerror_r
(
EACCES
,
buffer
,
sizeof
(
buffer
));
/* this should've returned a string */
if
(
!
string
||
!
string
[
0
])
return
99
;
return
0
;
}
#endif
#ifdef HAVE_POSIX_STRERROR_R
#include
<string.h>
#include
<errno.h>
int
main
()
{
char
buffer
[
1024
];
/* big enough to play with */
int
error
=
strerror_r
(
EACCES
,
buffer
,
sizeof
(
buffer
));
/* This should've returned zero, and written an error string in the
buffer.*/
if
(
!
buffer
[
0
]
||
error
)
return
99
;
return
0
;
}
#endif
Source/CTest/Curl/CMakeLists.txt
View file @
e46b0a92
...
...
@@ -360,12 +360,46 @@ MACRO(CURL_INTERNAL_TEST CURL_TEST)
ELSE
(
${
CURL_TEST
}
)
MESSAGE
(
STATUS
"Performing Curl Test
${
CURL_TEST
}
- Failed"
)
SET
(
${
CURL_TEST
}
""
CACHE INTERNAL
"Curl test
${
FUNCTION
}
"
)
WRITE_FILE
(
${
CMAKE_BINARY_DIR
}
/CMakeError.log
FILE
(
APPEND
${
CMAKE_BINARY_DIR
}
/CMakeError.log
"Performing Curl Test
${
CURL_TEST
}
failed with the following output:
\n
"
"
${
OUTPUT
}
\n
"
APPEND
)
"
${
OUTPUT
}
\n
"
)
ENDIF
(
${
CURL_TEST
}
)
ENDIF
(
"
${
CURL_TEST
}
"
MATCHES
"^
${
CURL_TEST
}
$"
)
ENDMACRO
(
CURL_INTERNAL_TEST
)
MACRO
(
CURL_INTERNAL_TEST_RUN CURL_TEST
)
IF
(
"
${
CURL_TEST
}
_COMPILE"
MATCHES
"^
${
CURL_TEST
}
_COMPILE$"
)
SET
(
MACRO_CHECK_FUNCTION_DEFINITIONS
"-D
${
CURL_TEST
}
${
CMAKE_REQUIRED_FLAGS
}
"
)
IF
(
CMAKE_REQUIRED_LIBRARIES
)
SET
(
CURL_TEST_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=
${
CMAKE_REQUIRED_LIBRARIES
}
"
)
ENDIF
(
CMAKE_REQUIRED_LIBRARIES
)
MESSAGE
(
STATUS
"Performing Curl Test
${
CURL_TEST
}
"
)
TRY_RUN
(
${
CURL_TEST
}
${
CURL_TEST
}
_COMPILE
${
CMAKE_BINARY_DIR
}
${
LIBCURL_SOURCE_DIR
}
/CMake/CurlTests.c
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=
${
MACRO_CHECK_FUNCTION_DEFINITIONS
}
"
${
CURL_TEST_ADD_LIBRARIES
}
"
OUTPUT_VARIABLE OUTPUT
)
IF
(
${
CURL_TEST
}
_COMPILE AND NOT
${
CURL_TEST
}
)
SET
(
${
CURL_TEST
}
1 CACHE INTERNAL
"Curl test
${
FUNCTION
}
"
)
MESSAGE
(
STATUS
"Performing Curl Test
${
CURL_TEST
}
- Success"
)
ELSE
(
${
CURL_TEST
}
_COMPILE AND NOT
${
CURL_TEST
}
)
MESSAGE
(
STATUS
"Performing Curl Test
${
CURL_TEST
}
- Failed"
)
SET
(
${
CURL_TEST
}
""
CACHE INTERNAL
"Curl test
${
FUNCTION
}
"
)
FILE
(
APPEND
"
${
CMAKE_BINARY_DIR
}
/CMakeError.log"
"Performing Curl Test
${
CURL_TEST
}
failed with the following output:
\n
"
"
${
OUTPUT
}
"
)
IF
(
${
CURL_TEST
}
_COMPILE
)
FILE
(
APPEND
"
${
CMAKE_BINARY_DIR
}
/CMakeError.log"
"There was a running problem of this test
\n
"
)
ENDIF
(
${
CURL_TEST
}
_COMPILE
)
FILE
(
APPEND
"
${
CMAKE_BINARY_DIR
}
/CMakeError.log"
"
\n\n
"
)
ENDIF
(
${
CURL_TEST
}
_COMPILE AND NOT
${
CURL_TEST
}
)
ENDIF
(
"
${
CURL_TEST
}
_COMPILE"
MATCHES
"^
${
CURL_TEST
}
_COMPILE$"
)
ENDMACRO
(
CURL_INTERNAL_TEST_RUN
)
# Do curl specific tests
#OPTION(CURL_HAVE_DISABLED_NONBLOCKING "Disable non-blocking socket detection" OFF)
...
...
@@ -376,6 +410,7 @@ IF(NOT CURL_HAVE_DISABLED_NONBLOCKING)
HAVE_IOCTLSOCKET
HAVE_IOCTLSOCKET_CASE
HAVE_O_NONBLOCK
HAVE_SO_NONBLOCK
)
ENDIF
(
NOT CURL_HAVE_DISABLED_NONBLOCKING
)
FOREACH
(
CURL_TEST
...
...
@@ -408,6 +443,13 @@ IF(HAVE_FILE_OFFSET_BITS)
SET
(
_FILE_OFFSET_BITS 64
)
ENDIF
(
HAVE_FILE_OFFSET_BITS
)
FOREACH
(
CURL_TEST
HAVE_GLIBC_STRERROR_R
HAVE_POSIX_STRERROR_R
)
CURL_INTERNAL_TEST_RUN
(
${
CURL_TEST
}
)
ENDFOREACH
(
CURL_TEST
)
# Check for reentrant
FOREACH
(
CURL_TEST
HAVE_GETHOSTBYADDR_R_5
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment