Transfotm data.c printf() into UI oprintf()
[shigofumi.git] / configure.ac
blob674d4df227ce59aee80212367e7dfb16c8f7bdf7
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.63])
5 AC_INIT([shigofumi], [0.1], [petr.pisar@atlas.cz])
6 AM_INIT_AUTOMAKE(shigofumi, 0.1)
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 AC_PROG_CC
13 AC_PROG_CPP
16 # Enable debug
17 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],
18                         [Compile in debugging mode])])
19 AS_IF([test "$enable_debug" = "yes"],
20       CFLAGS="${CFLAGS} -g"
21       dnl AC_SUBST(DEBUG_CFLAGS)
22       AC_DEFINE([ENABLE_DEBUG], [1],
23                 [Define if you want include debugging code])
24       )
26 # Enable gettext
27 AM_GNU_GETTEXT_VERSION([0.17])
28 AM_GNU_GETTEXT([external])
30 # Checks for libraries.
31 # Check for libisds
32 AC_SYS_LARGEFILE
33 PKG_CHECK_MODULES([ISDS], libisds >= 0.3)
35 # Check for confuse
36 # TODO: Minimal version
37 PKG_CHECK_MODULES([CONFUSE], libconfuse)
39 # Check for magic
40 # TODO: Minimal version
41 AC_CHECK_LIB([magic], [magic_open])
43 # Check for readline
44 # TODO: Minimal version
45 AC_CHECK_LIB([readline], [readline])
48 # Consider compiler warnings as errors by default
49 AC_ARG_ENABLE(fatalwarnings, [AS_HELP_STRING([--disable-fatalwarnings],
50                                       [Do not consider compiler warnings as
51                                        errors])])
52 AS_IF([test "$enable_fatalwarnings" = "no"], , CFLAGS="${CFLAGS} -Werror")
55 # Find DocBook XSLT sheets
56 AC_CHECK_PROG([HAVE_XSLTPROC], [xsltproc], [yes])
57 AC_ARG_WITH(docbook-xsl-stylesheets,
58             [AS_HELP_STRING([--with-docbook-xsl-stylesheets=DIR],
59                     [Specify XLS style sheet root directory for manual page
60                      regeneration from DocBook source])],
61             , with_docbook_xsl_stylesheets=yes)
62 AS_IF([test "$with_docbook_xsl_stylesheets" = "no"],
63     AC_MSG_WARN([Make sure you have sources with pregenerated manual pages.]),
65     AS_IF([test "$HAVE_XSLTPROC" != "yes"], 
66           AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
67                 AC_MSG_WARN([Missing xsltproc!]),
68                 AC_MSG_FAILURE([Missing xsltproc!])
69                 )
70           )
71     DOCBOOK_STYLE="/usr/share/sgml/docbook/xsl-stylesheets"
72     AS_IF([test "$with_docbook_xsl_stylesheets" != "yes"],
73         [DOCBOOK_STYLE="$with_docbook_xsl_stylesheets"])
74     AC_MSG_CHECKING([for DocBook XSLT stylesheet location in "$DOCBOOK_STYLE"])
75     AS_IF([echo '<para/>' |
76            xsltproc "${DOCBOOK_STYLE}/manpages/docbook.xsl" - 2>/dev/null],
77           AC_MSG_RESULT([ok]) AC_SUBST(DOCBOOK_STYLE),
78           DOCBOOK_STYLE=""
79           AS_IF([test "$with_docbook_xsl_stylesheets" = "yes"],
80                 AC_MSG_WARN([missing!]),
81                 AC_MSG_FAILURE([missing!])
82                 )
83           )
84     
86 AS_IF([test "$HAVE_XSLTPROC" != "yes"],
87       AC_MSG_WARN([Missing xsltproc. Make sure you have sources with
88                    pregenerated manual pages.]))
89 AM_CONDITIONAL([BUILD_MAN], [test -n "$DOCBOOK_STYLE"])
92 # Check for extended attributes
93 # XXX: AC_CHECK_HEADER() must be in top level scope
94 AC_CHECK_HEADER([attr/xattr.h], [have_xattr=yes], [have_xattr=no])
95 AC_ARG_ENABLE(xattr, [AS_HELP_STRING([--disable-xattr],
96                         [Disable extended attribute support])])
97 AS_IF([test "$enable_xattr" = "no"],
98     AC_MSG_WARN([Extended attribute support disabled]),
99     AS_IF([test "$have_xattr" = "yes"],
100         AC_DEFINE([ENABLE_XATTR], [1],
101             [Define if you want support extended attributes]),
102         AS_IF([test "$enable_xattr" = "yes"],
103             AC_MSG_FAILURE([Glibc style extended attributes not supported]),
104             AC_MSG_WARN([Glibc style extended attributes not supported])
105         )
106     )
110 # Checks for header files.
111 AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h locale.h stdint.h stdlib.h string.h termios.h unistd.h wchar.h])
113 # Checks for typedefs, structures, and compiler characteristics.
114 AC_TYPE_SIZE_T
115 AC_TYPE_SSIZE_T
116 AC_TYPE_UINT8_T
118 # Checks for library functions.
119 AC_FUNC_MALLOC
120 AC_FUNC_MBRTOWC
121 AC_FUNC_MMAP
122 AC_FUNC_REALLOC
123 AC_FUNC_STRCOLL
124 AC_CHECK_FUNCS([getcwd localtime_r memset munmap nl_langinfo setenv setlocale strdup strerror strtol tzset wcwidth])
126 # Default CFLAGS
127 CFLAGS="${CFLAGS} -std=c99 -Wall"
129 AC_CONFIG_FILES([Makefile doc/Makefile po/Makefile.in src/Makefile])
130 AC_OUTPUT