2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([shigofumi], [0.8], [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
18 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
19 [Compile in debugging mode])])
20 AS_IF([test "$enable_debug" = "yes"],
22 dnl AC_SUBST(DEBUG_CFLAGS)
23 AC_DEFINE([ENABLE_DEBUG], [1],
24 [Define if you want include debugging code])
28 AM_GNU_GETTEXT_VERSION([0.18.2])
29 AM_GNU_GETTEXT([external])
30 AM_CONDITIONAL([BUILD_NLS], [test "$USE_NLS" = "yes"])
32 # Checks for libraries.
35 PKG_CHECK_MODULES([ISDS], libisds >= 0.10.7)
38 # TODO: Minimal version
39 PKG_CHECK_MODULES([CONFUSE], libconfuse)
42 # TODO: Minimal version
43 AC_CHECK_LIB([magic], [magic_open], ,
44 AC_MSG_FAILURE([Magic Number Recognition Library not found.]))
45 AC_CHECK_DECLS([magic_version], , , [[#include <magic.h>]])
48 GNUPG_CHECK_READLINE()
49 AS_IF([test -z "$LIBREADLINE"], AC_MSG_FAILURE([GNU Readline not found.]))
52 # Consider compiler warnings as errors by default
53 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
54 [Do not consider compiler warnings as
56 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
59 # Install (and build if needed) documentation
60 AC_ARG_ENABLE(doc, [AS_HELP_STRING([--disable-doc],
61 [Do not install documentation])])
62 AM_CONDITIONAL([BUILD_DOC], [test "$enable_doc" != "no"])
64 AS_IF([test "$enable_doc" = "no"], , [
65 # Find DocBook XSLT sheets
66 AC_CHECK_PROG([HAVE_XSLTPROC], [xsltproc], [yes])
67 AC_ARG_WITH(docbook-xsl-stylesheets,
68 [AS_HELP_STRING([--with-docbook-xsl-stylesheets=DIR],
69 [Specify XSL style sheet root directory for manual page
70 regeneration from DocBook source])],
71 , with_docbook_xsl_stylesheets=yes)
73 AS_IF([test "$with_docbook_xsl_stylesheets" = "no"],
74 AC_MSG_WARN([Make sure you have sources with pregenerated manual pages.]),
76 AS_IF([test "$HAVE_XSLTPROC" != "yes"],
77 AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
78 AC_MSG_WARN([Missing xsltproc!]),
79 AC_MSG_FAILURE([Missing xsltproc!])
82 DOCBOOK_STYLE="/usr/share/sgml/docbook/xsl-stylesheets"
83 AS_IF([test "$with_docbook_xsl_stylesheets" != "yes"],
84 [DOCBOOK_STYLE="$with_docbook_xsl_stylesheets"])
85 AC_MSG_CHECKING([for DocBook XSLT stylesheet location in "$DOCBOOK_STYLE"])
86 AS_IF([echo '<para/>' |
87 xsltproc "${DOCBOOK_STYLE}/manpages/docbook.xsl" - 2>/dev/null],
88 AC_MSG_RESULT([ok]) AC_SUBST(DOCBOOK_STYLE),
90 AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
91 AC_MSG_WARN([missing!]),
92 AC_MSG_FAILURE([missing!])
97 AS_IF([test "$HAVE_XSLTPROC" != "yes"],
98 AC_MSG_WARN([Missing xsltproc. Make sure you have sources with
99 pregenerated manual pages.]))
102 AM_CONDITIONAL([BUILD_MAN], [test -n "$DOCBOOK_STYLE"])
105 AS_IF([test "$enable_doc" = "no"], ,
106 # Check for po4a needed to generate DocBook manual sources for gettext
108 AS_IF([test "$USE_NLS" = "yes"],
109 AC_CHECK_PROG([HAVE_PO4A], [po4a], [yes])
110 AS_IF([test "$HAVE_PO4A" != "yes"],
111 AC_MSG_WARN([Missing po4a. Make sure you have sources with
112 pregenerated localized manual pages.])
116 AM_CONDITIONAL([BUILD_MANPO], [test "$HAVE_PO4A" = "yes"])
118 # Check for extended attributes
119 # XXX: AC_CHECK_HEADER() must be in top level scope
120 AC_CHECK_HEADER([sys/xattr.h],
121 [AC_DEFINE([HAVE_SYS_XATTR], [1], [Define if sys/xattr.h is available])
124 [#include <sys/types.h>
125 #include <sys/xattr.h>]
127 AC_CHECK_HEADER([attr/xattr.h],
128 [have_attr_xattr=yes],
129 [have_attr_xattr=no],
130 [#include <sys/types.h>
131 #include <attr/xattr.h>]
133 AC_ARG_ENABLE(xattr, [AS_HELP_STRING([--disable-xattr],
134 [Disable extended attribute support])])
135 AS_IF([test "$enable_xattr" = "no"],
136 AC_MSG_WARN([Extended attribute support disabled]),
137 AS_IF([test "$have_sys_xattr" = "yes" -o "$have_attr_xattr" = "yes"],
138 AC_DEFINE([ENABLE_XATTR], [1],
139 [Define if you want support extended attributes]),
140 AS_IF([test "$enable_xattr" = "yes"],
141 AC_MSG_FAILURE([Glibc style extended attributes not supported]),
142 AC_MSG_WARN([Glibc style extended attributes not supported])
148 # Checks for header files.
149 AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h locale.h stdint.h stdlib.h string.h termios.h unistd.h wchar.h], ,
150 AC_MSG_FAILURE([Some header files are not usable.]))
152 # Checks for typedefs, structures, and compiler characteristics.
157 # Checks for library functions.
163 AC_CHECK_FUNCS([getcwd localtime_r mkstemps munmap nl_langinfo setenv setlocale strerror strtol tzset wcwidth], ,
164 AC_MSG_FAILURE([Some functions are not usable.]))
165 AC_CHECK_DECLS([memset, strdup], ,
166 AC_MSG_FAILURE([Some string.h declarations were not found.]),
167 [[#include <string.h>]])
170 CFLAGS="${CFLAGS} -std=c99 -Wall"
172 AC_CONFIG_FILES([Makefile doc/Makefile doc/po/Makefile doc/po/po4a-build.conf
173 doc/po/cs/Makefile po/Makefile.in src/Makefile test/Makefile])