diff options
author | kkkunche <kishore.kunche@intel.com> | 2019-08-06 14:41:23 +0530 |
---|---|---|
committer | Sebastian Pipping <sebastian@pipping.org> | 2019-08-10 20:25:42 +0200 |
commit | d6cd0e4769b3eb3641cc787d88bb7e23cd63d4f9 (patch) | |
tree | 21024d8bfe5ff6e13c74da6bb785bcfa26460017 /expat/configure.ac | |
parent | e9db1a75c421ec975133d70e84e96b39302245a9 (diff) | |
download | libexpat-git-d6cd0e4769b3eb3641cc787d88bb7e23cd63d4f9.tar.gz |
Autotool new options : --with/--without -getrandom and --with/--without -sysgetrandom.
Autodetect works by default for getrandom and sysgetrandom.
With the these options user can use the detected functions or ignore them.
Diffstat (limited to 'expat/configure.ac')
-rw-r--r-- | expat/configure.ac | 66 |
1 files changed, 43 insertions, 23 deletions
diff --git a/expat/configure.ac b/expat/configure.ac index fe3dc29c..ac730aa1 100644 --- a/expat/configure.ac +++ b/expat/configure.ac @@ -183,33 +183,53 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([ AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])]) +AC_ARG_WITH([getrandom], + [AS_HELP_STRING([--with-getrandom], + [enforce the use of getrandom function in the system @<:@default=check@:>@]) +AS_HELP_STRING([--without-getrandom], + [skip auto detect of getrandom @<:@default=check@:>@])], + [], + [with_getrandom=check]) -AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)]) -AC_LINK_IFELSE([AC_LANG_SOURCE([ - #include <stdlib.h> /* for NULL */ - #include <sys/random.h> - int main() { - return getrandom(NULL, 0U, 0U); - } - ])], - [AC_DEFINE([HAVE_GETRANDOM], [1], [Define to 1 if you have the `getrandom' function.]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) +AS_IF([test "x$with_getrandom" != xno], + [AC_MSG_CHECKING([for getrandom (Linux 3.17+, glibc 2.25+)]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ + #include <stdlib.h> /* for NULL */ + #include <sys/random.h> + int main() { + return getrandom(NULL, 0U, 0U); + } + ])], + [AC_DEFINE([HAVE_GETRANDOM], [1], [Define to 1 if you have the `getrandom' function.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AS_IF([test "x$with_getrandom" = xyes], + [AC_MSG_ERROR([enforced the use of getrandom --with-getrandom, but not detected])])])]) + +AC_ARG_WITH([sys_getrandom], + [AS_HELP_STRING([--with-sys-getrandom], + [enforce the use of syscall SYS_getrandom function in the system @<:@default=check@:>@]) +AS_HELP_STRING([--without-sys-getrandom], + [skip auto detect of syscall SYS_getrandom @<:@default=check@:>@])], + [], + [with_sys_getrandom=check]) - AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)]) +AS_IF([test "x$with_sys_getrandom" != xno], + [AC_MSG_CHECKING([for syscall SYS_getrandom (Linux 3.17+)]) AC_LINK_IFELSE([AC_LANG_SOURCE([ - #include <stdlib.h> /* for NULL */ - #include <unistd.h> /* for syscall */ - #include <sys/syscall.h> /* for SYS_getrandom */ - int main() { - syscall(SYS_getrandom, NULL, 0, 0); - return 0; - } + #include <stdlib.h> /* for NULL */ + #include <unistd.h> /* for syscall */ + #include <sys/syscall.h> /* for SYS_getrandom */ + int main() { + syscall(SYS_getrandom, NULL, 0, 0); + return 0; + } ])], - [AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1], [Define to 1 if you have `syscall' and `SYS_getrandom'.]) - AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])])]) - + [AC_DEFINE([HAVE_SYSCALL_GETRANDOM], [1], [Define to 1 if you have `syscall' and `SYS_getrandom'.]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AS_IF([test "x$with_sys_getrandom" = xyes], + [AC_MSG_ERROR([enforced the use of syscall SYS_getrandom --with-sys-getrandom, but not detected])])])]) dnl Only needed for xmlwf: AC_CHECK_HEADERS(fcntl.h unistd.h) |