Release 0.5.6.1.
[dash/debian.git] / configure.ac
blob05cd2e188bf0ad2384ae80bc282f47c0e2233995
1 AC_INIT(dash, 0.5.6.1)
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 getpwnam getrlimit imaxdiv isalpha killpg mempcpy \
50                sigsetmask stpcpy strchrnul strsignal strtod strtoimax \
51                strtoumax sysconf)
53 if test "$enable_fnmatch" = yes; then
54         use_fnmatch=
55         AC_CHECK_FUNCS(fnmatch, use_fnmatch=yes)
58 if test "$use_fnmatch" = yes && test "$enable_glob" = yes; then
59         AC_CHECK_FUNCS(glob)
62 dnl Check for klibc signal.
63 AC_CHECK_FUNC(signal)
64 if test "$ac_cv_func_signal" != yes; then
65         AC_CHECK_FUNC(bsd_signal,
66                       [AC_DEFINE(signal, bsd_signal,
67                                  [klibc has bsd_signal instead of signal])])
70 dnl Check for stat64 (dietlibc/klibc).
71 AC_CHECK_FUNC(stat64,, [
72         AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
73         AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
74         AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
77 AC_CHECK_FUNC(open64,, [
78         AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
81 AC_ARG_WITH(libedit, AS_HELP_STRING(--with-libedit, [Compile with libedit support]))
82 use_libedit=
83 if test "$with_libedit" = "yes"; then
84         AC_CHECK_LIB(edit, history_init, [
85                 AC_CHECK_HEADER([histedit.h], [use_libedit="yes"],
86                                 AC_MSG_ERROR(
87                                         [Can't find required header files.]))])
89 if test "$use_libedit" != "yes"; then
90         AC_DEFINE([SMALL], 1, [Define if you build with -DSMALL])
91 else
92         export LIBS="$LIBS -ledit"
94 AC_CONFIG_FILES([Makefile src/Makefile])
95 AC_OUTPUT