-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
132 lines (113 loc) · 3.92 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
AC_PREREQ(2.59)
AC_INIT([Autotoolized Lua], [5.1.5.04], [], [autotoolized-lua])
AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([src/luaconf_site.h])
AC_CONFIG_SRCDIR([src/lapi.c])
AM_INIT_AUTOMAKE([1.9 foreign serial-tests])
AC_PROG_LN_S
AC_PROG_SED
AC_PROG_CC
AC_PROG_LIBTOOL
# keep this separate from PACKAGE_VERSION, as that tracks
# the autotooled version, not the actual Lua version
AC_SUBST([LUA_VERSION],[5.1.5])
dnl derived from AX_SPLIT_VERSION (see http://www.gnu.org/software/autoconf-archive/ax_split_version.html)
AC_SUBST([LUA_MAJOR_VERSION],[`AS_ECHO_N([$LUA_VERSION]) | $SED 's/\([[^.]][[^.]]*\).*/\1/'`])
AC_SUBST([LUA_MINOR_VERSION],[`AS_ECHO_N([$LUA_VERSION]) | $SED 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`])
AC_SUBST([LUA_RELEASE_VERSION],[`AS_ECHO_N([$LUA_VERSION]) | $SED 's/[[^.]][[^.]]*.[[^.]][[^.]]*.\(.*\)/\1/'`])
AC_ARG_WITH(
[readline],
[AC_HELP_STRING([--with-readline], [Use readline for interpreter input [default=yes]])],
[use_readline=$withval],
[use_readline=yes]
)
LUA_LIBS="-lm"
# Check for readline
READLINE_DEFS="#undef LUA_USE_READLINE"
if test "x$use_readline" == "xyes"; then
AC_CHECK_LIB([readline], [readline], [use_readline=yes], [use_readline=no], [])
AC_CHECK_HEADERS([readline/readline.h readline/history.h], [], [use_readline=no])
if test "x$use_readline" == "xno"; then
AC_MSG_WARN([readline headers could not be found, disabling readline support])
else
READLINE_DEFS="#define LUA_USE_READLINE"
READLINE_LIBS="$READLINE_LIBS -lreadline"
fi
fi
AC_SUBST(READLINE_DEFS)
AC_SUBST(READLINE_LIBS)
case "$host" in
*-mingw*) use_os=win32 ;;
*-darwin*) use_os=macosx ;;
*) use_os=posix ;;
esac
POSIX_DEFS="#undef LUA_USE_POSIX"
LUA_DL_DEFS="#undef LUA_USE_DLOPEN"
LUA_BUILD_AS_DLL_DEFS="#undef LUA_BUILD_AS_DLL"
if test "x$use_os" == "xwin32"; then
LUA_BUILD_AS_DLL_DEFS="#define LUA_BUILD_AS_DLL"
elif test "x$use_os" == "xmacosx"; then
POSIX_DEFS="#define LUA_USE_POSIX"
LUA_DL_DEFS="#define LUA_DL_DYLD"
elif test "x$use_os" == "xposix"; then
POSIX_DEFS="#define LUA_USE_POSIX"
LUA_DL_DEFS="#define LUA_DL_DLOPEN"
LUA_LIBS="$LUA_LIBS -ldl"
fi
AC_SUBST(POSIX_DEFS)
AC_SUBST(LUA_DL_DEFS)
AC_SUBST(LUA_BUILD_AS_DLL_DEFS)
AC_SUBST(LUA_LIBS)
AC_ARG_ENABLE(
[versioned-install],
[AS_HELP_STRING([--enable-versioned-install],
[add suffix to file and directory names [default=no]]
)
],
[],
[enable_versioned_install=no]
)
AM_CONDITIONAL([VERSIONED_INSTALL], [test "x$enable_versioned_install" != xno])
docdir='${datarootdir}/doc/lua'
AM_COND_IF([VERSIONED_INSTALL],
[
suffix=${LUA_MAJOR_VERSION}.${LUA_MINOR_VERSION}
dnl docdir is only lua version dependent; don't append extra suffix
docdir="$docdir${suffix}"
AS_CASE([$enable_versioned_install],
[yes],[],
[suffix=${suffix}${enable_versioned_install}]
)
LUA_PC=lua${suffix}.pc
LUA_LIBNAME=lua${suffix}
LUA_VDIR=${suffix}
includedir="$includedir/lua${suffix}"
AC_SUBST([LUA_VERSIONED_SUFFIX],[$suffix])
],
[LUA_PC=lua.pc
LUA_LIBNAME=lua
LUA_VDIR=${LUA_MAJOR_VERSION}.${LUA_MINOR_VERSION}
]
)
AC_SUBST([LUA_PC])
AC_SUBST([LUA_LIBNAME])
AC_SUBST([LUA_VDIR])
AC_SUBST([exec_datadir],['$(exec_datarootdir)'])
AC_SUBST([exec_datarootdir],['$(exec_prefix)/share'])
AC_ARG_VAR([LUA_PATH_DEFAULT],[Lua's default search path for Lua libraries])
AS_IF([test "x$LUA_PATH_DEFAULT" != "x"],
[AC_DEFINE_UNQUOTED([LUA_PATH_DEFAULT],[$LUA_PATH_DEFAULT],[Lua's default search path for Lua libraries])]
)
AC_ARG_VAR([LUA_CPATH_DEFAULT],[Lua's default search path for C libraries])
AS_IF([test "x$LUA_CPATH_DEFAULT" != "x"],
[AC_DEFINE_UNQUOTED([LUA_CPATH_DEFAULT],[$LUA_CPATH_DEFAULT],[Lua's default search path for C libraries])]
)
AC_CONFIG_FILES([Makefile
src/Makefile
src/luaconf.h.template
etc/Makefile
etc/lua.pc.template
doc/Makefile
test/Makefile])
AC_OUTPUT