forked from hishamhm/dit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
102 lines (84 loc) · 3.1 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(dit, 0.1, loderunner@users.sf.net)
AC_CONFIG_SRCDIR([dit.c])
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE
# Checks for programs.
AC_PROG_CC
AM_PROG_CC_C_O
# Checks for libraries.
AC_CHECK_LIB([m], [ceil], [], [missing_libraries="$missing_libraries libm"])
AC_ARG_ENABLE(ncurses, [AC_HELP_STRING([--enable-ncurses], [use ncurses (switch to low-level hacks if disabled)])],, enable_ncurses="yes")
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_ARG_ENABLE(unicode, [AC_HELP_STRING([--enable-unicode], [enable Unicode support])], ,enable_unicode="yes")
if test "x$enable_unicode" = xyes; then
AC_DEFINE([HAVE_UNICODE], [1], [Set if Unicode was enabled.])
if test "x$enable_ncurses" = xyes
then
AC_CHECK_LIB([ncursesw], [refresh], [], [
missing_libraries="$missing_libraries libncursesw"
AC_MSG_ERROR([You may want to use --disable-unicode or install libncursesw.])
])
AC_CHECK_HEADERS([ncursesw/curses.h],[:],
[AC_CHECK_HEADERS([ncurses/ncurses.h],[:],
[AC_CHECK_HEADERS([ncurses.h],[:],[missing_headers="$missing_headers $ac_header"])])])
fi
else
if test "x$enable_ncurses" = xyes
then
AC_CHECK_LIB([ncurses], [refresh], [], [missing_libraries="$missing_libraries libncurses"])
AC_CHECK_HEADERS([curses.h],[:],[missing_headers="$missing_headers $ac_header"])
fi
fi
if test ! -z "$missing_libraries"; then
AC_MSG_ERROR([missing libraries: $missing_libraries])
fi
AC_CHECK_HEADERS([limits.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/time.h unistd.h],[:],[
missing_headers="$missing_headers $ac_header"
])
if test ! -z "$missing_headers"; then
AC_MSG_ERROR([missing headers: $missing_headers])
fi
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([gettimeofday memchr memmove memset mkdir putenv realpath regcomp strchr strdup strncasecmp strrchr strstr])
DIT_LUA_VERSION=5.1.5
AC_ARG_ENABLE(bundled-lua, [AC_HELP_STRING([--enable-bundled-lua], [compile bundled copy of Lua])],, enable_bundled_lua="no")
if test x"$enable_bundled_lua" = x"no"
then
AX_LUA_HEADERS
AX_LUA_LIBS
AX_LUA_TRY_LIB_VERSION([501], [502], [], [enable_bundled_lua="yes"])
fi
if test x"$enable_bundled_lua" = x"yes"
then
AC_MSG_RESULT([Using bundled Lua])
lua_extra_libs=
AC_CHECK_LIB([m], [exp], [lua_extra_libs="$lua_extra_libs -lm"], [])
AC_CHECK_LIB([dl], [dlopen], [lua_extra_libs="$lua_extra_libs -ldl"], [])
LUA_INCLUDE=-Ilua-${DIT_LUA_VERSION}/src
LUA_LIB="lua-${DIT_LUA_VERSION}/src/liblua.a $lua_extra_libs"
LUA_DEP="lua-${DIT_LUA_VERSION}/src/liblua.a $lua_extra_libs"
fi
AC_SUBST([LUA_INCLUDE])
AC_SUBST([LUA_LIB])
AC_SUBST([LUA_DEP])
AC_SUBST([DIT_LUA_VERSION])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT