1dnl
2define([AC_INIT_NOTICE],
3[### Generated automatically using autoconf version] AC_ACVERSION [
4### Copyright 2009-2012 Steve Grubb <sgrubb@redhat.com>
5###
6### Permission is hereby granted, free of charge, to any person obtaining a
7### copy of this software and associated documentation files (the "Software"),
8### to deal in the Software without restriction, including without limitation
9### the rights to use, copy, modify, merge, publish, distribute, sublicense,
10### and/or sell copies of the Software, and to permit persons to whom the
11### Software is furnished to do so, subject to the following conditions:
12###
13### The above copyright notice and this permission notice shall be included
14### in all copies or substantial portions of the Software.
15###
16### THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17### IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18### FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19### THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20### OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21### ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22### OTHER DEALINGS IN THE SOFTWARE.
23###
24### For usage, run `./configure --help'
25### For more detailed information on installation, read the file `INSTALL'.
26###
27### If configuration succeeds, status is in the file `config.status'.
28### A log of configuration tests is in `config.log'.
29])
30
31AC_REVISION($Revision: 1.3 $)dnl
32AC_INIT(libcap-ng,0.7)
33AC_PREREQ(2.12)dnl
34AM_CONFIG_HEADER(config.h)
35AC_CONFIG_MACRO_DIR([m4])
36
37echo Configuring libcap-ng $VERSION
38
39AC_CANONICAL_TARGET
40AM_INIT_AUTOMAKE
41AM_PROG_LIBTOOL
42AC_SUBST(LIBTOOL_DEPS)
43
44echo .
45echo Checking for programs
46
47AC_PROG_CC
48AC_PROG_INSTALL
49AC_PROG_AWK
50
51echo .
52echo Checking for header files
53AC_HEADER_STDC
54AC_CHECK_HEADERS(linux/capability.h, [], [AC_MSG_ERROR(linux/capability.h is required in order to build libcap-ng.)])
55AC_CHECK_HEADERS(attr/xattr.h, [], [AC_MSG_WARN(attr/xattr.h not found, disabling file system capabilities.)])
56AC_CHECK_HEADERS(linux/securebits.h, [], [])
57
58AC_C_CONST
59AC_C_INLINE
60AM_PROG_CC_C_O
61
62ALLWARNS=""
63ALLDEBUG="-g"
64OPT="-O"
65if test x"$GCC" = x"yes"; then
66  OPT="-O2 -pipe"
67  case "$target" in
68    *linux*)
69             ALLWARNS="-W -Wall -Wundef -Wpointer-arith -Wcast-align \
70-Wwrite-strings -Waggregate-return -Wstrict-prototypes \
71-Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
72-Wnested-externs -Winline -Wfloat-equal -Wchar-subscripts"
73             ;;
74    esac
75fi
76
77ALLDEBUG="-g"
78AC_ARG_WITH(debug,
79[  --with-debug            turn on debugging [[default=no]]],
80[
81if test "x${withval}" = xyes; then
82        DEBUG="$ALLDEBUG"
83        OPT="-O"
84        AM_CONDITIONAL(DEBUG, true)
85else
86        DEBUG="-DNDEBUG"
87        AM_CONDITIONAL(DEBUG, false)
88fi
89],
90[ DEBUG="-DNDEBUG"; AM_CONDITIONAL(DEBUG, false) ])
91
92AC_ARG_WITH(warn,
93[  --with-warn             turn on warnings [[default=yes]]],
94[
95if test "x${withval}" = xyes; then
96        WARNS="$ALLWARNS"
97else
98        WARNS=""
99fi
100],WARNS="$ALLWARNS")
101AC_SUBST(DEBUG)
102
103AC_CHECK_HEADER(sys/syscall.h,
104	[AC_DEFINE([HAVE_SYSCALL_H], [1],
105	[Define to 1 if you have <sys/syscall.h>.])], [],)
106
107AC_CHECK_PROG(swig_found, swig, yes, no)
108if test x"${swig_found}" = x"no" ; then
109	AC_MSG_WARN("Swig not found - python bindings will not be made")
110fi
111AM_CONDITIONAL(HAVE_SWIG, test x"${swig_found}" = x"yes")
112
113AC_MSG_CHECKING(whether to create python bindings)
114AC_ARG_WITH(python,
115AS_HELP_STRING([--with-python],[enable building python bindings]),
116use_python=$withval,
117use_python=auto)
118if test x$use_python = xno ; then
119	python_found="no"
120	AC_MSG_RESULT(no)
121else
122AC_MSG_RESULT(testing)
123AM_PATH_PYTHON
124if test -f /usr/include/python${am_cv_python_version}/Python.h ; then
125	python_found="yes"
126	AC_MSG_NOTICE(Python bindings will be built)
127else
128	python_found="no"
129	if test x$use_python = xyes ; then
130		AC_MSG_ERROR([Python explicitly required and python headers found])
131	else
132		AC_MSG_WARN("Python headers not found - python bindings will not be made")
133	fi
134fi
135fi
136AM_CONDITIONAL(HAVE_PYTHON, test ${python_found} = "yes")
137
138AC_OUTPUT(Makefile src/Makefile src/libcap-ng.pc src/test/Makefile
139	bindings/Makefile bindings/python/Makefile
140	bindings/python/test/Makefile utils/Makefile
141	m4/Makefile docs/Makefile)
142
143echo .
144echo "
145
146  libcap-ng Version:      $VERSION
147  Target:                 $target
148  Installation prefix:    $prefix
149  Compiler:               $CC
150  Compiler flags:
151`echo $CFLAGS | fmt -w 50 | sed 's,^,                          ,'`
152"
153