Add subdir-objects to Automake options
[shigofumi.git] / configure.ac
blob07138ac4c32f59eedbf649b739510760450e7475
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.63])
5 AC_INIT([shigofumi], [0.6], [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.18.2])
29 AM_GNU_GETTEXT([external])
30 AM_CONDITIONAL([BUILD_NLS], [test "$USE_NLS" = "yes"])
32 # Checks for libraries.
33 # Check for libisds
34 AC_SYS_LARGEFILE
35 PKG_CHECK_MODULES([ISDS], libisds >= 0.10)
37 # Check for confuse
38 # TODO: Minimal version
39 PKG_CHECK_MODULES([CONFUSE], libconfuse)
41 # Check for magic
42 # TODO: Minimal version
43 AC_CHECK_LIB([magic], [magic_open], ,
44              AC_MSG_FAILURE([Magic Number Recognition Library not found.]))
46 # Check for readline
47 GNUPG_CHECK_READLINE()
48 AS_IF([test -z "$LIBREADLINE"], AC_MSG_FAILURE([GNU Readline not found.]))
51 # Consider compiler warnings as errors by default
52 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
53                                       [Do not consider compiler warnings as
54                                        errors])])
55 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
58 # Install (and build if needed) documentation
59 AC_ARG_ENABLE(doc, [AS_HELP_STRING([--disable-doc],
60               [Do not install documentation])])
61 AM_CONDITIONAL([BUILD_DOC], [test "$enable_doc" != "no"])
63 AS_IF([test "$enable_doc" = "no"], , [
64     # Find DocBook XSLT sheets
65     AC_CHECK_PROG([HAVE_XSLTPROC], [xsltproc], [yes])
66     AC_ARG_WITH(docbook-xsl-stylesheets,
67                 [AS_HELP_STRING([--with-docbook-xsl-stylesheets=DIR],
68                         [Specify XSL style sheet root directory for manual page
69                          regeneration from DocBook source])],
70                 , with_docbook_xsl_stylesheets=yes)
72     AS_IF([test "$with_docbook_xsl_stylesheets" = "no"],
73         AC_MSG_WARN([Make sure you have sources with pregenerated manual pages.]),
75         AS_IF([test "$HAVE_XSLTPROC" != "yes"], 
76               AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
77                     AC_MSG_WARN([Missing xsltproc!]),
78                     AC_MSG_FAILURE([Missing xsltproc!])
79                     )
80               )
81         DOCBOOK_STYLE="/usr/share/sgml/docbook/xsl-stylesheets"
82         AS_IF([test "$with_docbook_xsl_stylesheets" != "yes"],
83             [DOCBOOK_STYLE="$with_docbook_xsl_stylesheets"])
84         AC_MSG_CHECKING([for DocBook XSLT stylesheet location in "$DOCBOOK_STYLE"])
85         AS_IF([echo '<para/>' |
86                xsltproc "${DOCBOOK_STYLE}/manpages/docbook.xsl" - 2>/dev/null],
87               AC_MSG_RESULT([ok]) AC_SUBST(DOCBOOK_STYLE),
88               DOCBOOK_STYLE=""
89               AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
90                     AC_MSG_WARN([missing!]),
91                     AC_MSG_FAILURE([missing!])
92                     )
93               )
94         
95     )
96     AS_IF([test "$HAVE_XSLTPROC" != "yes"],
97           AC_MSG_WARN([Missing xsltproc. Make sure you have sources with
98                        pregenerated manual pages.]))
99     ]
101 AM_CONDITIONAL([BUILD_MAN], [test -n "$DOCBOOK_STYLE"])
104 AS_IF([test "$enable_doc" = "no"], ,
105     # Check for po4a needed to generate DocBook manual sources for gettext
106     # catalogues
107     AS_IF([test "$USE_NLS" = "yes"],
108         AC_CHECK_PROG([HAVE_PO4A], [po4a], [yes])
109         AS_IF([test "$HAVE_PO4A" != "yes"],
110               AC_MSG_WARN([Missing po4a. Make sure you have sources with
111                            pregenerated localized manual pages.])
112         )
113     )
115 AM_CONDITIONAL([BUILD_MANPO], [test "$HAVE_PO4A" = "yes"])
117 # Check for extended attributes
118 # XXX: AC_CHECK_HEADER() must be in top level scope
119 AC_CHECK_HEADER([attr/xattr.h], [have_xattr=yes], [have_xattr=no])
120 AC_ARG_ENABLE(xattr, [AS_HELP_STRING([--disable-xattr],
121                         [Disable extended attribute support])])
122 AS_IF([test "$enable_xattr" = "no"],
123     AC_MSG_WARN([Extended attribute support disabled]),
124     AS_IF([test "$have_xattr" = "yes"],
125         AC_DEFINE([ENABLE_XATTR], [1],
126             [Define if you want support extended attributes]),
127         AS_IF([test "$enable_xattr" = "yes"],
128             AC_MSG_FAILURE([Glibc style extended attributes not supported]),
129             AC_MSG_WARN([Glibc style extended attributes not supported])
130         )
131     )
135 # Checks for header files.
136 AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h locale.h stdint.h stdlib.h string.h termios.h unistd.h wchar.h], ,
137                   AC_MSG_FAILURE([Some header files are not usable.]))
139 # Checks for typedefs, structures, and compiler characteristics.
140 AC_TYPE_SIZE_T
141 AC_TYPE_SSIZE_T
142 AC_TYPE_UINT8_T
144 # Checks for library functions.
145 AC_FUNC_MALLOC
146 AC_FUNC_MBRTOWC
147 AC_FUNC_MMAP
148 AC_FUNC_REALLOC
149 AC_FUNC_STRCOLL
150 AC_CHECK_FUNCS([getcwd localtime_r mkstemps munmap nl_langinfo setenv setlocale strerror strtol tzset wcwidth], ,
151                 AC_MSG_FAILURE([Some functions are not usable.]))
152 AC_CHECK_DECLS([memset, strdup], ,
153               AC_MSG_FAILURE([Some string.h declarations were not found.]),
154               [[#include <string.h>]])
156 # Default CFLAGS
157 CFLAGS="${CFLAGS} -std=c99 -Wall"
159 AC_CONFIG_FILES([Makefile doc/Makefile doc/po/Makefile doc/po/po4a-build.conf
160                  doc/po/cs/Makefile po/Makefile.in src/Makefile test/Makefile])
161 AC_OUTPUT