-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
94 lines (75 loc) · 2.45 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT([mprpclua], [0.1.0], [[email protected]])
AC_CONFIG_SRCDIR([src/msgpackrpc.cpp])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LIBTOOL
# Expand prefix
expanded_prefix=$prefix
if test "x$prefix" = xNONE; then
expanded_prefix=${ac_default_prefix}
fi
# Checks for compiler version
if $CC --version >/dev/null 2>/dev/null; then
ax_prog_cc_version=`$CC --version | head -n 1`
else
ax_prog_cc_version="unknown"
fi
# Checks for pkg-config
AC_PATH_PROGS(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = xno; then
AC_MSG_ERROR([pkg-config not found])
fi
# Checks for MessagePack
# TODO
# Checks for Lua
AC_ARG_WITH([lua],
AS_HELP_STRING([--with-lua=Lua package name],
[used to look-up Lua package, like lua, lua5.1, etc.]),
[lua_pkg_name="$withval"],
[lua_pkg_name="lua"])
if ! $PKG_CONFIG $lua_pkg_name --exists; then
lua_pkg_name="lua5.1"
if ! $PKG_CONFIG $lua_pkg_name --exists; then
AC_MSG_ERROR([Lua not found. Please install Lua or use --with-lua.])
fi
fi
LUA_CFLAGS=`$PKG_CONFIG $lua_pkg_name --cflags`
LUA_LIBS=`$PKG_CONFIG $lua_pkg_name --libs`
LUA_CMOD_DIR=`$PKG_CONFIG $lua_pkg_name --define-variable=prefix=${expanded_prefix} --variable=INSTALL_CMOD`
AC_SUBST(LUA_CFLAGS)
AC_SUBST(LUA_LIBS)
AC_SUBST(LUA_CMOD_DIR)
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
# Checks for library functions.
# Default Compiler Option
if test x$CC = xgcc; then
CFLAGS="$CFLAGS -O2 -g -Wswitch-enum -Wall -D_REENTRANT -Wformat=2 -pipe -D_FORTIFY_SOURCE=1 -Wcast-qual -Wcast-align -Wpointer-arith -Wwrite-strings -fno-omit-frame-pointer"
fi
if test x$CXX = xg++; then
CXXFLAGS="$CXXFLAGS -O2 -g -Wswitch-enum -Wall -D_REENTRANT -Wformat=2 -pipe -D_FORTIFY_SOURCE=1 -Wcast-qual -Wcast-align -Wpointer-arith -Wwrite-strings -Woverloaded-virtual -fno-omit-frame-pointer"
fi
AC_CONFIG_FILES([Makefile
src/Makefile])
AC_OUTPUT
AC_MSG_RESULT([[
[Modules]
Lua: $lua_pkg_name
Lua C Module dir: $LUA_CMOD_DIR]])
AC_MSG_RESULT([[
[Build information]
Package: $PACKAGE_STRING
build (compile on): $ac_cv_build
Compiler: $CC
Compiler version: $ax_prog_cc_version
CFLAGS='$CFLAGS'
CXXFLAGS='$CXXFLAGS']])