1 dnl Copyright © 2011-2013, 2020-2023 Nick Bowler
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.
8 AC_INIT([cdecl99], [1.2a], [nbowler@draconx.ca])
9 AC_CONFIG_HEADERS([config.h])
11 AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects dist-xz])
12 AM_SILENT_RULES([yes])
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],
22 [*], [AC_MSG_ERROR([invalid option --with-readline=$with_readline])])
31 # Work around quoting bug in Gnulib threadlib.m4 which prevents
32 # correct detection on e.g., Solaris 8. These platforms require
33 # PTHREAD_IN_USE_DETECTION_HARD to be set otherwise cdecl99 will
34 # crash when reporting an error as initialization is not done.
36 # If this gets fixed in Gnulib, we can remove this.
38 [[solaris2.[1-9] | solaris2.[1-9].*]],
39 [AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD])])
41 # As the mbrtowc replacement module is not used by the library, there is
42 # no need for multithreaded mbrtowc (all programs are single threaded).
43 AC_DEFINE([GNULIB_MBRTOWC_SINGLE_THREAD], [1], [Define to 1.])
45 AS_IF([test x"$gl_cv_lib_readline" = x"no"],
46 [AS_IF([test x"$with_readline" = x"yes"],
47 [AC_MSG_FAILURE([--with-readline requested but readline was not found])],
48 [dx_cv_rl_add_history=no])])
49 AC_CACHE_CHECK([if readline supports add_history], [dx_cv_rl_add_history], [dnl
50 dx_cv_rl_add_history=no
52 LIBS="$LIBS $LIBREADLINE"
53 AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
55 #if HAVE_READLINE_HISTORY_H
56 # include <readline/history.h>
60 ])], [dx_cv_rl_add_history=yes], [dx_cv_rl_add_history=no])
64 AS_IF([test x"$dx_cv_rl_add_history" = x"yes"],
65 [AC_DEFINE([HAVE_RL_ADD_HISTORY], [1],
66 [Define to 1 if readline supports add_history.])])
68 m4_include([lib/gnulib.mk])
69 DX_GLSYM_PREFIX([cdecl__gl_])
70 DX_GNULIB_SYMFILES([lib/symfiles], [s])
71 AM_CONDITIONAL([BUILD_STATIC], [test x"$enable_static" = x"yes"])
73 dnl We provide our own makefile rules for gettext. Disable tracing of
74 dnl AM_GNU_GETTEXT to prevent autoreconf from running autopoint, and to
75 dnl prevent automake from growing gratuitous error conditions.
76 m4_traceoff([AM_GNU_GETTEXT])
77 AM_GNU_GETTEXT([external])
80 AM_CONDITIONAL([USE_NLS], [test x"$USE_NLS" = x"yes"])
82 DX_PROG_FLEX([], [have_flex=yes], [have_flex=no])
83 AM_CONDITIONAL([HAVE_FLEX], [test x"$have_flex" = x"yes"])
85 DX_PROG_BISON([], [have_bison=yes], [have_bison=no])
86 AM_CONDITIONAL([HAVE_BISON], [test x"$have_bison" = x"yes"])
92 AS_IF([test x"$dx_cv_bison_api_header_include" = x"yes"],
93 [BISON_COMPAT="'--define=api.header.include={\"\$(*F).h\"}'"])
94 AS_IF([test x"$dx_cv_bison_warn_no_deprecated" = x"yes"],
95 [AS_VAR_APPEND([BISON_COMPAT], ["${BISON_COMPAT:+ }-Wno-deprecated"])])
96 AC_SUBST([BISON_COMPAT])
98 AH_TOP([#include <conf_pre.h>])
99 AH_BOTTOM([#include <conf_post.h>])
101 AC_CONFIG_TESTDIR([.], [test:.])
103 AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
104 AC_CHECK_FUNCS_ONCE([strtoumax strtoull __strtoull])