-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathacinclude.m4
156 lines (132 loc) · 5.29 KB
/
acinclude.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
dnl -*- mode: autoconf -*-
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
AC_DEFUN([IMENDIO_COMPILE_WARNINGS],[
if test -f $srcdir/autogen.sh; then
default_compile_warnings="error"
else
default_compile_warnings="no"
fi
AC_ARG_WITH(compile-warnings, [ --with-compile-warnings=[no/yes/error] Compiler warnings ], [enable_compile_warnings="$withval"], [enable_compile_warnings="$default_compile_warnings"])
warnCFLAGS=
if test "x$GCC" != xyes; then
enable_compile_warnings=no
fi
warning_flags=
realsave_CFLAGS="$CFLAGS"
case "$enable_compile_warnings" in
no)
warning_flags=
;;
yes)
warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
;;
maximum|error)
warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -std=c99"
CFLAGS="$warning_flags $CFLAGS"
for option in -Wno-sign-compare -Wno-pointer-sign; do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
CFLAGS="$SAVE_CFLAGS"
AC_MSG_RESULT($has_option)
if test $has_option = yes; then
warning_flags="$warning_flags $option"
fi
unset has_option
unset SAVE_CFLAGS
done
unset option
if test "$enable_compile_warnings" = "error" ; then
warning_flags="$warning_flags -Werror"
fi
;;
*)
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
;;
esac
CFLAGS="$realsave_CFLAGS"
AC_MSG_CHECKING(what warning flags to pass to the C compiler)
AC_MSG_RESULT($warning_flags)
WARN_CFLAGS="$warning_flags"
AC_SUBST(WARN_CFLAGS)
])
dnl THIS IS NOT AVAILABLE ON TIGER, including a copy:
dnl a macro to check for ability to create python extensions
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
dnl function also defines PYTHON_INCLUDES
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[
AC_REQUIRE([AM_PATH_PYTHON])
AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi
AC_SUBST(PYTHON_INCLUDES)
dnl check if the headers exist:
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
AC_TRY_CPP([#include <Python.h>],dnl
[AC_MSG_RESULT(found)
$1],dnl
[AC_MSG_RESULT(not found)
$2])
CPPFLAGS="$save_CPPFLAGS"
])
dnl
dnl Check for python + pygtk and setup pygtk bindings variables
dnl
AC_DEFUN([IMENDIO_PYTHON_CHECK],
[
dnl for overriding the documentation installation directory
dnl AC_ARG_WITH([python-dir],
dnl AS_HELP_STRING([--with-python-dir=PATH], [path to installed Python extensions]),,
dnl [with_python_dir='${datadir}/python/site-packages'])
dnl PYTHON_DIR="$with_python_dir"
dnl AC_SUBST([PYTHON_DIR])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--enable-python=@<:@no/yes/auto@:>@],
[build Python bindings [[default=auto]]]),,
[enable_python=auto])
have_python=no
if test x$enable_python != xno; then
have_python=yes
dnl Check for Python
AM_PATH_PYTHON(2.3.5,,[AC_MSG_RESULT([Python 2.3.5 or newer is required])])
AM_CHECK_PYTHON_HEADERS(,[AC_MSG_RESULT([Python headers not found])])
dnl Check for PyGTK
PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.12.0,,have_python=no)
if test $have_python == no; then
AC_MSG_RESULT([PyGTK 2.12.0 or newer])
fi
AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
if test "x$PYGTK_CODEGEN" = xno; then
have_python=no
AC_MSG_RESULT([pygtk-codegen-2.0 script not found])
fi
AC_MSG_CHECKING(for pygtk defs)
PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
AC_SUBST(PYGTK_DEFSDIR)
AC_MSG_RESULT($PYGTK_DEFSDIR)
fi
AC_MSG_CHECKING([whether to build Python bindings])
if test "x$enable_python" = "xyes"; then
if test "x$have_python" != "xyes"; then
AC_MSG_ERROR([Couldn't find the required Python tools.])
fi
fi
if test "x$have_python" = "xno"; then
enable_python=no
elif test "x$have_python" = "xyes" -a "x$enable_python" = "xauto"; then
enable_python=yes
fi
AC_MSG_RESULT($enable_python)
AM_CONDITIONAL([ENABLE_PYTHON], [test x$enable_python = xyes])
])
dnl -----------------------------------------------------------