Imported Upstream version 0.6.6
[platform/upstream/libcap-ng.git] / configure.ac
1 dnl
2 define([AC_INIT_NOTICE],
3 [### Generated automatically using autoconf version] AC_ACVERSION [
4 ### Copyright 2009,2010 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
31 AC_REVISION($Revision: 1.3 $)dnl
32 AC_INIT(libcap-ng,0.6.6)
33 AC_PREREQ(2.12)dnl
34 AM_CONFIG_HEADER(config.h)
35
36 echo Configuring libcap-ng $VERSION
37
38 AC_CANONICAL_TARGET
39 AM_INIT_AUTOMAKE
40 AM_PROG_LIBTOOL
41 AC_SUBST(LIBTOOL_DEPS)
42
43 echo .
44 echo Checking for programs
45
46 AC_PROG_CC
47 AC_PROG_INSTALL
48 AC_PROG_AWK
49
50 echo .
51 echo Checking for header files
52 AC_HEADER_STDC
53 AC_CHECK_HEADERS(linux/capability.h, [], [AC_MSG_ERROR(linux/capability.h is required in order to build libcap-ng.)])
54 AC_CHECK_HEADERS(attr/xattr.h, [], [AC_MSG_WARN(attr/xattr.h not found, disabling file system capabilities.)])
55 AC_CHECK_HEADERS(linux/securebits.h, [], [])
56
57 AC_C_CONST
58 AC_C_INLINE
59 AM_PROG_CC_C_O
60
61 ALLWARNS=""
62 ALLDEBUG="-g"
63 OPT="-O"
64 if test x"$GCC" = x"yes"; then
65   OPT="-O2 -pipe"
66   case "$target" in
67     *linux*)
68              ALLWARNS="-W -Wall -Wundef -Wpointer-arith -Wcast-align \
69 -Wwrite-strings -Waggregate-return -Wstrict-prototypes \
70 -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls \
71 -Wnested-externs -Winline -Wfloat-equal -Wchar-subscripts"
72              ;;
73     esac
74 fi
75
76 ALLDEBUG="-g"
77 AC_ARG_WITH(debug,
78 [  --with-debug            turn on debugging [[default=no]]],
79 [
80 if test "x${withval}" = xyes; then
81         DEBUG="$ALLDEBUG"
82         OPT="-O"
83         AM_CONDITIONAL(DEBUG, true)
84 else
85         DEBUG="-DNDEBUG"
86         AM_CONDITIONAL(DEBUG, false)
87 fi
88 ],
89 [ DEBUG="-DNDEBUG"; AM_CONDITIONAL(DEBUG, false) ])
90
91 AC_ARG_WITH(warn,
92 [  --with-warn             turn on warnings [[default=yes]]],
93 [
94 if test "x${withval}" = xyes; then
95         WARNS="$ALLWARNS"
96 else
97         WARNS=""
98 fi
99 ],WARNS="$ALLWARNS")
100 AC_SUBST(DEBUG)
101
102 AC_CHECK_HEADER(sys/syscall.h,
103         [AC_DEFINE([HAVE_SYSCALL_H], [1],
104         [Define to 1 if you have <sys/syscall.h>.])], [],)
105
106 AC_CHECK_PROG(swig_found, swig, yes, no)
107 if test x"${swig_found}" = x"no" ; then
108         AC_MSG_WARN("Swig not found - python bindings will not be made")
109 fi
110 AM_CONDITIONAL(HAVE_SWIG, test x"${swig_found}" = x"yes")
111
112 AC_MSG_CHECKING(whether to create python bindings)
113 AC_ARG_WITH(python,
114 AS_HELP_STRING([--with-python],[enable building python bindings]),
115 use_python=$withval,
116 use_python=auto)
117 if test x$use_python = xno ; then
118         python_found="no"
119         AC_MSG_RESULT(no)
120 else
121 AC_MSG_RESULT(testing)
122 AM_PATH_PYTHON
123 if test -f /usr/include/python${am_cv_python_version}/Python.h ; then
124         python_found="yes"
125         AC_MSG_NOTICE(Python bindings will be built)
126 else
127         python_found="no"
128         if test x$use_python = xyes ; then
129                 AC_MSG_ERROR([Python explicitly required and python headers found])
130         else
131                 AC_MSG_WARN("Python headers not found - python bindings will not be made")
132         fi
133 fi
134 fi
135 AM_CONDITIONAL(HAVE_PYTHON, test ${python_found} = "yes")
136
137 AC_OUTPUT(Makefile src/Makefile src/libcap-ng.pc src/test/Makefile 
138         bindings/Makefile bindings/python/Makefile
139         bindings/python/test/Makefile utils/Makefile
140         m4/Makefile docs/Makefile)
141
142 echo .
143 echo "
144
145   libcap-ng Version:      $VERSION
146   Target:                 $target
147   Installation prefix:    $prefix
148   Compiler:               $CC
149   Compiler flags:
150 `echo $CFLAGS | fmt -w 50 | sed 's,^,                          ,'`
151 "