2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([shigofumi], [0.2], [petr.pisar@atlas.cz])
6 AM_INIT_AUTOMAKE(shigofumi, 0.2)
7 AC_CONFIG_SRCDIR([src/shigofumi.c])
8 AC_CONFIG_MACRO_DIR([m4])
9 AC_CONFIG_HEADERS([src/config.h])
11 # Checks for programs.
17 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
18 [Compile in debugging mode])])
19 AS_IF([test "$enable_debug" = "yes"],
21 dnl AC_SUBST(DEBUG_CFLAGS)
22 AC_DEFINE([ENABLE_DEBUG], [1],
23 [Define if you want include debugging code])
27 AM_GNU_GETTEXT_VERSION([0.17])
28 AM_GNU_GETTEXT([external])
29 AM_CONDITIONAL([BUILD_NLS], [test "$USE_NLS" = "yes"])
31 # Checks for libraries.
34 PKG_CHECK_MODULES([ISDS], libisds >= 0.6)
37 # TODO: Minimal version
38 PKG_CHECK_MODULES([CONFUSE], libconfuse)
41 # TODO: Minimal version
42 AC_CHECK_LIB([magic], [magic_open])
45 # TODO: Minimal version
46 AC_CHECK_LIB([readline], [readline])
49 # Consider compiler warnings as errors by default
50 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
51 [Do not consider compiler warnings as
53 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
56 # Install (and build if needed) documentation
57 AC_ARG_ENABLE(doc, [AS_HELP_STRING([--disable-doc],
58 [Do not install documentation])])
59 AM_CONDITIONAL([BUILD_DOC], [test "$enable_doc" != "no"])
61 AS_IF([test "$enable_doc" = "no"], , [
62 # Find DocBook XSLT sheets
63 AC_CHECK_PROG([HAVE_XSLTPROC], [xsltproc], [yes])
64 AC_ARG_WITH(docbook-xsl-stylesheets,
65 [AS_HELP_STRING([--with-docbook-xsl-stylesheets=DIR],
66 [Specify XSL style sheet root directory for manual page
67 regeneration from DocBook source])],
68 , with_docbook_xsl_stylesheets=yes)
70 AS_IF([test "$with_docbook_xsl_stylesheets" = "no"],
71 AC_MSG_WARN([Make sure you have sources with pregenerated manual pages.]),
73 AS_IF([test "$HAVE_XSLTPROC" != "yes"],
74 AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
75 AC_MSG_WARN([Missing xsltproc!]),
76 AC_MSG_FAILURE([Missing xsltproc!])
79 DOCBOOK_STYLE="/usr/share/sgml/docbook/xsl-stylesheets"
80 AS_IF([test "$with_docbook_xsl_stylesheets" != "yes"],
81 [DOCBOOK_STYLE="$with_docbook_xsl_stylesheets"])
82 AC_MSG_CHECKING([for DocBook XSLT stylesheet location in "$DOCBOOK_STYLE"])
83 AS_IF([echo '<para/>' |
84 xsltproc "${DOCBOOK_STYLE}/manpages/docbook.xsl" - 2>/dev/null],
85 AC_MSG_RESULT([ok]) AC_SUBST(DOCBOOK_STYLE),
87 AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
88 AC_MSG_WARN([missing!]),
89 AC_MSG_FAILURE([missing!])
94 AS_IF([test "$HAVE_XSLTPROC" != "yes"],
95 AC_MSG_WARN([Missing xsltproc. Make sure you have sources with
96 pregenerated manual pages.]))
99 AM_CONDITIONAL([BUILD_MAN], [test -n "$DOCBOOK_STYLE"])
102 AS_IF([test "$enable_doc" = "no"], ,
103 # Check for po4a needed to generate DocBook manual sources for gettext
105 AS_IF([test "$USE_NLS" = "yes"],
106 AC_CHECK_PROG([HAVE_PO4A], [po4a], [yes])
107 AS_IF([test "$HAVE_PO4A" != "yes"],
108 AC_MSG_WARN([Missing po4a. Make sure you have sources with
109 pregenerated localized manual pages.])
113 AM_CONDITIONAL([BUILD_MANPO], [test "$HAVE_PO4A" = "yes"])
115 # Check for extended attributes
116 # XXX: AC_CHECK_HEADER() must be in top level scope
117 AC_CHECK_HEADER([attr/xattr.h], [have_xattr=yes], [have_xattr=no])
118 AC_ARG_ENABLE(xattr, [AS_HELP_STRING([--disable-xattr],
119 [Disable extended attribute support])])
120 AS_IF([test "$enable_xattr" = "no"],
121 AC_MSG_WARN([Extended attribute support disabled]),
122 AS_IF([test "$have_xattr" = "yes"],
123 AC_DEFINE([ENABLE_XATTR], [1],
124 [Define if you want support extended attributes]),
125 AS_IF([test "$enable_xattr" = "yes"],
126 AC_MSG_FAILURE([Glibc style extended attributes not supported]),
127 AC_MSG_WARN([Glibc style extended attributes not supported])
133 # Checks for header files.
134 AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h locale.h stdint.h stdlib.h string.h termios.h unistd.h wchar.h])
136 # Checks for typedefs, structures, and compiler characteristics.
141 # Checks for library functions.
147 AC_CHECK_FUNCS([getcwd localtime_r memset mkstemps munmap nl_langinfo setenv setlocale strdup strerror strtol tzset wcwidth])
150 CFLAGS="${CFLAGS} -std=c99 -Wall"
152 AC_CONFIG_FILES([Makefile doc/Makefile doc/po/Makefile doc/po/po4a-build.conf doc/po/cs/Makefile po/Makefile.in src/Makefile])