1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4m4_define(my_version, [m4_esyscmd([tr -d '\n' < version])])
5
6AC_PREREQ([2.69])
7AC_INIT([smenu], [my_version], [p.gen.progs@gmail.com])
8AC_CONFIG_SRCDIR([smenu.c])
9AC_CONFIG_HEADERS([config.h])
10AC_CONFIG_AUX_DIR([build-aux])
11AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2 foreign -Wall])
12AM_SILENT_RULES([yes])
13
14# Checks for programs.
15AC_USE_SYSTEM_EXTENSIONS
16AC_PROG_AWK
17AC_PROG_CC_STDC
18AC_PROG_INSTALL
19AC_PROG_LN_S
20AC_PROG_MAKE_SET
21
22AC_SEARCH_LIBS([tgetent], [tinfo curses ncursesw ncurses], [HAVE_CURSES=True])
23
24# Checks for libraries.
25
26# Checks for header files.
27AC_HEADER_STDC
28AC_CHECK_HEADERS([fcntl.h limits.h langinfo.h locale.h stdint.h stdlib.h \
29                  string.h sys/ioctl.h sys/time.h termios.h unistd.h wchar.h])
30
31# Checks for typedefs, structures, and compiler characteristics.
32AC_TYPE_SIZE_T
33
34# Checks for library functions.
35AC_FUNC_MALLOC
36AC_FUNC_REALLOC
37AC_CHECK_FUNCS([mblen memset nl_langinfo pathconf regcomp setlocale])
38AC_CHECK_FUNCS([strchr strrchr strspn strcasecmp strdup strndup])
39
40AC_CANONICAL_HOST
41# OS-specific tests
42case "${host_os}" in
43*freebsd*|*dragonfly*)
44  CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS"
45  ;;
46
47*darwin*)
48  CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS"
49  ;;
50
51*netbsd*)
52  CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS"
53  ;;
54
55*openbsd*|*bitrig*)
56  CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS"
57  ;;
58esac
59
60AC_CONFIG_FILES([Makefile])
61AC_OUTPUT([smenu.spec])
62