1dnl                                               -*- Autoconf -*-
2dnl Process this file with autoconf to produce a configure script.
3dnl
4dnl This file is free software; as a special exception the author gives
5dnl unlimited permission to copy and/or distribute it, with or without
6dnl modifications, as long as this notice is preserved.
7dnl
8dnl This program is distributed in the hope that it will be useful, but
9dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12
13AC_PREREQ(2.61)
14AC_INIT([GNU teseq], [1.1.1], [bug-teseq@gnu.org])
15AM_INIT_AUTOMAKE([-Wall -Werror dist-bzip2 dist-xz gnu])
16AC_CONFIG_SRCDIR([src/teseq.c])
17AC_CONFIG_HEADER([src/config.h])
18
19# Checks for programs.
20AC_PROG_CC
21AM_PROG_CC_C_O
22AC_PROG_INSTALL
23AM_MISSING_PROG([HELP2MAN], [help2man])
24AM_MISSING_PROG([CHECKMK], [checkmk])
25
26# Checks for libraries.
27
28PKG_CHECK_MODULES([libcheck], [check], , : )
29AM_CONDITIONAL([DO_CHECK_TESTS], [test -n "${libcheck_LIBS:-}"])
30
31# Checks for header files.
32AC_HEADER_STDC
33AC_CHECK_HEADERS([stddef.h stdlib.h string.h strings.h getopt.h])
34
35# Checks for typedefs, structures, and compiler characteristics.
36AC_C_CONST
37AC_TYPE_SIZE_T
38
39# Checks for library functions.
40AC_FUNC_MALLOC
41AC_FUNC_SETVBUF_REVERSED
42AC_FUNC_VPRINTF
43AC_CHECK_FUNCS([strchr])
44
45# Check that vsnprintf take (NULL, 0 ... )
46AC_CACHE_CHECK([for working vsnprintf],
47               [teseq_cv_vsnprintf_works], [dnl
48AC_RUN_IFELSE([AC_LANG_PROGRAM([[
49  #include <stdio.h>
50  #include <stdarg.h>
51
52  int
53  count_printf (const char *format, ...)
54  {
55    int count;
56    va_list ap;
57    va_start (ap, format);
58    count = vsnprintf (NULL, 0, format, ap);
59    va_end (ap);
60    return count;
61  }
62]],[[count_printf ("%s", "supercalifragilisticexpialidocious");]])]
63, [teseq_cv_vsnprintf_works=yes], [teseq_cv_vsnprintf_works=no] )]
64)
65AS_IF([test AS_VAR_GET([teseq_cv_vsnprintf_works]) = yes],,
66            AC_MSG_FAILURE([
67
68  You do not have a reasonable implmentation of vsnprintf.
69  Teseq would either fail to build or segfault.
70]))
71AC_CONFIG_FILES([Makefile])
72AC_CONFIG_FILES([reseq],[chmod +x reseq])
73AC_CONFIG_FILES([run-tests:tests/run.in],[chmod +x run-tests])
74AC_CONFIG_COMMANDS([src/test-inputbuf.inf],
75                   [test "$srcdir" = . || \
76                    cp "$srcdir/src/test-inputbuf.inf" \
77                       src/test-inputbuf.inf])
78AC_CONFIG_COMMANDS([doc],
79                   [mkdir -p doc])
80AC_OUTPUT
81