1 dnl Copyright (C) 2013 Simon Ruderich
3 dnl This program is free software: you can redistribute it and/or modify
4 dnl it under the terms of the GNU General Public License as published by
5 dnl the Free Software Foundation, either version 3 of the License, or
6 dnl (at your option) any later version.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
18 AC_INIT([coloredstderr],[0.1],[simon@ruderich.org])
20 AC_CONFIG_AUX_DIR([build-aux])
21 AC_CONFIG_MACRO_DIR([m4])
22 AC_CONFIG_HEADERS([config.h])
23 AC_CONFIG_SRCDIR([src/coloredstderr.c])
26 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
28 LT_INIT([disable-static])
31 dnl Used by test suite.
35 if test "x$GCC" = xyes; then
36 CFLAGS="-Wall -Wextra -Wconversion $CFLAGS"
39 AC_CHECK_HEADERS([fcntl.h error.h])
49 AC_CHECK_FUNCS([memmove setenv])
51 dnl Thanks to gperftools' configure.ac (https://code.google.com/p/gperftools).
52 AC_MSG_CHECKING([for __builtin_expect])
53 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[return __builtin_expect(main != 0, 1)])],
54 [AC_DEFINE([HAVE___BUILTIN_EXPECT], 1,
55 [Define to 1 if the compiler supports __builtin_expect().])
56 AC_MSG_RESULT([yes])],
57 [AC_MSG_RESULT([no])])
59 AC_SEARCH_LIBS([dlsym], [dl], [], [AC_MSG_ERROR([dlsym() is required])])
61 AC_ARG_ENABLE([warnings],
62 [AS_HELP_STRING([--enable-warnings],[enable warning output])],
63 [if test "x$enableval" = xyes; then
64 AC_DEFINE([WARNING], 1, [Define to 1 enable warning output.])
66 AC_ARG_ENABLE([debug],
67 [AS_HELP_STRING([--enable-debug],[enable debug output])],
68 [if test "x$enableval" = xyes; then
69 AC_DEFINE([DEBUG], 1, [Define to 1 enable debug output.])
70 dnl DEBUG implies WARNING
71 AC_DEFINE([WARNING], 1)
74 dnl Used in tests/Makefile.am to build the test only if error() is available.
75 AM_CONDITIONAL([HAVE_ERROR_H],[test "x$ac_cv_header_error_h" = xyes])
76 AM_CONDITIONAL([HAVE_VFORK],[test "x$ac_cv_func_vfork_works" = xyes])
78 AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])