forked from c-ares/c-ares
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update to latest autoconf-archive macros
- Loading branch information
Showing
8 changed files
with
146 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# =========================================================================== | ||
# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html | ||
# =========================================================================== | ||
# ============================================================================ | ||
# https://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html | ||
# ============================================================================ | ||
# | ||
# SYNOPSIS | ||
# | ||
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS]) | ||
# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) | ||
# | ||
# DESCRIPTION | ||
# | ||
|
@@ -20,6 +20,8 @@ | |
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to | ||
# force the compiler to issue an error when a bad flag is given. | ||
# | ||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE. | ||
# | ||
# NOTE: This macro depends on the AX_APPEND_FLAG and | ||
# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with | ||
# AX_APPEND_LINK_FLAGS. | ||
|
@@ -28,38 +30,17 @@ | |
# | ||
# Copyright (c) 2011 Maarten Bosmans <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation, either version 3 of the License, or (at your | ||
# option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# As a special exception, the respective Autoconf Macro's copyright owner | ||
# gives unlimited permission to copy, distribute and modify the configure | ||
# scripts that are the output of Autoconf when processing the Macro. You | ||
# need not follow the terms of the GNU General Public License when using | ||
# or distributing such scripts, even though portions of the text of the | ||
# Macro appear in them. The GNU General Public License (GPL) does govern | ||
# all other use of the material that constitutes the Autoconf Macro. | ||
# | ||
# This special exception to the GPL applies to versions of the Autoconf | ||
# Macro released by the Autoconf Archive. When you make and distribute a | ||
# modified version of the Autoconf Macro, you may extend this special | ||
# exception to the GPL to apply to your modified version as well. | ||
# Copying and distribution of this file, with or without modification, are | ||
# permitted in any medium without royalty provided the copyright notice | ||
# and this notice are preserved. This file is offered as-is, without any | ||
# warranty. | ||
|
||
#serial 3 | ||
#serial 7 | ||
|
||
AC_DEFUN([AX_APPEND_COMPILE_FLAGS], | ||
[AC_REQUIRE([AX_CHECK_COMPILE_FLAG]) | ||
AC_REQUIRE([AX_APPEND_FLAG]) | ||
[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) | ||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) | ||
for flag in $1; do | ||
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3]) | ||
AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) | ||
done | ||
])dnl AX_APPEND_COMPILE_FLAGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# =========================================================================== | ||
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html | ||
# https://www.gnu.org/software/autoconf-archive/ax_append_flag.html | ||
# =========================================================================== | ||
# | ||
# SYNOPSIS | ||
|
@@ -23,47 +23,28 @@ | |
# Copyright (c) 2008 Guido U. Draheim <[email protected]> | ||
# Copyright (c) 2011 Maarten Bosmans <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation, either version 3 of the License, or (at your | ||
# option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# As a special exception, the respective Autoconf Macro's copyright owner | ||
# gives unlimited permission to copy, distribute and modify the configure | ||
# scripts that are the output of Autoconf when processing the Macro. You | ||
# need not follow the terms of the GNU General Public License when using | ||
# or distributing such scripts, even though portions of the text of the | ||
# Macro appear in them. The GNU General Public License (GPL) does govern | ||
# all other use of the material that constitutes the Autoconf Macro. | ||
# | ||
# This special exception to the GPL applies to versions of the Autoconf | ||
# Macro released by the Autoconf Archive. When you make and distribute a | ||
# modified version of the Autoconf Macro, you may extend this special | ||
# exception to the GPL to apply to your modified version as well. | ||
# Copying and distribution of this file, with or without modification, are | ||
# permitted in any medium without royalty provided the copyright notice | ||
# and this notice are preserved. This file is offered as-is, without any | ||
# warranty. | ||
|
||
#serial 2 | ||
#serial 8 | ||
|
||
AC_DEFUN([AX_APPEND_FLAG], | ||
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX | ||
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl | ||
AS_VAR_SET_IF(FLAGS, | ||
[case " AS_VAR_GET(FLAGS) " in | ||
*" $1 "*) | ||
AC_RUN_LOG([: FLAGS already contains $1]) | ||
;; | ||
*) | ||
AC_RUN_LOG([: FLAGS="$FLAGS $1"]) | ||
AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"]) | ||
;; | ||
esac], | ||
[AS_VAR_SET(FLAGS,["$1"])]) | ||
[dnl | ||
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF | ||
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) | ||
AS_VAR_SET_IF(FLAGS,[ | ||
AS_CASE([" AS_VAR_GET(FLAGS) "], | ||
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], | ||
[ | ||
AS_VAR_APPEND(FLAGS,[" $1"]) | ||
AC_RUN_LOG([: FLAGS="$FLAGS"]) | ||
]) | ||
], | ||
[ | ||
AS_VAR_SET(FLAGS,[$1]) | ||
AC_RUN_LOG([: FLAGS="$FLAGS"]) | ||
]) | ||
AS_VAR_POPDEF([FLAGS])dnl | ||
])dnl AX_APPEND_FLAG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# =========================================================================== | ||
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html | ||
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html | ||
# =========================================================================== | ||
# | ||
# SYNOPSIS | ||
# | ||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) | ||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) | ||
# | ||
# DESCRIPTION | ||
# | ||
|
@@ -19,6 +19,8 @@ | |
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to | ||
# force the compiler to issue an error when a bad flag is given. | ||
# | ||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE. | ||
# | ||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this | ||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. | ||
# | ||
|
@@ -27,45 +29,34 @@ | |
# Copyright (c) 2008 Guido U. Draheim <[email protected]> | ||
# Copyright (c) 2011 Maarten Bosmans <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation, either version 3 of the License, or (at your | ||
# option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | ||
# Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# As a special exception, the respective Autoconf Macro's copyright owner | ||
# gives unlimited permission to copy, distribute and modify the configure | ||
# scripts that are the output of Autoconf when processing the Macro. You | ||
# need not follow the terms of the GNU General Public License when using | ||
# or distributing such scripts, even though portions of the text of the | ||
# Macro appear in them. The GNU General Public License (GPL) does govern | ||
# all other use of the material that constitutes the Autoconf Macro. | ||
# | ||
# This special exception to the GPL applies to versions of the Autoconf | ||
# Macro released by the Autoconf Archive. When you make and distribute a | ||
# modified version of the Autoconf Macro, you may extend this special | ||
# exception to the GPL to apply to your modified version as well. | ||
# Copying and distribution of this file, with or without modification, are | ||
# permitted in any medium without royalty provided the copyright notice | ||
# and this notice are preserved. This file is offered as-is, without any | ||
# warranty. | ||
|
||
#serial 2 | ||
#serial 11 | ||
|
||
AC_DEFUN([AX_CHECK_COMPILE_FLAG], | ||
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX | ||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF | ||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl | ||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ | ||
AC_CACHE_CHECK([whether the _AC_LANG compiler accepts $1], CACHEVAR, [ | ||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS | ||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" | ||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], | ||
if test x"m4_case(_AC_LANG, | ||
[C], [$GCC], | ||
[C++], [$GXX], | ||
[Fortran], [$GFC], | ||
[Fortran 77], [$G77], | ||
[Objective C], [$GOBJC], | ||
[Objective C++], [$GOBJCXX], | ||
[no])" = xyes ; then | ||
add_gnu_werror="-Werror" | ||
fi | ||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 $add_gnu_werror" | ||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], | ||
[AS_VAR_SET(CACHEVAR,[yes])], | ||
[AS_VAR_SET(CACHEVAR,[no])]) | ||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) | ||
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], | ||
AS_VAR_IF(CACHEVAR,yes, | ||
[m4_default([$2], :)], | ||
[m4_default([$3], :)]) | ||
AS_VAR_POPDEF([CACHEVAR])dnl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1 @@ | ||
# -*- Autoconf -*- | ||
|
||
# SYNOPSIS | ||
# | ||
# AX_CHECK_USER_NAMESPACE | ||
# | ||
# DESCRIPTION | ||
# | ||
# This macro checks whether the local system supports Linux user namespaces. | ||
# If so, it calls AC_DEFINE(HAVE_USER_NAMESPACE). | ||
# | ||
# Copyright (C) The c-ares team | ||
# SPDX-License-Identifier: MIT | ||
|
||
AC_DEFUN([AX_CHECK_USER_NAMESPACE],[dnl | ||
AC_CACHE_CHECK([whether user namespaces are supported], | ||
ax_cv_user_namespace,[ | ||
AC_LANG_PUSH([C]) | ||
AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
#define _GNU_SOURCE | ||
#include <fcntl.h> | ||
#include <sched.h> | ||
#include <signal.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <sys/types.h> | ||
#include <sys/wait.h> | ||
int userfn(void *d) { | ||
usleep(100000); /* synchronize by sleep */ | ||
return (getuid() != 0); | ||
} | ||
char userst[1024*1024]; | ||
int main() { | ||
char buffer[1024]; | ||
int rc, status, fd; | ||
pid_t child = clone(userfn, userst + 1024*1024, CLONE_NEWUSER|SIGCHLD, 0); | ||
if (child < 0) return 1; | ||
snprintf(buffer, sizeof(buffer), "/proc/%d/uid_map", child); | ||
fd = open(buffer, O_CREAT|O_WRONLY|O_TRUNC, 0755); | ||
snprintf(buffer, sizeof(buffer), "0 %d 1\n", getuid()); | ||
write(fd, buffer, strlen(buffer)); | ||
close(fd); | ||
rc = waitpid(child, &status, 0); | ||
if (rc <= 0) return 1; | ||
if (!WIFEXITED(status)) return 1; | ||
return WEXITSTATUS(status); | ||
} | ||
]])],[ax_cv_user_namespace=yes],[ax_cv_user_namespace=no],[ax_cv_user_namespace=no]) | ||
AC_LANG_POP([C]) | ||
]) | ||
if test "$ax_cv_user_namespace" = yes; then | ||
AC_DEFINE([HAVE_USER_NAMESPACE],[1],[Whether user namespaces are available]) | ||
fi | ||
]) # AX_CHECK_USER_NAMESPACE | ||
404: Not Found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1 @@ | ||
# -*- Autoconf -*- | ||
|
||
# SYNOPSIS | ||
# | ||
# AX_CHECK_UTS_NAMESPACE | ||
# | ||
# DESCRIPTION | ||
# | ||
# This macro checks whether the local system supports Linux UTS namespaces. | ||
# Also requires user namespaces to be available, so that non-root users | ||
# can enter the namespace. | ||
# If so, it calls AC_DEFINE(HAVE_UTS_NAMESPACE). | ||
# | ||
# Copyright (C) The c-ares team | ||
# SPDX-License-Identifier: MIT | ||
|
||
AC_DEFUN([AX_CHECK_UTS_NAMESPACE],[dnl | ||
AC_CACHE_CHECK([whether UTS namespaces are supported], | ||
ax_cv_uts_namespace,[ | ||
AC_LANG_PUSH([C]) | ||
AC_RUN_IFELSE([AC_LANG_SOURCE([[ | ||
#define _GNU_SOURCE | ||
#include <sched.h> | ||
#include <signal.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <sys/types.h> | ||
#include <sys/wait.h> | ||
int utsfn(void *d) { | ||
char buffer[1024]; | ||
const char *name = "autoconftest"; | ||
int rc = sethostname(name, strlen(name)); | ||
if (rc != 0) return 1; | ||
gethostname(buffer, 1024); | ||
return (strcmp(buffer, name) != 0); | ||
} | ||
char st2[1024*1024]; | ||
int fn(void *d) { | ||
pid_t child; | ||
int rc, status; | ||
usleep(100000); /* synchronize by sleep */ | ||
if (getuid() != 0) return 1; | ||
child = clone(utsfn, st2 + 1024*1024, CLONE_NEWUTS|SIGCHLD, 0); | ||
if (child < 0) return 1; | ||
rc = waitpid(child, &status, 0); | ||
if (rc <= 0) return 1; | ||
if (!WIFEXITED(status)) return 1; | ||
return WEXITSTATUS(status); | ||
} | ||
char st[1024*1024]; | ||
int main() { | ||
char buffer[1024]; | ||
int rc, status, fd; | ||
pid_t child = clone(fn, st + 1024*1024, CLONE_NEWUSER|SIGCHLD, 0); | ||
if (child < 0) return 1; | ||
snprintf(buffer, sizeof(buffer), "/proc/%d/uid_map", child); | ||
fd = open(buffer, O_CREAT|O_WRONLY|O_TRUNC, 0755); | ||
snprintf(buffer, sizeof(buffer), "0 %d 1\n", getuid()); | ||
write(fd, buffer, strlen(buffer)); | ||
close(fd); | ||
rc = waitpid(child, &status, 0); | ||
if (rc <= 0) return 1; | ||
if (!WIFEXITED(status)) return 1; | ||
return WEXITSTATUS(status); | ||
} | ||
]]) | ||
],[ax_cv_uts_namespace=yes],[ax_cv_uts_namespace=no],[ax_cv_uts_namespace=no]) | ||
AC_LANG_POP([C]) | ||
]) | ||
if test "$ax_cv_uts_namespace" = yes; then | ||
AC_DEFINE([HAVE_UTS_NAMESPACE],[1],[Whether UTS namespaces are available]) | ||
fi | ||
]) # AX_CHECK_UTS_NAMESPACE | ||
404: Not Found |
Oops, something went wrong.