Python: Use the standard library enum type
[libswo.git] / configure.ac
blob980bbec76332a3a5ddba13a84cf8e54928fec09d
1 ##
2 ## This file is part of the libswo project.
3 ##
4 ## Copyright (C) 2014-2015 Marc Schink <swo-dev@marcschink.de>
5 ##
6 ## This program is free software: you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, either version 3 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 AC_PREREQ([2.69])
22 AC_INIT([libswo], [0.2.0], [dev@zapb.de], [libswo],
23         [https://gitlab.zapb.de/zapb/libswo.git])
24 AC_CONFIG_HEADERS([config.h])
25 AC_CONFIG_MACRO_DIR([m4])
26 AC_CONFIG_AUX_DIR([build-aux])
28 AC_CANONICAL_HOST
30 AM_INIT_AUTOMAKE([foreign -Wall -Werror check-news])
32 # Enable additional compiler warnings via -Wall and -Wextra. Use hidden
33 # visibility for all non-static symbols by default with -fvisibility=hidden.
34 C_CXX_FLAGS="-Wall -Wextra -Werror -fvisibility=hidden"
35 LIBSWO_CFLAGS="$C_CXX_FLAGS"
36 LIBSWO_CXXFLAGS="-std=c++11 $C_CXX_FLAGS"
38 # Checks for programs.
39 AC_PROG_CC
40 AC_PROG_CC_C99
41 AC_PROG_CXX
43 # Determine if a C++ compiler is available.
44 AC_CHECK_PROG([HAVE_CXX], [$CXX], [yes], [no])
46 # Automake >= 1.12 requires AM_PROG_AR when using options -Wall and -Werror.
47 # To be compatible with older versions of Automake use AM_PROG_AR if it's
48 # defined only. This line must occur before LT_INIT.
49 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
51 # Initialize libtool.
52 LT_INIT
54 # Initialize pkg-config.
55 PKG_PROG_PKG_CONFIG
57 # Checks for libraries.
59 # Checks for header files.
61 # Checks for typedefs, structures, and compiler characteristics.
63 # Checks for library functions.
65 # Disable progress and informational output of libtool.
66 AC_SUBST([AM_LIBTOOLFLAGS], "--silent")
68 # Check for SWIG.
69 AC_CHECK_PROGS([SWIG], [swig swig3.0])
71 # Check for Python interpreter.
72 AM_PATH_PYTHON([3.2], [HAVE_PYTHON="yes"], [HAVE_PYTHON="no"])
74 # Check for Python development files.
75 AC_MSG_CHECKING([for Python development files])
77 AS_IF([test -x "$(command -v $PYTHON-config)"], [HAVE_PYTHON_DEV="yes"],
78         [HAVE_PYTHON_DEV="no"])
80 AC_MSG_RESULT([$HAVE_PYTHON_DEV])
82 # Check for Python setuptools.
83 AX_PYTHON_MODULE([setuptools])
85 LIBSWO_SET_PACKAGE_VERSION([LIBSWO_VERSION_PACKAGE], [AC_PACKAGE_VERSION])
87 # Libtool interface version of libswo. This is not the same as the package
88 # version. For information about the versioning system of libtool, see:
89 # http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
90 LIBSWO_SET_LIBRARY_VERSION([LIBSWO_VERSION_LIBRARY], [0:0:0])
92 LIBSWO_LDFLAGS="-version-info $LIBSWO_VERSION_LIBRARY"
94 AC_ARG_ENABLE(cxx, AS_HELP_STRING([--enable-cxx],
95         [enable C++ bindings [default=yes]]),
96         [], [enable_cxx="yes"])
98 AC_ARG_ENABLE([python], AS_HELP_STRING([--enable-python],
99         [enable Python bindings [default=yes]]),
100         [], [enable_python="yes"])
102 AS_IF([test "x$enable_cxx" != "xno"],
103         [enable_cxx="yes"])
105 AS_IF([test "x$enable_python" != "xno"],
106         [enable_python="yes"])
108 cxx_msg=""
109 python_msg=""
111 AS_IF([test "x$HAVE_CXX" = "xno"],
112         [cxx_msg="C++ compiler required"])
114 AS_IF([test "x$enable_cxx" = "xno"],
115         [cxx_msg="disabled"])
117 AS_IF([test -z "$cxx_msg"],
118         [BINDINGS_CXX=$enable_cxx],
119         [BINDINGS_CXX="no"; cxx_msg=" ($cxx_msg)"])
121 AS_IF([test "x$HAVE_PYMOD_SETUPTOOLS" = "xno"],
122         [python_msg="Python setuptools required"])
124 AS_IF([test "x$SWIG" = "x"],
125         [python_msg="SWIG required"])
127 AS_IF([test "x$HAVE_PYTHON_DEV" = "xno"],
128         [python_msg="Python development files required"])
130 AS_IF([test "x$HAVE_PYTHON" = "xno"],
131         [python_msg="Python interpreter required"])
133 AS_IF([test "x$enable_python$BINDINGS_CXX" = "xyesno"],
134         [python_msg="C++ bindings required"])
136 AS_IF([test "x$enable_python" = "xno"],
137         [python_msg="disabled"])
139 AS_IF([test -z "$python_msg"],
140         [BINDINGS_PYTHON=$enable_python],
141         [BINDINGS_PYTHON="no"; python_msg=" ($python_msg)"])
143 AM_CONDITIONAL([BINDINGS_CXX], [test "x$BINDINGS_CXX" = "xyes"])
144 AM_CONDITIONAL([BINDINGS_PYTHON], [test "x$BINDINGS_PYTHON" = "xyes"])
146 # Use C99 compatible stdio functions on MinGW instead of the incompatible
147 # functions provided by Microsoft.
148 AS_CASE([$host_os], [mingw*],
149         [AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1],
150                 [Define to 1 to use C99 compatible stdio functions on MinGW.])])
152 AC_SUBST([LIBSWO_CFLAGS])
153 AC_SUBST([LIBSWO_CXXFLAGS])
154 AC_SUBST([LIBSWO_LDFLAGS])
156 AC_CONFIG_FILES([Makefile])
157 AC_CONFIG_FILES([libswo/Makefile])
158 AC_CONFIG_FILES([libswo/version.h])
159 AC_CONFIG_FILES([bindings/cxx/Makefile])
160 AC_CONFIG_FILES([bindings/cxx/libswocxx.pc])
161 AC_CONFIG_FILES([bindings/python/Makefile])
162 AC_CONFIG_FILES([bindings/python/setup.py])
163 AC_CONFIG_FILES([libswo.pc])
164 AC_CONFIG_FILES([Doxyfile])
166 AC_OUTPUT
168 echo
169 echo "libswo configuration summary:"
170 echo " - Package version ................ $LIBSWO_VERSION_PACKAGE"
171 echo " - Library version ................ $LIBSWO_VERSION_LIBRARY"
172 echo " - Installation prefix ............ $prefix"
173 echo " - Building on .................... $build"
174 echo " - Building for ................... $host"
176 echo
177 echo "Enabled language bindings:"
178 echo " - C++ ............................ $BINDINGS_CXX$cxx_msg"
179 echo " - Python ......................... $BINDINGS_PYTHON$python_msg"
180 echo