1 dnl Copyright © 2011-2013, 2020-2024 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.
10 AC_INIT([cdecl99], [1.2a], [nbowler@draconx.ca])
11 AC_CONFIG_HEADERS([config.h])
13 AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign subdir-objects dist-xz])
14 AM_SILENT_RULES([yes])
17 AC_ARG_WITH([readline],
18 [AS_HELP_STRING([--with-readline],
19 [use GNU readline for line-editing functionality (default: auto)])],
20 [], [with_readline=auto])
21 AS_CASE([$with_readline],
22 [no], [gl_cv_lib_readline=no],
24 [*], [AC_MSG_ERROR([invalid option --with-readline=$with_readline])])
31 AC_TYPE_UNSIGNED_LONG_LONG_INT
32 AC_C_FLEXIBLE_ARRAY_MEMBER
39 # As the mbrtowc replacement module is not used by the library, there is
40 # no need for multithreaded mbrtowc (all programs are single threaded).
41 AC_DEFINE([GNULIB_MBRTOWC_SINGLE_THREAD], [1], [Define to 1.])
43 AS_IF([test x"$gl_cv_lib_readline" = x"no"],
44 [AS_IF([test x"$with_readline" = x"yes"],
45 [AC_MSG_FAILURE([--with-readline requested but readline was not found])],
46 [dx_cv_rl_add_history=no])])
47 AC_CACHE_CHECK([if readline supports add_history], [dx_cv_rl_add_history], [dnl
48 dx_cv_rl_add_history=no
50 LIBS="$LIBS $LIBREADLINE"
51 AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
53 #if HAVE_READLINE_HISTORY_H
54 # include <readline/history.h>
58 ])], [dx_cv_rl_add_history=yes], [dx_cv_rl_add_history=no])
62 AS_IF([test x"$dx_cv_rl_add_history" = x"yes"],
63 [AC_DEFINE([HAVE_RL_ADD_HISTORY], [1],
64 [Define to 1 if readline supports add_history.])])
66 m4_include([lib/gnulib.mk])
67 DX_GLSYM_PREFIX([cdecl__gl_])
68 DX_GNULIB_SYMFILES([lib/symfiles], [s])
69 AM_CONDITIONAL([BUILD_STATIC], [test x"$enable_static" = x"yes"])
71 AM_CONDITIONAL([USE_NLS], [test x"$USE_NLS" = x"yes"])
73 DX_PROG_FLEX([], [have_flex=yes], [have_flex=no])
74 AM_CONDITIONAL([HAVE_FLEX], [test x"$have_flex" = x"yes"])
76 DX_PROG_BISON([], [have_bison=yes], [have_bison=no])
77 AM_CONDITIONAL([HAVE_BISON], [test x"$have_bison" = x"yes"])
83 AS_IF([test x"$dx_cv_bison_api_header_include" = x"yes"],
84 [BISON_COMPAT="'--define=api.header.include={\"\$(*F).h\"}'"])
85 AS_IF([test x"$dx_cv_bison_warn_no_deprecated" = x"yes"],
86 [AS_VAR_APPEND([BISON_COMPAT], ["${BISON_COMPAT:+ }-Wno-deprecated"])])
87 AC_SUBST([BISON_COMPAT])
89 AS_CASE([$dx_cv_bison_define_cmdline], [yes],
90 [AC_CACHE_CHECK([whether $BISON supports api.token.raw],
91 [dx_cv_bison_api_token_raw], [dx_cv_bison_api_token_raw=no
92 cat >conftest.y <<'EOF'
95 int yylex(void) { return 0; }
96 void yyerror(const char *msg) { }
101 AS_IF([$BISON --define api.token.raw conftest.y >&AS_MESSAGE_LOG_FD 2>&1],
102 [AC_COMPUTE_INT([testval], [T_TEST], [#include "conftest.tab.c"
104 AS_IF([test "$testval" -lt 256], [dx_cv_bison_api_token_raw=yes])])])
105 AS_CASE([$dx_cv_bison_api_token_raw], [yes],
106 [AS_VAR_APPEND([BISON_COMPAT], [" --define api.token.raw"])])])
108 AH_TOP([#include <conf_pre.h>])
109 AH_BOTTOM([#include <conf_post.h>])
111 AC_CONFIG_TESTDIR([.], [t:.])
114 AC_CACHE_CHECK([for getline], [dx_cv_have_getline],
115 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
116 ], [ssize_t (*x)() = getline;
119 return getline(&p, &n, stdin);
120 ])], [dx_cv_have_getline=yes], [dx_cv_have_getline=no])])
121 AS_CASE([$dx_cv_have_getline], [yes],
122 [AC_DEFINE([HAVE_GETLINE], [1],
123 [Define to 1 if the getline function is available.])])
125 AC_CONFIG_FILES([Makefile])