acinclude.m4 revision 77683534
1dnl --------------------------------------------------------------------------- 2dnl 3dnl Copyright 2006-2009,2010 by Thomas E. Dickey 4dnl 5dnl All Rights Reserved 6dnl 7dnl Permission to use, copy, modify, and distribute this software and its 8dnl documentation for any purpose and without fee is hereby granted, 9dnl provided that the above copyright notice appear in all copies and that 10dnl both that copyright notice and this permission notice appear in 11dnl supporting documentation, and that the name of the above listed 12dnl copyright holder(s) not be used in advertising or publicity pertaining 13dnl to distribution of the software without specific, written prior 14dnl permission. 15dnl 16dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD 17dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 18dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE 19dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 20dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 21dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 22dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 23dnl 24dnl --------------------------------------------------------------------------- 25 26dnl --------------------------------------------------------------------------- 27dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30 28dnl ------------ 29dnl See if the poll function really works. Some platforms have poll(), but 30dnl it does not work for terminals or files. 31AC_DEFUN([CF_FUNC_POLL],[ 32AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[ 33AC_TRY_RUN([ 34#include <stdio.h> 35#ifdef HAVE_POLL_H 36#include <poll.h> 37#else 38#include <sys/poll.h> 39#endif 40int main() { 41 struct pollfd myfds; 42 int ret; 43 44 myfds.fd = 0; 45 myfds.events = POLLIN; 46 47 ret = poll(&myfds, 1, 100); 48 ${cf_cv_main_return:-return}(ret != 0); 49}], 50 [cf_cv_working_poll=yes], 51 [cf_cv_working_poll=no], 52 [cf_cv_working_poll=unknown])]) 53test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL, 1, [poll() works]) 54])dnl 55 56dnl --------------------------------------------------------------------------- 57dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09 58dnl ----------- 59dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all 60dnl programs need this test). 61dnl 62dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE 63dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct 64dnl winsize declaration is left alone - we may revisit this if Apple choose to 65dnl break that part of the interface as well. 66AC_DEFUN([CF_SIGWINCH], 67[ 68AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ 69 AC_TRY_COMPILE([ 70#include <sys/types.h> 71#include <sys/signal.h> 72],[int x = SIGWINCH], 73 [cf_cv_define_sigwinch=yes], 74 [AC_TRY_COMPILE([ 75#undef _XOPEN_SOURCE 76#undef _POSIX_SOURCE 77#undef _POSIX_C_SOURCE 78#include <sys/types.h> 79#include <sys/signal.h> 80],[int x = SIGWINCH], 81 [cf_cv_define_sigwinch=maybe], 82 [cf_cv_define_sigwinch=no]) 83]) 84]) 85 86if test "$cf_cv_define_sigwinch" = maybe ; then 87AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ 88cf_cv_fixup_sigwinch=unknown 89cf_sigwinch=32 90while test $cf_sigwinch != 1 91do 92 AC_TRY_COMPILE([ 93#undef _XOPEN_SOURCE 94#undef _POSIX_SOURCE 95#undef _POSIX_C_SOURCE 96#include <sys/types.h> 97#include <sys/signal.h> 98],[ 99#if SIGWINCH != $cf_sigwinch 100make an error 101#endif 102int x = SIGWINCH], 103 [cf_cv_fixup_sigwinch=$cf_sigwinch 104 break]) 105 106cf_sigwinch=`expr $cf_sigwinch - 1` 107done 108]) 109 110 if test "$cf_cv_fixup_sigwinch" != unknown ; then 111 CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" 112 fi 113fi 114])dnl 115 116 117