forked from Scribery/aushape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
149 lines (139 loc) · 3.96 KB
/
configure.ac
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
#
# Copyright (C) 2016 Red Hat
#
# This file is part of aushape.
#
# Aushape is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Aushape is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with aushape; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
AC_INIT([aushape], [2])
AM_INIT_AUTOMAKE([1.9 -Wall foreign])
AM_MAINTAINER_MODE
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_GNU_SOURCE
ABS_SRCDIR=`cd ${srcdir}; pwd`
CPPFLAGS="-I${ABS_SRCDIR} -I${ABS_SRCDIR}/include -DNDEBUG $CPPFLAGS"
# Check for programs.
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
m4_ifdef([LT_INIT], [LT_INIT])
# Check for features
AC_ARG_ENABLE(
debug,
AS_HELP_STRING([--enable-debug], [enable debugging features]),
[], [enable_debug="no"])
# Output features to preprocessor and compiler
if test "$enable_debug" = "yes"; then
CPPFLAGS="$CPPFLAGS -UNDEBUG"
CFLAGS="$CFLAGS -Wall -Wextra -Werror -g -O0"
fi
# Check for libraries
PKG_CHECK_MODULES(
[AUPARSE], [auparse], ,
[
AC_CHECK_LIB(
[auparse], [auparse_init],
[
AC_SUBST(AUPARSE_CFLAGS, [])
AC_SUBST(AUPARSE_LIBS, [-lauparse])
],
[
AC_MSG_ERROR([libauparse not found])
]
)
]
)
have_audit=yes
PKG_CHECK_MODULES(
[AUDIT], [audit], ,
[
AC_CHECK_LIB(
[audit], [audit_open],
[
AC_SUBST(AUDIT_CFLAGS, [])
AC_SUBST(AUDIT_LIBS, [-laudit])
],
[
have_audit=no
]
)
]
)
# Check for functions
AC_MSG_CHECKING([for version of auparse_set_escape_mode])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <auparse.h>
void
f(void)
{
auparse_set_escape_mode(NULL, AUPARSE_ESC_RAW);
}
]])],
[
AC_MSG_RESULT([two-argument])
AC_DEFINE(AUPARSE_SET_ESCAPE_MODE_VER, [2],
[Define to the version of auparse_set_escape_mode])
],
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <auparse.h>
void
f(void)
{
auparse_set_escape_mode(AUPARSE_ESC_RAW);
}
]])],
[
AC_MSG_RESULT([one-argument])
AC_DEFINE(AUPARSE_SET_ESCAPE_MODE_VER, [1],
[Define to the version of auparse_set_escape_mode])
],
[
AC_MSG_RESULT([missing])
]
)
]
)
AC_CHECK_DECL(
[auparse_get_type_name],
[AC_DEFINE(HAVE_AUPARSE_GET_TYPE_NAME, [1],
[Define to 1 if you have auparse_get_type_name defined in auparse.h])],
[
AC_MSG_NOTICE([linking with libaudit to implement auparse_get_type_name])
if test "x$have_audit" = xyes; then
AUPARSE_CFLAGS="$AUPARSE_CFLAGS $AUDIT_CFLAGS"
AUPARSE_LIBS="$AUPARSE_LIBS $AUDIT_LIBS"
else
AC_MSG_ERROR([libaudit not found])
fi
],
[[#include <auparse.h>]]
)
# Check for symbols
AC_CHECK_DECLS([AUPARSE_TYPE_ESCAPED_KEY],,,[[#include <auparse.h>]])
# Output
AC_CONFIG_FILES([Makefile
include/Makefile
include/aushape/Makefile
lib/Makefile
src/Makefile])
AC_OUTPUT