+2000-03-15 Akim Demaille <akim@epita.fr>
+
+ 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 <akim@epita.fr>
* autoheader.sh: Use run_m4f, not run_m4.
# 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 <sys/types.h>
-#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 <sys/types.h>
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#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
# 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 <sys/types.h>
-#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 <sys/types.h>
#if HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#if HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#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