Bump to 1.14.1
[platform/upstream/augeas.git] / configure.ac
1 AC_INIT(augeas, 1.14.1)
2 AC_CONFIG_SRCDIR([src/augeas.c])
3 AC_CONFIG_AUX_DIR([build/ac-aux])
4 AM_CONFIG_HEADER([config.h])
5 AM_INIT_AUTOMAKE([-Wno-portability color-tests parallel-tests])
6 AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
7
8
9 dnl Check for NaturalDocs
10 AC_PATH_PROGS([ND_PROG], [naturaldocs NaturalDocs], missing)
11 AM_CONDITIONAL([ND_ENABLED], [test "x$ND_PROG" != "xmissing"])
12
13 dnl NaturalDocs output format, defaults to HTML
14 ND_FORMAT=HTML
15 AC_ARG_WITH([naturaldocs-output],
16   [AS_HELP_STRING([--with-naturaldocs-output=FORMAT],
17     [format of NaturalDocs output (possible values: HTML/FramedHTML, default: HTML)])],
18   [
19     if test "x$ND_PROG" = "xmissing"; then
20       AC_MSG_ERROR([NaturalDocs was not found on your path; there's no point in setting the output format])
21     fi
22     case $withval in
23        HTML|FramedHTML)
24           ND_FORMAT=$withval
25           ;;
26        *)
27           AC_MSG_ERROR($withval is not a supported output format for NaturalDocs)
28           ;;
29     esac
30   ])
31 AC_SUBST(ND_FORMAT)
32
33
34 dnl Check for pdflatex
35 PDFDOCS=""
36 AC_ARG_WITH([pdfdocs],
37   [AS_HELP_STRING([--with-pdfdocs],
38     [whether to use pdflatex to build PDF docs])],
39   [AC_PATH_PROG(PDFLATEX, pdflatex, no)
40    if test "x$PDFLATEX" = "xno"; then
41         AC_MSG_ERROR(You asked to use PDFLatex but it could not be found)
42    else
43         PDFDOCS="pdfdocs"
44    fi
45   ])
46 AC_SUBST(PDFLATEX)
47 AC_SUBST(PDFDOCS)
48
49 dnl Support for memory tests with failmalloc
50 AC_ARG_WITH([failmalloc],
51   [AS_HELP_STRING([--with-failmalloc=FAILMALLOC],
52      [enable failmalloc test targets and use the failmalloc library FAILMALLOC])],
53   [AC_SUBST([LIBFAILMALLOC], ["$with_failmalloc"])],
54   [with_failmalloc=no])
55
56 AM_CONDITIONAL([WITH_FAILMALLOC], [test x$with_failmalloc != xno])
57
58 dnl --enable-debug=(yes|no)
59 AC_ARG_ENABLE([debug],
60               [AC_HELP_STRING([--enable-debug=no/yes],
61                              [enable debugging output])],[],[enable_debug=yes])
62 AM_CONDITIONAL([ENABLE_DEBUG], test x"$enable_debug" = x"yes")
63 if test x"$enable_debug" = x"yes"; then
64    AC_DEFINE([ENABLE_DEBUG], [1], [whether debugging is enabled])
65 fi
66
67 dnl Version info in libtool's notation
68 AC_SUBST([LIBAUGEAS_VERSION_INFO], [25:0:25])
69 AC_SUBST([LIBFA_VERSION_INFO], [6:3:5])
70
71 AC_GNU_SOURCE
72
73 AC_PROG_CC
74 gl_EARLY
75 AC_SYS_LARGEFILE
76
77 dnl gl_INIT uses m4_foreach_w, yet that is not defined in autoconf-2.59.
78 dnl In order to accommodate developers with such old tools, here's a
79 dnl replacement definition.
80 m4_ifndef([m4_foreach_w],
81   [m4_define([m4_foreach_w],
82     [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
83
84 AC_PROG_LIBTOOL
85 AC_PROG_YACC
86 AC_PROG_LEX
87
88 AUGEAS_COMPILE_WARNINGS(maximum)
89
90 ## Compiler flags to be used everywhere
91 AUGEAS_CFLAGS=-std=gnu99
92 AC_SUBST(AUGEAS_CFLAGS)
93
94 AUGEAS_CHECK_READLINE
95 AC_CHECK_FUNCS([open_memstream uselocale])
96
97 AC_MSG_CHECKING([how to pass version script to the linker ($LD)])
98 VERSION_SCRIPT_FLAGS=none
99 if $LD --help 2>&1 | grep "version-script" >/dev/null 2>/dev/null; then
100     VERSION_SCRIPT_FLAGS=-Wl,--version-script=
101     # Solaris needs gnu-version-script-compat to use version-script
102     if test x"$host_os" = x"solaris2.11"; then
103       VERSION_SCRIPT_FLAGS="-z gnu-version-script-compat,${VERSION_SCRIPT_FLAGS}"
104     fi
105 elif $LD --help 2>&1 | grep "M mapfile" >/dev/null 2>/dev/null; then
106     VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
107 fi
108 AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
109 AC_SUBST(VERSION_SCRIPT_FLAGS)
110 AM_CONDITIONAL([USE_VERSION_SCRIPT], [test "$VERSION_SCRIPT_FLAGS" != none])
111
112 gl_INIT
113
114 dnl Should we run the gnulib tests?
115 AC_MSG_CHECKING([if we should run the GNUlib tests])
116 AC_ARG_ENABLE([gnulib-tests],
117     [AS_HELP_STRING([--disable-gnulib-tests],
118         [disable running GNU Portability library tests @<:@default=yes@:>@])],
119         [ENABLE_GNULIB_TESTS="$enableval"],
120         [ENABLE_GNULIB_TESTS=yes])
121 AM_CONDITIONAL([ENABLE_GNULIB_TESTS],[test "x$ENABLE_GNULIB_TESTS" = "xyes"])
122 AC_MSG_RESULT([$ENABLE_GNULIB_TESTS])
123
124 dnl set PC_SELINUX for use by augeas.pc.in
125 PC_SELINUX=$(echo $LIB_SELINUX | sed -e 's/-l/lib/')
126 AC_SUBST([PC_SELINUX])
127
128 PKG_PROG_PKG_CONFIG
129 PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
130
131 AC_CHECK_FUNCS([strerror_r fsync])
132
133 AC_OUTPUT(Makefile \
134           gnulib/lib/Makefile \
135           gnulib/tests/Makefile \
136           src/Makefile \
137           man/Makefile \
138           tests/Makefile \
139           examples/Makefile \
140           doc/Makefile \
141           doc/naturaldocs/Makefile \
142           augeas.pc augeas.spec)
143
144 # Bash completion ...
145 PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
146   bashcompdir="${sysconfdir}/bash_completion.d")
147 AC_SUBST(bashcompdir)