Fix building with libxml2-2.12.0
[shigofumi.git] / configure.ac
blob8488a2c1f6e38e3d162fe45c5ab86f56ff23cdb3
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.63])
5 AC_INIT([shigofumi], [0.9], [petr.pisar@atlas.cz])
6 AM_INIT_AUTOMAKE([subdir-objects])
7 AC_CONFIG_SRCDIR([src/shigofumi.c])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_HEADERS([src/config.h])
11 # Checks for programs.
12 # Use AM_PROG_CC_C_O instead of AC_PROG_CC because of Automake's subdir-objects
13 AM_PROG_CC_C_O
14 AC_PROG_CPP
17 # Enable debug
18 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
19                         [Compile in debugging mode])])
20 AS_IF([test "$enable_debug" = "yes"],
21       CFLAGS="${CFLAGS} -g"
22       dnl AC_SUBST(DEBUG_CFLAGS)
23       AC_DEFINE([ENABLE_DEBUG], [1],
24                 [Define if you want include debugging code])
25       )
27 # Enable gettext
28 AM_GNU_GETTEXT_VERSION([0.21])
29 AM_GNU_GETTEXT_REQUIRE_VERSION([0.18.2])
30 AM_GNU_GETTEXT([external])
31 AM_CONDITIONAL([BUILD_NLS], [test "$USE_NLS" = "yes"])
33 # Checks for libraries.
34 # Check for libisds
35 AC_SYS_LARGEFILE
36 PKG_CHECK_MODULES([ISDS], libisds >= 0.10.7)
38 # Check for confuse
39 # TODO: Minimal version
40 PKG_CHECK_MODULES([CONFUSE], libconfuse)
42 # Check for magic
43 # TODO: Minimal version
44 AC_CHECK_LIB([magic], [magic_open], ,
45              AC_MSG_FAILURE([Magic Number Recognition Library not found.]))
46 AC_CHECK_DECLS([magic_version], , , [[#include <magic.h>]])
48 # Check for readline
49 GNUPG_CHECK_READLINE()
50 AS_IF([test -z "$LIBREADLINE"], AC_MSG_FAILURE([GNU Readline not found.]))
53 # Consider compiler warnings as errors by default
54 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
55                                       [Do not consider compiler warnings as
56                                        errors])])
57 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
60 # Install (and build if needed) documentation
61 AC_ARG_ENABLE(doc, [AS_HELP_STRING([--disable-doc],
62               [Do not install documentation])])
63 AM_CONDITIONAL([BUILD_DOC], [test "$enable_doc" != "no"])
65 AS_IF([test "$enable_doc" = "no"], , [
66     # Find DocBook XSLT sheets
67     AC_CHECK_PROG([HAVE_XSLTPROC], [xsltproc], [yes])
68     AC_ARG_WITH(docbook-xsl-stylesheets,
69                 [AS_HELP_STRING([--with-docbook-xsl-stylesheets=DIR],
70                         [Specify XSL style sheet root directory for manual page
71                          regeneration from DocBook source])],
72                 , with_docbook_xsl_stylesheets=yes)
74     AS_IF([test "$with_docbook_xsl_stylesheets" = "no"],
75         AC_MSG_WARN([Make sure you have sources with pregenerated manual pages.]),
77         AS_IF([test "$HAVE_XSLTPROC" != "yes"], 
78               AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
79                     AC_MSG_WARN([Missing xsltproc!]),
80                     AC_MSG_FAILURE([Missing xsltproc!])
81                     )
82               )
83         DOCBOOK_STYLE="/usr/share/sgml/docbook/xsl-stylesheets"
84         AS_IF([test "$with_docbook_xsl_stylesheets" != "yes"],
85             [DOCBOOK_STYLE="$with_docbook_xsl_stylesheets"])
86         AC_MSG_CHECKING([for DocBook XSLT stylesheet location in "$DOCBOOK_STYLE"])
87         AS_IF([echo '<para/>' |
88                xsltproc "${DOCBOOK_STYLE}/manpages/docbook.xsl" - 2>/dev/null],
89               AC_MSG_RESULT([ok]) AC_SUBST(DOCBOOK_STYLE),
90               DOCBOOK_STYLE=""
91               AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
92                     AC_MSG_WARN([missing!]),
93                     AC_MSG_FAILURE([missing!])
94                     )
95               )
96         
97     )
98     AS_IF([test "$HAVE_XSLTPROC" != "yes"],
99           AC_MSG_WARN([Missing xsltproc. Make sure you have sources with
100                        pregenerated manual pages.]))
101     ]
103 AM_CONDITIONAL([BUILD_MAN], [test -n "$DOCBOOK_STYLE"])
106 AS_IF([test "$enable_doc" = "no"], , [
107     # Check for po4a needed to generate DocBook manual sources for gettext
108     # catalogues
109     AS_IF([test "$USE_NLS" = "yes"], [
110         AC_CHECK_PROG([HAVE_PO4A], [po4a], [yes])
111         AS_IF([test "$HAVE_PO4A" != "yes"],
112               AC_MSG_WARN([Missing po4a. Make sure you have sources with
113                            pregenerated localized manual pages.])
114         )
115         ]
116     )
117     ]
119 AM_CONDITIONAL([BUILD_MANPO], [test "$HAVE_PO4A" = "yes"])
121 # Check for extended attributes
122 # XXX: AC_CHECK_HEADER() must be in top level scope
123 AC_CHECK_HEADER([sys/xattr.h],
124     [AC_DEFINE([HAVE_SYS_XATTR], [1], [Define if sys/xattr.h is available])
125         have_sys_xattr=yes],
126     [have_sys_xattr=no],
127     [#include <sys/types.h>
128      #include <sys/xattr.h>]
130 AC_CHECK_HEADER([attr/xattr.h],
131     [have_attr_xattr=yes],
132     [have_attr_xattr=no],
133     [#include <sys/types.h>
134      #include <attr/xattr.h>]
136 AC_ARG_ENABLE(xattr, [AS_HELP_STRING([--disable-xattr],
137                         [Disable extended attribute support])])
138 AS_IF([test "$enable_xattr" = "no"],
139     AC_MSG_WARN([Extended attribute support disabled]),
140     AS_IF([test "$have_sys_xattr" = "yes" -o "$have_attr_xattr" = "yes"],
141         AC_DEFINE([ENABLE_XATTR], [1],
142             [Define if you want support extended attributes]),
143         AS_IF([test "$enable_xattr" = "yes"],
144             AC_MSG_FAILURE([Glibc style extended attributes not supported]),
145             AC_MSG_WARN([Glibc style extended attributes not supported])
146         )
147     )
151 # Checks for header files.
152 AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h locale.h stdint.h stdlib.h string.h termios.h unistd.h wchar.h], ,
153                   AC_MSG_FAILURE([Some header files are not usable.]))
155 # Checks for typedefs, structures, and compiler characteristics.
156 AC_TYPE_SIZE_T
157 AC_TYPE_SSIZE_T
158 AC_TYPE_UINT8_T
160 # Checks for library functions.
161 AC_FUNC_MALLOC
162 AC_FUNC_MBRTOWC
163 AC_FUNC_MMAP
164 AC_FUNC_REALLOC
165 AC_FUNC_STRCOLL
166 AC_CHECK_FUNCS([getcwd localtime_r mkstemps munmap nl_langinfo setenv setlocale strerror strtol tzset wcwidth], ,
167                 AC_MSG_FAILURE([Some functions are not usable.]))
168 AC_CHECK_DECLS([memset, strdup], ,
169               AC_MSG_FAILURE([Some string.h declarations were not found.]),
170               [[#include <string.h>]])
172 # Default CFLAGS
173 CFLAGS="${CFLAGS} -std=c99 -Wall"
175 AC_CONFIG_FILES([Makefile doc/Makefile doc/po/Makefile doc/po/po4a-build.conf
176                  doc/po/cs/Makefile po/Makefile.in src/Makefile test/Makefile])
177 AC_OUTPUT