]> git.draconx.ca Git - cdecl99.git/blob - configure.ac
Provide strtoumax fallback in the scanner.
[cdecl99.git] / configure.ac
1 dnl Copyright © 2011-2013, 2020-2023 Nick Bowler
2 dnl
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
6
7 AC_PREREQ([2.68])
8 AC_INIT([cdecl99], [1.2a], [nbowler@draconx.ca])
9 AC_CONFIG_HEADERS([config.h])
10
11 AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects dist-xz])
12 AM_SILENT_RULES([yes])
13 DX_AUTOMAKE_COMPAT
14
15 AC_ARG_WITH([readline],
16   [AS_HELP_STRING([--with-readline],
17     [use GNU readline for line-editing functionality (default: auto)])],
18   [], [with_readline=auto])
19 AS_CASE([$with_readline],
20   [no], [gl_cv_lib_readline=no],
21   [yes|auto], [:],
22   [*], [AC_MSG_ERROR([invalid option --with-readline=$with_readline])])
23
24 AC_PROG_CC_C99
25 AM_PROG_CC_C_O
26 gl_EARLY
27
28 LT_INIT
29 gl_INIT
30
31 # As the mbrtowc replacement module is not used by the library, there is
32 # no need for multithreaded mbrtowc (all programs are single threaded).
33 AC_DEFINE([GNULIB_MBRTOWC_SINGLE_THREAD], [1], [Define to 1.])
34
35 AS_IF([test x"$gl_cv_lib_readline" = x"no"],
36   [AS_IF([test x"$with_readline" = x"yes"],
37     [AC_MSG_FAILURE([--with-readline requested but readline was not found])],
38     [dx_cv_rl_add_history=no])])
39 AC_CACHE_CHECK([if readline supports add_history], [dx_cv_rl_add_history], [dnl
40 dx_cv_rl_add_history=no
41 dx_save_libs=$LIBS
42 LIBS="$LIBS $LIBREADLINE"
43 AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
44 #include <stdio.h>
45 #if HAVE_READLINE_HISTORY_H
46 #  include <readline/history.h>
47 #endif
48 ], [dnl
49 (*add_history)("");
50 ])], [dx_cv_rl_add_history=yes], [dx_cv_rl_add_history=no])
51 LIBS=$dx_save_libs
52 ])
53
54 AS_IF([test x"$dx_cv_rl_add_history" = x"yes"],
55   [AC_DEFINE([HAVE_RL_ADD_HISTORY], [1],
56     [Define to 1 if readline supports add_history.])])
57
58 m4_include([lib/gnulib.mk])
59 DX_GLSYM_PREFIX([cdecl__gl_])
60 DX_GNULIB_SYMFILES([lib/symfiles], [s])
61 AM_CONDITIONAL([BUILD_STATIC], [test x"$enable_static" = x"yes"])
62
63 dnl We provide our own makefile rules for gettext.  Disable tracing of
64 dnl AM_GNU_GETTEXT to prevent autoreconf from running autopoint, and to
65 dnl prevent automake from growing gratuitous error conditions.
66 m4_traceoff([AM_GNU_GETTEXT])
67 AM_GNU_GETTEXT([external])
68 DX_LINGUAS
69
70 AM_CONDITIONAL([USE_NLS], [test x"$USE_NLS" = x"yes"])
71
72 DX_PROG_FLEX([], [have_flex=yes], [have_flex=no])
73 AM_CONDITIONAL([HAVE_FLEX], [test x"$have_flex" = x"yes"])
74
75 DX_PROG_BISON([], [have_bison=yes], [have_bison=no])
76 AM_CONDITIONAL([HAVE_BISON], [test x"$have_bison" = x"yes"])
77
78 DX_BISON_COMPAT
79 BISON_I18N
80
81 BISON_COMPAT=
82 AS_IF([test x"$dx_cv_bison_api_header_include" = x"yes"],
83   [BISON_COMPAT="'--define=api.header.include={\"\$(*F).h\"}'"])
84 AS_IF([test x"$dx_cv_bison_warn_no_deprecated" = x"yes"],
85   [AS_VAR_APPEND([BISON_COMPAT], ["${BISON_COMPAT:+ }-Wno-deprecated"])])
86 AC_SUBST([BISON_COMPAT])
87
88 AH_TOP([#include <conf_pre.h>])
89 AH_BOTTOM([#include <conf_post.h>])
90
91 AC_CONFIG_TESTDIR([.], [test:.])
92 DX_PROG_AUTOTEST
93 AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
94 AC_CHECK_FUNCS_ONCE([strtoumax strtoull __strtoull])
95
96 AC_CONFIG_FILES([
97         Makefile
98 ])
99 AC_OUTPUT