From: Akim Demaille Date: Wed, 15 Mar 2000 09:55:21 +0000 (+0000) Subject: Revamp AC_FUNC_SELECT_ARGTYPES. X-Git-Tag: autoconf-2.50~1037 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbccb222a2cfbcf9bcf35d71baed9c80cdfb19e8;p=thirdparty%2Fautoconf.git Revamp AC_FUNC_SELECT_ARGTYPES. * acspecific.m4 (AC_FUNC_SELECT_ARGTYPES): Use a single cache variable instead of three. Use AC_CACHE_CHECK. Shorten the name of the var loops, they are no longer cached. Include sys/types.h unconditionally. `select' returns an int, fixes Autoconf/46. Don't display parens in the user messages. --- diff --git a/ChangeLog b/ChangeLog index 89997ced5..b388fdc41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2000-03-15 Akim Demaille + + Revamp AC_FUNC_SELECT_ARGTYPES. + + * acspecific.m4 (AC_FUNC_SELECT_ARGTYPES): Use a single cache + variable instead of three. + Use AC_CACHE_CHECK. + Shorten the name of the var loops, they are no longer cached. + Include sys/types.h unconditionally. + `select' returns an int, fixes Autoconf/46. + Don't display parens in the user messages. + 2000-03-14 Akim Demaille * autoheader.sh: Use run_m4f, not run_m4. diff --git a/acspecific.m4 b/acspecific.m4 index 602533a99..61aab8172 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -1904,18 +1904,17 @@ AC_SUBST(LIBOBJS)dnl # AC_FUNC_SELECT_ARGTYPES # ----------------------- +# Determine the correct type to be passed to each of the `select' +# function's arguments, and define those types in `SELECT_TYPE_ARG1', +# `SELECT_TYPE_ARG234', and `SELECT_TYPE_ARG5'. AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, -[AC_MSG_CHECKING([types of arguments for select()]) - AC_CACHE_VAL(ac_cv_func_select_arg234,dnl - [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl - [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl - [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do - for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do - for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do - AC_TRY_COMPILE( -[#if HAVE_SYS_TYPES_H -# include -#endif +[AC_CACHE_CHECK([types of arguments for select], +[ac_cv_func_select_args], +[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + AC_TRY_COMPILE( +[#include #if HAVE_SYS_TIME_H # include #endif @@ -1925,26 +1924,25 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, #if HAVE_SYS_SOCKET_H # include #endif -extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl - [ac_not_found=no ; break 3],ac_not_found=yes) - done - done - done - ])dnl AC_CACHE_VAL - ])dnl AC_CACHE_VAL - ])dnl AC_CACHE_VAL - if test "$ac_not_found" = yes; then - ac_cv_func_select_arg1=int - ac_cv_func_select_arg234='int *' - ac_cv_func_select_arg5='struct timeval *' - fi - AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $ac_cv_func_select_arg1, - [Define to the type of arg 1 for `select'.]) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($ac_cv_func_select_arg234), - [Define to the type of args 2, 3 and 4 for `select'.]) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($ac_cv_func_select_arg5), - [Define to the type of arg 5 for `select'.]) +extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);],, + [ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3]) + done + done +done +# Provide a safe default value. +: ${ac_cv_func_select_args=int,int *,struct timeval *} +]) +ac_save_IFS=$IFS +IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed -e 's/\*/\*/g'` +IFS=$ac_save_IFS +shift +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, [$]1, + [Define to the type of arg 1 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ([$]2), + [Define to the type of args 2, 3 and 4 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ([$]3), + [Define to the type of arg 5 for `select'.]) ])# AC_FUNC_SELECT_ARGTYPES diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index 602533a99..61aab8172 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -1904,18 +1904,17 @@ AC_SUBST(LIBOBJS)dnl # AC_FUNC_SELECT_ARGTYPES # ----------------------- +# Determine the correct type to be passed to each of the `select' +# function's arguments, and define those types in `SELECT_TYPE_ARG1', +# `SELECT_TYPE_ARG234', and `SELECT_TYPE_ARG5'. AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, -[AC_MSG_CHECKING([types of arguments for select()]) - AC_CACHE_VAL(ac_cv_func_select_arg234,dnl - [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl - [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl - [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do - for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do - for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do - AC_TRY_COMPILE( -[#if HAVE_SYS_TYPES_H -# include -#endif +[AC_CACHE_CHECK([types of arguments for select], +[ac_cv_func_select_args], +[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + AC_TRY_COMPILE( +[#include #if HAVE_SYS_TIME_H # include #endif @@ -1925,26 +1924,25 @@ AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, #if HAVE_SYS_SOCKET_H # include #endif -extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl - [ac_not_found=no ; break 3],ac_not_found=yes) - done - done - done - ])dnl AC_CACHE_VAL - ])dnl AC_CACHE_VAL - ])dnl AC_CACHE_VAL - if test "$ac_not_found" = yes; then - ac_cv_func_select_arg1=int - ac_cv_func_select_arg234='int *' - ac_cv_func_select_arg5='struct timeval *' - fi - AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $ac_cv_func_select_arg1, - [Define to the type of arg 1 for `select'.]) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($ac_cv_func_select_arg234), - [Define to the type of args 2, 3 and 4 for `select'.]) - AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($ac_cv_func_select_arg5), - [Define to the type of arg 5 for `select'.]) +extern int select ($ac_arg1,$ac_arg234,$ac_arg234,$ac_arg234,$ac_arg5);],, + [ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3]) + done + done +done +# Provide a safe default value. +: ${ac_cv_func_select_args=int,int *,struct timeval *} +]) +ac_save_IFS=$IFS +IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed -e 's/\*/\*/g'` +IFS=$ac_save_IFS +shift +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, [$]1, + [Define to the type of arg 1 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ([$]2), + [Define to the type of args 2, 3 and 4 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ([$]3), + [Define to the type of arg 5 for `select'.]) ])# AC_FUNC_SELECT_ARGTYPES