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 if test -x "$PYTHON-config"; then
13 PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
15 PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
16 if test "$py_prefix" != "$py_exec_prefix"; then
17 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
20 PYTHON_LIBS="-L${py_prefix}/libs -lpython${PYTHON_VERSION}"
21 AC_SUBST(PYTHON_INCLUDES)
23 dnl check if the headers exist:
24 save_CPPFLAGS="$CPPFLAGS"
25 CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
26 AC_TRY_CPP([#include <Python.h>],dnl
29 [AC_MSG_RESULT(not found)
31 CPPFLAGS="$save_CPPFLAGS"
36 dnl @synopsis AC_CHECK_CC_OPT(flag, cachevarname)
38 dnl AC_CHECK_CC_OPT(-fvomit-frame,vomitframe)
39 dnl would show a message as like
40 dnl "checking wether gcc accepts -fvomit-frame ... no"
41 dnl and sets the shell-variable $vomitframe to either "-fvomit-frame"
42 dnl or (in this case) just a simple "". In many cases you would then call
43 dnl AC_SUBST(_fvomit_frame_,$vomitframe) to create a substitution that
44 dnl could be fed as "CFLAGS = @_funsigned_char_@ @_fvomit_frame_@
46 dnl in consequence this function is much more general than their
47 dnl specific counterparts like ac_cxx_rtti.m4 that will test for
48 dnl -fno-rtti -fno-exceptions
51 dml @author Guido Draheim <guidod@gmx.de>
53 AC_DEFUN([AC_CHECK_CC_OPT],
54 [AC_CACHE_CHECK(whether ${CC-cc} accepts [$1], [$2],
56 echo 'void f(){}' > conftest.c
57 if test -z "`${CC-cc} -c $1 conftest.c 2>&1`"; then
65 # Configure paths for FreeType2
66 # Marcelo Magallon 2001-10-26, based on gtk.m4 by Owen Taylor
67 # Renamed to VTE_CHECK_FT2 so that it doesn't get dropped, otherwise identical.
69 dnl VTE_CHECK_FT2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
70 dnl Test for FreeType2, and define FT2_CFLAGS and FT2_LIBS
72 AC_DEFUN([VTE_CHECK_FT2],
74 dnl Get the cflags and libraries from the freetype-config script
76 AC_ARG_WITH(ft-prefix,
77 [ --with-ft-prefix=PREFIX
78 Prefix where FreeType is installed (optional)],
79 ft_config_prefix="$withval", ft_config_prefix="")
80 AC_ARG_WITH(ft-exec-prefix,
81 [ --with-ft-exec-prefix=PREFIX
82 Exec prefix where FreeType is installed (optional)],
83 ft_config_exec_prefix="$withval", ft_config_exec_prefix="")
84 AC_ARG_ENABLE(freetypetest,
85 [ --disable-freetypetest Do not try to compile and run
86 a test FreeType program],
87 [], enable_fttest=yes)
89 if test x$ft_config_exec_prefix != x ; then
90 ft_config_args="$ft_config_args --exec-prefix=$ft_config_exec_prefix"
91 if test x${FT2_CONFIG+set} != xset ; then
92 FT2_CONFIG=$ft_config_exec_prefix/bin/freetype-config
95 if test x$ft_config_prefix != x ; then
96 ft_config_args="$ft_config_args --prefix=$ft_config_prefix"
97 if test x${FT2_CONFIG+set} != xset ; then
98 FT2_CONFIG=$ft_config_prefix/bin/freetype-config
101 AC_PATH_PROG(FT2_CONFIG, freetype-config, no)
103 min_ft_version=ifelse([$1], ,6.1.0,$1)
104 AC_MSG_CHECKING(for FreeType - version >= $min_ft_version)
106 if test "$FT2_CONFIG" = "no" ; then
109 FT2_CFLAGS=`$FT2_CONFIG $ft_config_args --cflags`
110 FT2_LIBS=`$FT2_CONFIG $ft_config_args --libs`
111 ft_config_major_version=`$FT2_CONFIG $ft_config_args --version | \
112 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
113 ft_config_minor_version=`$FT2_CONFIG $ft_config_args --version | \
114 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
115 ft_config_micro_version=`$FT2_CONFIG $ft_config_args --version | \
116 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
117 ft_min_major_version=`echo $min_ft_version | \
118 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
119 ft_min_minor_version=`echo $min_ft_version | \
120 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
121 ft_min_micro_version=`echo $min_ft_version | \
122 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
123 if test x$enable_fttest = xyes ; then
125 if test $ft_config_major_version -lt $ft_min_major_version ; then
128 if test $ft_config_major_version -eq $ft_min_major_version ; then
129 if test $ft_config_minor_version -lt $ft_min_minor_version ; then
132 if test $ft_config_minor_version -eq $ft_min_minor_version ; then
133 if test $ft_config_micro_version -lt $ft_min_micro_version ; then
140 if test x$ft_config_is_lt = xyes ; then
143 ac_save_CFLAGS="$CFLAGS"
145 CFLAGS="$CFLAGS $FT2_CFLAGS"
146 LIBS="$FT2_LIBS $LIBS"
148 dnl Sanity checks for the results of freetype-config to some extent
151 #include <ft2build.h>
152 #include FT_FREETYPE_H
162 error = FT_Init_FreeType(&library);
168 FT_Done_FreeType(library);
172 ],, no_ft=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
173 CFLAGS="$ac_save_CFLAGS"
175 fi # test $ft_config_version -lt $ft_min_version
176 fi # test x$enable_fttest = xyes
177 fi # test "$FT2_CONFIG" = "no"
178 if test x$no_ft = x ; then
180 ifelse([$2], , :, [$2])
183 if test "$FT2_CONFIG" = "no" ; then
184 echo "*** The freetype-config script installed by FreeType 2 could not be found."
185 echo "*** If FreeType 2 was installed in PREFIX, make sure PREFIX/bin is in"
186 echo "*** your path, or set the FT2_CONFIG environment variable to the"
187 echo "*** full path to freetype-config."
189 if test x$ft_config_is_lt = xyes ; then
190 echo "*** Your installed version of the FreeType 2 library is too old."
191 echo "*** If you have different versions of FreeType 2, make sure that"
192 echo "*** correct values for --with-ft-prefix or --with-ft-exec-prefix"
193 echo "*** are used, or set the FT2_CONFIG environment variable to the"
194 echo "*** full path to freetype-config."
196 echo "*** The FreeType test program failed to run. If your system uses"
197 echo "*** shared libraries and they are installed outside the normal"
198 echo "*** system library path, make sure the variable LD_LIBRARY_PATH"
199 echo "*** (or whatever is appropiate for your system) is correctly set."
204 ifelse([$3], , :, [$3])