[BUILTIN] Fix CTLESC clobbering by read(1)
[dash.git] / configure.ac
blobc943725cddba33755bc86c9d6167b4f7d88ea28b
1 AC_INIT(dash, 0.5.6)
2 AM_INIT_AUTOMAKE([foreign])
3 AC_CONFIG_SRCDIR([src/main.c])
5 AC_CONFIG_HEADERS(config.h)
7 dnl Checks for programs.
8 AC_PROG_CC
9 AC_GNU_SOURCE
10 AC_PROG_YACC
12 AC_MSG_CHECKING([for build system compiler])
13 if test "$cross_compiling" = yes; then
14         CC_FOR_BUILD=${CC_FOR_BUILD-cc}
15 else
16         CC_FOR_BUILD=${CC}
18 AC_MSG_RESULT(${CC_FOR_BUILD})
19 AC_SUBST(CC_FOR_BUILD)
21 AC_MSG_CHECKING([for __attribute__((__alias__()))])
22 dash_cv_have_attribute_alias=no
23 AC_LINK_IFELSE([AC_LANG_PROGRAM([void t() {}
24                                  void a() __attribute__((__alias__("t")));],
25                                 [a();])],
26                [dash_cv_have_attribute_alias=yes])
27 AC_MSG_RESULT($dash_cv_have_attribute_alias)
28 if test "x$dash_cv_have_attribute_alias" = xyes; then
29   AC_DEFINE([HAVE_ALIAS_ATTRIBUTE], 1,
30             [Define if __attribute__((__alias__())) is supported])
33 AC_ARG_ENABLE(static, AS_HELP_STRING(--enable-static, \
34                                      [Build statical linked program]))
35 if test "$enable_static" = "yes"; then
36         export LDFLAGS="-static -Wl,--fatal-warnings"
39 AC_ARG_ENABLE(fnmatch, AS_HELP_STRING(--enable-fnmatch, \
40                                       [Use fnmatch(3) from libc]))
41 AC_ARG_ENABLE(glob, AS_HELP_STRING(--enable-glob, [Use glob(3) from libc]))
43 dnl Checks for libraries.
45 dnl Checks for header files.
46 AC_CHECK_HEADERS(alloca.h)
48 dnl Checks for library functions.
49 AC_CHECK_FUNCS(bsearch faccessat getpwnam getrlimit imaxdiv isalpha killpg \
50                mempcpy \
51                sigsetmask stpcpy strchrnul strsignal strtod strtoimax \
52                strtoumax sysconf)
54 if test "$enable_fnmatch" = yes; then
55         use_fnmatch=
56         AC_CHECK_FUNCS(fnmatch, use_fnmatch=yes)
59 if test "$use_fnmatch" = yes && test "$enable_glob" = yes; then
60         AC_CHECK_FUNCS(glob)
63 dnl Check for klibc signal.
64 AC_CHECK_FUNC(signal)
65 if test "$ac_cv_func_signal" != yes; then
66         AC_CHECK_FUNC(bsd_signal,
67                       [AC_DEFINE(signal, bsd_signal,
68                                  [klibc has bsd_signal instead of signal])])
71 dnl Check for stat64 (dietlibc/klibc).
72 AC_CHECK_FUNC(stat64,, [
73         AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
74         AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
75         AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
78 AC_CHECK_FUNC(open64,, [
79         AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
82 AC_ARG_WITH(libedit, AS_HELP_STRING(--with-libedit, [Compile with libedit support]))
83 use_libedit=
84 if test "$with_libedit" = "yes"; then
85         AC_CHECK_LIB(edit, history_init, [
86                 AC_CHECK_HEADER([histedit.h], [use_libedit="yes"],
87                                 AC_MSG_ERROR(
88                                         [Can't find required header files.]))])
90 if test "$use_libedit" != "yes"; then
91         AC_DEFINE([SMALL], 1, [Define if you build with -DSMALL])
92 else
93         export LIBS="$LIBS -ledit"
95 AC_CONFIG_FILES([Makefile src/Makefile])
96 AC_OUTPUT