From: kkkunche Date: Tue, 6 Aug 2019 09:11:23 +0000 (+0530) Subject: Autotool new options : --with/--without -getrandom and --with/--without -sysgetrandom. X-Git-Tag: R_2_2_8~50^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6cd0e4769b3eb3641cc787d88bb7e23cd63d4f9;p=libexpat 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. --- 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 /* for NULL */ - #include - 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 /* for NULL */ + #include + 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 /* for NULL */ - #include /* for syscall */ - #include /* for SYS_getrandom */ - int main() { - syscall(SYS_getrandom, NULL, 0, 0); - return 0; - } + #include /* for NULL */ + #include /* for syscall */ + #include /* 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)