]> git.lyx.org Git - lyx.git/blob - config/lyxinclude213.m4
move some selection related stuff over to textcursor.C
[lyx.git] / config / lyxinclude213.m4
1 dnl We use this until autoconf fixes its version.
2 AC_DEFUN(LYX_FUNC_SELECT_ARGTYPES,
3 [AC_MSG_CHECKING([types of arguments for select()])
4  AC_CACHE_VAL(ac_cv_func_select_arg234,dnl
5  [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl
6   [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl
7    [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do
8      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
9        AC_TRY_COMPILE(dnl
10 [#ifdef HAVE_SYS_TYPES_H
11 #include <sys/types.h>
12 #endif
13 #ifdef HAVE_SYS_TIME_H
14 #include <sys/time.h>
15 #endif
16 #ifdef HAVE_SYS_SELECT_H
17 #include <sys/select.h>
18 #endif
19 #ifdef HAVE_SYS_SOCKET_H
20 #include <sys/socket.h>
21 #endif
22 extern int 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
23         [ac_not_found=no ; break 3],ac_not_found=yes)
24       done
25      done
26     done
27    ])dnl AC_CACHE_VAL
28   ])dnl AC_CACHE_VAL
29  ])dnl AC_CACHE_VAL
30  if test "$ac_not_found" = yes; then
31   ac_cv_func_select_arg1=int
32   ac_cv_func_select_arg234='int *'
33   ac_cv_func_select_arg5='struct timeval *'
34  fi
35  AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5])
36  AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1,
37                     [Define to the type of arg1 for select().])
38  AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234),
39                     [Define to the type of args 2, 3 and 4 for select().])
40  AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5),
41                     [Define to the type of arg5 for select().])
42 ])
43
44 dnl Check things are declared in headers to avoid errors or warnings.
45 dnl Called like LYX_CHECK_DECL(function, headerfile)
46 dnl Defines HAVE_DECL_{FUNCTION}
47 AC_DEFUN(LYX_CHECK_DECL,
48 [AC_MSG_CHECKING(if $1 is declared by header $2)
49 tr_func=`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
50
51 tr_hdr=`echo $2 | tr . _`
52 AC_CACHE_VAL([lyx_cv_declare_${tr_hdr}_$1],
53 [AC_EGREP_HEADER($1, $2, [eval "lyx_cv_declare_${tr_hdr}_$1=yes"], [eval "lyx_cv_declare_${tr_hdr}_$1=no"])])
54 if eval "test \"\${lyx_cv_declare_${tr_hdr}_$1}\" = \"yes\""; then
55         AC_DEFINE_UNQUOTED(HAVE_DECL_${tr_func},1,[dummy])
56         AC_MSG_RESULT(yes)
57 else
58         AC_MSG_RESULT(no)
59 fi])
60
61 dnl This is the multiple headers version of the LYX_CHECK_DECL macro above.
62 dnl Called like LYX_CHECK_DECL_HDRS(function, file1 file2 file3)
63 AC_DEFUN(LYX_CHECK_DECL_HDRS,
64 [ got="no"
65 for I in $2; do
66 tr_hdr=`echo $I | tr . _`
67 if test "${got}" = "no"; then
68     LYX_CHECK_DECL($1, $I)
69 fi
70 if eval "test \"\${lyx_cv_declare_${tr_hdr}_$1}\" = \"yes\""; then
71      got="yes"
72 fi
73 done])
74
75 dnl A terrible hack because the code from autoconf 2.5x does not work
76 dnl here. It works for the uses in pspell.m4, so that's enough
77 AC_DEFUN([AC_HELP_STRING],[  $1           $2])