add AC_CHECK_CC_OPT from ac-archive. check for cfmakeraw, sys/select.h,
[vte.git] / acinclude.m4
1 dnl From msw.
2 dnl
3 dnl a macro to check for ability to create python extensions
4 dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
5 dnl function also defines PYTHON_INCLUDES
6 AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
7 [AC_REQUIRE([AM_PATH_PYTHON])
8 AC_MSG_CHECKING(for headers required to compile python extensions)
9 dnl deduce PYTHON_INCLUDES
10 py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
11 py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
12 PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
13 if test "$py_prefix" != "$py_exec_prefix"; then
14   PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
15 fi
16 AC_SUBST(PYTHON_INCLUDES)
17 dnl check if the headers exist:
18 save_CPPFLAGS="$CPPFLAGS"
19 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
20 AC_TRY_CPP([#include <Python.h>],dnl
21 [AC_MSG_RESULT(found)
22 $1],dnl
23 [AC_MSG_RESULT(not found)
24 $2])
25 CPPFLAGS="$save_CPPFLAGS"
26 ])
27
28 dnl From ac-archive.
29 dnl
30 dnl @synopsis AC_CHECK_CC_OPT(flag, cachevarname)
31 dnl 
32 dnl AC_CHECK_CC_OPT(-fvomit-frame,vomitframe)
33 dnl would show a message as like 
34 dnl "checking wether gcc accepts -fvomit-frame ... no"
35 dnl and sets the shell-variable $vomitframe to either "-fvomit-frame"
36 dnl or (in this case) just a simple "". In many cases you would then call 
37 dnl AC_SUBST(_fvomit_frame_,$vomitframe) to create a substitution that
38 dnl could be fed as "CFLAGS = @_funsigned_char_@ @_fvomit_frame_@
39 dnl
40 dnl in consequence this function is much more general than their 
41 dnl specific counterparts like ac_cxx_rtti.m4 that will test for
42 dnl -fno-rtti -fno-exceptions
43 dnl 
44 dnl @version $Id$
45 dml @author  Guido Draheim <guidod@gmx.de>
46
47 AC_DEFUN(AC_CHECK_CC_OPT,
48 [AC_CACHE_CHECK(whether ${CC-cc} accepts [$1], [$2],
49 [AC_SUBST($2)
50 echo 'void f(){}' > conftest.c
51 if test -z "`${CC-cc} -c $1 conftest.c 2>&1`"; then
52   $2="$1"
53 else
54   $2=""
55 fi
56 rm -f conftest*
57 ])])
58