Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
4c08eb4b
Commit
4c08eb4b
authored
18 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
Make CURL_CHECK_NI_WITHSCOPEID actually try to compile NI_WITHSCOPEID when cross-compiling.
parent
01637304
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
acinclude.m4
+73
-78
73 additions, 78 deletions
acinclude.m4
ares/acinclude.m4
+73
-0
73 additions, 0 deletions
ares/acinclude.m4
with
146 additions
and
78 deletions
acinclude.m4
+
73
−
78
View file @
4c08eb4b
...
...
@@ -422,6 +422,79 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
]) # AC_DEFUN
dnl CURL_CHECK_NI_WITHSCOPEID
dnl -------------------------------------------------
dnl Check for working NI_WITHSCOPEID in getnameinfo()
AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
AC_CACHE_CHECK([for working NI_WITHSCOPEID],
[ac_cv_working_ni_withscopeid], [
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],[
#ifdef NI_WITHSCOPEID
struct sockaddr_storage ss;
int sslen = sizeof(ss);
int rc;
char hbuf[NI_MAXHOST];
int fd = socket(AF_INET6, SOCK_STREAM, 0);
if(fd < 0) {
perror("socket()");
return 1; /* Error creating socket */
}
rc = getsockname(fd, (struct sockaddr *)&ss, &sslen);
if(rc) {
perror("getsockname()");
return 2; /* Error retrieving socket name */
}
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID);
if(rc) {
printf("rc = %s\n", gai_strerror(rc));
return 3; /* Error translating socket address */
}
return 0; /* Ok, NI_WITHSCOPEID works */
#else
return 4; /* Error, NI_WITHSCOPEID not defined */
#endif
]) # AC_LANG_PROGRAM
],[
# Exit code == 0. Program worked.
ac_cv_working_ni_withscopeid="yes"
],[
# Exit code != 0. Program failed.
ac_cv_working_ni_withscopeid="no"
],[
# Program is not run when cross-compiling. So we assume
# NI_WITHSCOPEID will work if we are able to compile it.
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],[
unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
])
],[
ac_cv_working_ni_withscopeid="yes"
],[
ac_cv_working_ni_withscopeid="no"
]) # AC_COMPILE_IFELSE
]) # AC_RUN_IFELSE
]) # AC_CACHE_CHECK
if test "x$ac_cv_working_ni_withscopeid" = "xyes"; then
AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
[Define to 1 if NI_WITHSCOPEID exists and works.])
fi
]) # AC_DEFUN
dnl CURL_CHECK_NONBLOCKING_SOCKET
dnl -------------------------------------------------
dnl Check for how to set a socket to non-blocking state. There seems to exist
...
...
@@ -753,84 +826,6 @@ if test "$ac_cv_working_getaddrinfo" = "yes"; then
fi
])
dnl ************************************************************
dnl check for working NI_WITHSCOPEID in getnameinfo()
dnl
AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID],[
AC_CACHE_CHECK(for working NI_WITHSCOPEID, ac_cv_working_ni_withscopeid,[
AC_RUN_IFELSE([[
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int main()
{
#ifdef NI_WITHSCOPEID
struct sockaddr_storage ss;
int sslen = sizeof(ss);
int rc;
char hbuf[NI_MAXHOST];
int fd = socket(AF_INET6, SOCK_STREAM, 0);
if(fd < 0) {
perror("socket()");
return 1; /* couldn't create socket of either kind */
}
rc = getsockname(fd, (struct sockaddr *)&ss, &sslen);
if(rc) {
perror("getsockname()");
return 2;
}
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID);
if(rc) {
printf("rc = %s\n", gai_strerror(rc));
return 3;
}
return 0; /* everything works fine, use NI_WITHSCOPEID! */
#else
return 4; /* we don't seem to have the definition, don't use it */
#endif
}
]],
dnl program worked:
[ ac_cv_working_ni_withscopeid="yes" ],
dnl program failed:
[ ac_cv_working_ni_withscopeid="no" ],
dnl we cross-compile, check the headers using the preprocessor
[
AC_EGREP_CPP(WORKS,
[
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#ifdef NI_WITHSCOPEID
WORKS
#endif
],
ac_cv_working_ni_withscopeid="yes",
ac_cv_working_ni_withscopeid="no" )
]
) dnl end of AC_RUN_IFELSE
]) dnl end of AC_CACHE_CHECK
if test "$ac_cv_working_ni_withscopeid" = "yes"; then
AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
[Define if NI_WITHSCOPEID exists and works])
fi
]) dnl end of AC_DEFUN
AC_DEFUN([CURL_CHECK_LOCALTIME_R],
[
...
...
This diff is collapsed.
Click to expand it.
ares/acinclude.m4
+
73
−
0
View file @
4c08eb4b
...
...
@@ -401,6 +401,79 @@ AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
]) # AC_DEFUN
dnl CURL_CHECK_NI_WITHSCOPEID
dnl -------------------------------------------------
dnl Check for working NI_WITHSCOPEID in getnameinfo()
AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
AC_CACHE_CHECK([for working NI_WITHSCOPEID],
[ac_cv_working_ni_withscopeid], [
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],[
#ifdef NI_WITHSCOPEID
struct sockaddr_storage ss;
int sslen = sizeof(ss);
int rc;
char hbuf[NI_MAXHOST];
int fd = socket(AF_INET6, SOCK_STREAM, 0);
if(fd < 0) {
perror("socket()");
return 1; /* Error creating socket */
}
rc = getsockname(fd, (struct sockaddr *)&ss, &sslen);
if(rc) {
perror("getsockname()");
return 2; /* Error retrieving socket name */
}
rc = getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID);
if(rc) {
printf("rc = %s\n", gai_strerror(rc));
return 3; /* Error translating socket address */
}
return 0; /* Ok, NI_WITHSCOPEID works */
#else
return 4; /* Error, NI_WITHSCOPEID not defined */
#endif
]) # AC_LANG_PROGRAM
],[
# Exit code == 0. Program worked.
ac_cv_working_ni_withscopeid="yes"
],[
# Exit code != 0. Program failed.
ac_cv_working_ni_withscopeid="no"
],[
# Program is not run when cross-compiling. So we assume
# NI_WITHSCOPEID will work if we are able to compile it.
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
],[
unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
])
],[
ac_cv_working_ni_withscopeid="yes"
],[
ac_cv_working_ni_withscopeid="no"
]) # AC_COMPILE_IFELSE
]) # AC_RUN_IFELSE
]) # AC_CACHE_CHECK
if test "x$ac_cv_working_ni_withscopeid" = "xyes"; then
AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
[Define to 1 if NI_WITHSCOPEID exists and works.])
fi
]) # AC_DEFUN
dnl CURL_CHECK_NONBLOCKING_SOCKET
dnl -------------------------------------------------
dnl Check for how to set a socket to non-blocking state. There seems to exist
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment