Hopefully fix compilation on *BSD.
[librote.git] / configure.ac
blob9540c1d8fb96d397a82ad7de2fa8d1e08bf15669
1 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT([rote], 0.3.0)
5 AC_SUBST(PACKAGE_NAME)
6 AC_SUBST(PACKAGE_VERSION)
8 AC_CONFIG_SRCDIR([rote.c])
10 dnl Checks for programs.
11 AC_PROG_CC
13 dnl Checks for header files.
14 AC_HEADER_STDC
15 AC_HEADER_STDBOOL
16 AC_CHECK_HEADERS([sys/types.h unistd.h stdlib.h string.h])
18 AC_ARG_ENABLE([widec],AS_HELP_STRING([--enable-widec],[enables wide character support (default disabled)]),[enable_widec=y],[enable_widec=n])
19 dnl Check for libraries
20 AC_ARG_ENABLE([ncurses],AS_HELP_STRING([--disable-ncurses],[disables ncurses support (default enabled)]),[enable_curses=n],[enable_curses=y])
22 if test "$enable_widec" = y; then
23    CFLAGS="$CFLAGS -DUSE_UTF8"
24    ROTE_LIB_NAME=rotew
25    USE_UTF8=1
26 else
27    ROTE_LIB_NAME=rote
28    USE_UTF8=0
31 AC_SUBST(ROTE_LIB_NAME)
32 AC_SUBST(USE_UTF8)
34 if test "$enable_curses" = y; then
35    if test "$enable_widec" = y; then
36       AC_CHECK_LIB([ncursesw], [initscr], [], AC_MSG_ERROR([Need ncursesw to compile ncurses support with wide characters.]))
37    else
38       AC_CHECK_LIB([ncurses], [initscr], [], AC_MSG_ERROR([Need ncurses to compile ncurses support.]))
39    fi
40    CFLAGS="$CFLAGS -DUSE_NCURSES"
41    USE_NCURSES=1
42 else
43    USE_NCURSES=0
46 AC_SUBST(USE_NCURSES)
48 AC_ARG_ENABLE([pty],AS_HELP_STRING([--disable-pty],[disables pty support (default enabled)]),[enable_pty=n],[enable_pty=y])
50 if test "$enable_pty" = y; then
51    AC_CHECK_LIB([util], [forkpty], [],
52    AC_MSG_ERROR([Need util library (forkpty function) to compile pty support.]))
53    CFLAGS="$CFLAGS -DUSE_PTY"
54    USE_PTY=1
55 else
56    USE_PTY=0
59 AC_SUBST(USE_PTY)
61 dnl Checks for library functions
62 AC_CHECK_FUNCS([memset select setenv])
63 AC_FUNC_MALLOC
64 AC_FUNC_SELECT_ARGTYPES
66 dnl Checks for typedefs, structures, and compiler characteristics.
67 AC_C_CONST
68 AC_HEADER_TIME
69 AC_C_INLINE
70 AC_TYPE_PID_T
71 AC_TYPE_SIGNAL
73 AC_CONFIG_FILES([Makefile rote-config rote.h])
74 AC_OUTPUT