File: configure.ac

package info (click to toggle)
lua-lxc 1%3A3.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,600 kB
  • sloc: sh: 4,152; ansic: 477; makefile: 46
file content (127 lines) | stat: -rw-r--r-- 3,452 bytes parent folder | download | duplicates (2)
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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([lua-lxc], [3.0.2])

# We need pkg-config
PKG_PROG_PKG_CONFIG

AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADERS([src/config.h])
AM_INIT_AUTOMAKE([-Wall -Werror -Wno-portability subdir-objects])
AC_CANONICAL_HOST
AM_PROG_CC_C_O
AC_GNU_SOURCE

# libtool
LT_INIT
AC_SUBST([LIBTOOL_DEPS])

# Not in older autoconf versions
# AS_VAR_COPY(DEST, SOURCE)
# -------------------------
# Set the polymorphic shell variable DEST to the contents of the polymorphic
# shell variable SOURCE.
m4_ifdef([AS_VAR_COPY], [],
[AC_DEFUN([AS_VAR_COPY],
    [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
])

dnl PKG_CHECK_VAR was introduced with pkg-config 0.28
m4_ifdef([PKG_CHECK_VAR], [],
[AC_DEFUN([PKG_CHECK_VAR],
    [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
     AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
     _PKG_CONFIG([$1], [variable="][$3]["], [$2])
     AS_VAR_COPY([$1], [pkg_cv_][$1])
     AS_VAR_IF([$1], [""], [$5], [$4])dnl
    ])# PKG_CHECK_VAR
])

AC_ARG_ENABLE([werror],
	[AC_HELP_STRING([--disable-werror],
	[do not treat warnings as errors])],
	[], [enable_werror=yes])

# Configuration examples
AC_ARG_ENABLE([examples],
	[AC_HELP_STRING([--enable-examples], [install examples [default=yes]])],
	[], [enable_examples=yes])
AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = "xyes"])

# Lua module and scripts
AC_ARG_WITH([lua-pc],
	[AS_HELP_STRING(
		[--with-lua-pc=PKG],
		[Specify pkg-config package name for lua]
	)], [], [with_lua_pc=no])

if test "x$with_lua_pc" != "xno"; then
	# exit with error if not found
	PKG_CHECK_MODULES([LUA], [$with_lua_pc], [LUAPKGCONFIG=$with_lua_pc])
fi

if "x$with_lua_pc" != "xno"; then
	PKG_CHECK_MODULES([LUA], [$with_lua_pc],
		[LUAPKGCONFIG=$with_lua_pc
		enable_lua=yes],
		[enable_lua=no])
fi

PKG_CHECK_MODULES([LUA], [lua], [LUAPKGCONFIG=lua],
	[PKG_CHECK_MODULES([LUA], [lua5.2], [LUAPKGCONFIG=lua5.2],
		[PKG_CHECK_MODULES([LUA], [lua5.1], [LUAPKGCONFIG=lua5.1],
			[AS_IF([test "x$enable_lua" = "xyes"],
				[AC_MSG_ERROR([Lua not found. Please use --with-lua-pc=PKG])],
				[enable_lua=no])]
		)]
	)])

AC_MSG_CHECKING([Lua version])
PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [V],,
	[PKG_CHECK_VAR([LUA_VERSION], [$LUAPKGCONFIG], [major_version])])
AC_MSG_RESULT([$LUA_VERSION])
AC_SUBST([LUA_LIBDIR], [$libdir/lua/$LUA_VERSION])
AC_SUBST([LUA_SHAREDIR], [$datadir/lua/$LUA_VERSION])

# Expand some useful variables
AS_AC_EXPAND(PREFIX, "$prefix")
AS_AC_EXPAND(LIBDIR, "$libdir")
AS_AC_EXPAND(BINDIR, "$bindir")
AS_AC_EXPAND(SBINDIR, "$sbindir")
AS_AC_EXPAND(LIBEXECDIR, "$libexecdir")
AS_AC_EXPAND(INCLUDEDIR, "$includedir")
AS_AC_EXPAND(LXCPATH, "$with_config_path")

# We need the install path so criu knows where to reference the hook scripts.
AC_DEFINE_UNQUOTED([DATADIR], "$DATADIR", ["Prefix for shared files."])

# Check for some standard binaries
AC_PROG_GCC_TRADITIONAL
AC_PROG_SED

if test "x$GCC" = "xyes"; then
	CFLAGS="$CFLAGS -Wall"
	if test "x$enable_werror" = "xyes"; then
		CFLAGS="$CFLAGS -Werror"
	fi
fi

# Files requiring some variable expansion
AC_CONFIG_FILES([
	Makefile
	src/Makefile
])
AC_CONFIG_COMMANDS([default],[[]],[[]])
AC_OUTPUT

# Configuration overview
cat << EOF

----------------------------
Environment:
 - compiler: $CC
 - with_lua_pc: $with_lua_pc

EOF