File: configure.ac

package info (click to toggle)
hidrd 0.2.0-12
  • links: PTS
  • area: main
  • in suites: sid
  • size: 3,900 kB
  • ctags: 1,558
  • sloc: ansic: 13,134; sh: 10,340; makefile: 580; xml: 386
file content (296 lines) | stat: -rw-r--r-- 9,230 bytes parent folder | download | duplicates (2)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
#
# Copyright (C) 2009-2010 Nikolai Kondrashov
#
# This file is part of hidrd.
#
# Hidrd 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.
#
# Hidrd 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 hidrd; 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([hidrd], [0.2.0])
AC_CONFIG_AUX_DIR([auxdir])
AM_INIT_AUTOMAKE([1.9 -Wall foreign])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_MACRO_DIR([m4/autoconf])

# To have empty CFLAGS instead of undefined and '-g -O2' by default
CFLAGS=$CFLAGS
CFLAGS="-Wall -Wextra -Werror $CFLAGS"
ABS_SRCDIR=`cd ${srcdir} ; pwd`
ABS_BUILDDIR=`pwd`
CPPFLAGS="-I${ABS_BUILDDIR} -I${ABS_BUILDDIR}/include -D_GNU_SOURCE $CPPFLAGS"
if test "$ABS_SRCDIR" != "$ABS_BUILDDIR"; then
    CPPFLAGS="-I${ABS_SRCDIR}/include $CPPFLAGS"
fi


#
# Checks for programs.
#
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL

#
# Checks for libraries.
#
AC_ARG_WITH(xml2-config,
            AC_HELP_STRING([--with-xml2-config=PATH],
                           [Specify xml2-config location @<:@default=$PATH@:>@]),
            [],
            [with_xml2_config=check])

XML2_CONFIG=
AS_IF([test "x$with_xml2_config" = "xcheck"],
      [AC_PATH_PROG(XML2_CONFIG, xml2-config)],
      [test "x$with_xml2_config" != "xno"],
      [XML2_CONFIG="$with_xml2_config"])

AM_CONDITIONAL([WITH_LIBXML2], [test -n "$XML2_CONFIG"])

LIBXML2_LIBS=
LIBXML2_CFLAGS=
if [test -n "$XML2_CONFIG"]; then
    $XML2_CONFIG --version >/dev/null ||
        AC_MSG_ERROR([cannot execute $XML2_CONFIG])

    LIBXML2_LIBS="`$XML2_CONFIG --libs`"
    LIBXML2_CFLAGS="`$XML2_CONFIG --cflags`"
fi
AC_SUBST(LIBXML2_LIBS)
AC_SUBST(LIBXML2_CFLAGS)

#
# Checks for features
#
AC_ARG_ENABLE(
    debug,
    AS_HELP_STRING([--enable-debug], [enable debugging features]),
    [], [enable_debug="no"])

AC_ARG_ENABLE(
    tests-install,
    AS_HELP_STRING([--enable-tests-install], [enable installation of tests]),
    [], [enable_tests_install="no"])

AC_ARG_ENABLE(
    opt,
    AS_HELP_STRING([--disable-opt],
                   [disable building options library (required by streams)]),
    [], [enable_opt="yes"])

AC_ARG_ENABLE(
    streams,
    AS_HELP_STRING([--disable-streams], [disable building stream library (required by formats)]),
    [], [enable_streams="yes"])

AC_ARG_ENABLE(
    formats,
    AS_HELP_STRING([--disable-formats], [disable building format library (required by hidrd-convert)]),
    [], [enable_formats="yes"])

AC_ARG_ENABLE(
    hidrd-convert,
    AS_HELP_STRING([--disable-hidrd-convert], [disable building hidrd-convert tool (requires formats)]),
    [], [enable_hidrd_convert="yes"])

AC_ARG_ENABLE(
    tokens,
    AS_HELP_STRING([--disable-tokens],
                   [disable tokens (required by XML format)]),
    [], [enable_tokens="yes"])

AC_ARG_ENABLE(
    names,
    AS_HELP_STRING([--disable-names],
                   [disable names (required by XML format)]),
    [], [enable_names="yes"])

AC_ARG_ENABLE(
    xml-format,
    AS_HELP_STRING(
        [--disable-xml-format],
        [disable building XML format support (requires tokens, names and libxml2)]),
    [], [enable_xml_format="yes"])

AC_ARG_ENABLE(
    spec-format,
    AS_HELP_STRING(
        [--disable-spec-format],
        [disable building specification example format support (requires tokens and names)]),
    [], [enable_spec_format="yes"])

AC_ARG_ENABLE(
    code-format,
    AS_HELP_STRING(
        [--disable-code-format],
        [disable building source code format support (requires specification example format)]),
    [], [enable_code_format="yes"])

# Check for stream library dependencies
if test "$enable_streams" = "yes"; then
    if test "$enable_opt" != "yes"; then
        AC_MSG_WARN([option library is disabled, so disabling streams])
        enable_streams="no"
    fi
fi

# Check for format library dependencies
if test "$enable_formats" = "yes"; then
    if test "$enable_streams" != "yes"; then
        AC_MSG_WARN([stream library is disabled, so disabling formats])
        enable_formats="no"
    fi
fi

# Check for XML format dependencies
if test "$enable_xml_format" = "yes"; then
    if test "$enable_formats" != "yes"; then
        # Disable silently - quite obvious
        enable_xml_format="no"
    elif test "$enable_tokens" != "yes"; then
        AC_MSG_WARN([tokens are disabled, so disabling XML format])
        enable_xml_format="no"
    elif test "$enable_names" != "yes"; then
        AC_MSG_WARN([names are disabled, so disabling XML format])
        enable_xml_format="no"
    elif test -z "$XML2_CONFIG"; then
        AC_MSG_WARN([no xml2-config, so disabling XML format])
        enable_xml_format="no"
    fi
fi

# Check for spec format dependencies
if test "$enable_spec_format" = "yes"; then
    if test "$enable_formats" != "yes"; then
        # Disable silently - quite obvious
        enable_spec_format="no"
    elif test "$enable_tokens" != "yes"; then
        AC_MSG_WARN([tokens are disabled, so disabling specification example format])
        enable_spec_format="no"
    elif test "$enable_names" != "yes"; then
        AC_MSG_WARN([names are disabled, so disabling specification example format])
        enable_spec_format="no"
    fi
fi

# Check for code format dependencies
if test "$enable_code_format" = "yes"; then
    if test "$enable_spec_format" != "yes"; then
        AC_MSG_WARN([specification example format is disabled, so disabling source code format])
        enable_code_format="no"
    fi
fi

# Check hidrd-convert tool dependencies
if test "$enable_hidrd_convert" = "yes"; then
    if test "$enable_formats" != "yes"; then
        AC_MSG_WARN([format library is disabled, so disabling hidrd-convert tool])
        enable_hidrd_convert="no"
    fi
fi

# Output features to automake
AM_CONDITIONAL([ENABLE_TESTS_INSTALL], [test "$enable_tests_install" = "yes"])
AM_CONDITIONAL([ENABLE_OPT], [test "$enable_opt" = "yes"])
AM_CONDITIONAL([ENABLE_STRM], [test "$enable_streams" = "yes"])
AM_CONDITIONAL([ENABLE_FMT], [test "$enable_formats" = "yes"])
AM_CONDITIONAL([ENABLE_HIDRD_CONVERT], [test "$enable_hidrd_convert" = "yes"])
AM_CONDITIONAL([ENABLE_TOKENS], [test "$enable_tokens" = "yes"])
AM_CONDITIONAL([ENABLE_NAMES], [test "$enable_names" = "yes"])
AM_CONDITIONAL([ENABLE_FMT_XML], [test "$enable_xml_format" = "yes"])
AM_CONDITIONAL([ENABLE_FMT_SPEC], [test "$enable_spec_format" = "yes"])
AM_CONDITIONAL([ENABLE_FMT_CODE], [test "$enable_code_format" = "yes"])

# Output features to preprocessor and compiler
if test "$enable_debug" = "yes"; then
    CPPFLAGS="$CPPFLAGS -UNDEBUG"
    CFLAGS="$CFLAGS -g -O0"
fi

#
# Checks for header files.
#

#
# Checks for typedefs, structures, and compiler characteristics.
#

#
# Checks for declarations
#
if test -n "$XML2_CONFIG"; then
    CFLAGS_BACKUP="$CFLAGS"
    CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
    AC_CHECK_DECLS([xmlStructuredErrorContext], [], [],
                   [[#include <libxml/globals.h>]])
    CFLAGS="$CFLAGS_BACKUP"
fi


#
# Checks for library functions.
#

#
# Output
#
AC_CONFIG_FILES([Makefile

                 m4/Makefile
                 m4/hidrd/Makefile

                 db/Makefile
                 db/usage/Makefile

                 include/Makefile
                 include/hidrd/Makefile
                 include/hidrd/util/Makefile
                 include/hidrd/item/Makefile
                 include/hidrd/item/pfx/Makefile
                 include/hidrd/opt/Makefile
                 include/hidrd/strm/Makefile
                 include/hidrd/strm/src/Makefile
                 include/hidrd/strm/snk/Makefile
                 include/hidrd/fmt/Makefile
                 include/hidrd/fmt/natv/Makefile
                 include/hidrd/fmt/xml/Makefile
                 include/hidrd/fmt/spec/Makefile
                 include/hidrd/fmt/spec/snk/Makefile
                 include/hidrd/fmt/code/Makefile
                 include/hidrd/usage/Makefile

                 lib/Makefile
                 lib/util/Makefile
                 lib/item/Makefile
                 lib/opt/Makefile
                 lib/strm/Makefile
                 lib/strm/src/Makefile
                 lib/strm/snk/Makefile
                 lib/fmt/Makefile
                 lib/fmt/natv/Makefile
                 lib/fmt/xml/Makefile
                 lib/fmt/xml/snk/Makefile
                 lib/fmt/xml/src/Makefile
                 lib/fmt/read_test_data/Makefile
                 lib/fmt/write_test_data/Makefile
                 lib/fmt/spec/Makefile
                 lib/fmt/spec/snk/Makefile
                 lib/fmt/code/Makefile
                 lib/usage/Makefile

                 src/Makefile])
AC_OUTPUT