Support building with bundled LuaJIT.

This commit is contained in:
Alexey Kopytov
2016-03-20 01:38:36 +03:00
parent dec6b9b9e3
commit bf94de28f6
7 changed files with 45 additions and 22 deletions

View File

@ -1,5 +1,5 @@
# Copyright (C) 2004 MySQL AB
# Copyright (C) 2004-2009 Alexey Kopytov <akopytov@gmail.com>
# Copyright (C) 2004-2016 Alexey Kopytov <akopytov@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -17,6 +17,6 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = doc sysbench
SUBDIRS = doc third_party/luajit sysbench
EXTRA_DIST = autogen.sh README README-WIN.txt ChangeLog

View File

@ -85,14 +85,6 @@ if test x$AUTOHEADER = x; then
fi
fi
if test x$PKG_CONFIG = x; then
PKG_CONFIG="pkg-config"
fi
$PKG_CONFIG --version >/dev/null 2>&1 || die \
"$PKG_CONFIG wasn't found, exiting. \
You must have pkg-config installed to compile sysbench"
run $ACLOCAL $ACLOCAL_FLAGS || die "Can't execute aclocal"
run $LIBTOOLIZE $LIBTOOLIZE_FLAGS || die "Can't execute libtoolize"
run $AUTOHEADER || die "Can't execute autoheader"
@ -104,5 +96,3 @@ echo -n "Automade with: "
$AUTOMAKE --version | head -1
echo -n "Configured with: "
$AUTOCONF --version | head -1
echo -n "pkg-config version: "
$PKG_CONFIG --version | head -1

View File

@ -434,7 +434,7 @@ fi
AM_CFLAGS="${CC_WARNINGS} ${AM_CFLAGS} ${PTHREAD_CFLAGS}"
AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/sysbench"
AM_CPPFLAGS="${AM_CPPFLAGS} -I\$(top_srcdir)/sysbench ${LUAJIT_CFLAGS}"
AM_LDFLAGS="$PTHREAD_LIBS"
@ -447,6 +447,7 @@ Makefile
doc/xsl/Makefile
doc/xsl/catalog.xml
doc/Makefile
third_party/luajit/Makefile
sysbench/Makefile
sysbench/drivers/Makefile
sysbench/drivers/mysql/Makefile

View File

@ -32,11 +32,15 @@ AC_CACHE_CHECK([whether to build with system or bundled LuaJIT],
AC_MSG_RESULT([system])
PKG_CHECK_MODULES([LUAJIT], [luajit])
], [
AC_MSG_RESULT([bunled])
AC_MSG_ERROR([Building with bundled LuaJIT is not yet implemented, use --with-system-luajit])
AC_MSG_RESULT([bundled])
LUAJIT_CFLAGS="-I\$(abs_top_builddir)/third_party/luajit/inc"
LUAJIT_LIBS="\$(abs_top_builddir)/third_party/luajit/lib/libluajit-5.1.a"
])
])
AC_DEFINE_UNQUOTED([SB_WITH_LUAJIT], ["$sb_use_luajit"],
[Whether system or bundled LuaJIT is used])
# Add extra flags when building a 64-bit application on OS X,
# http://luajit.org/install.html
AS_CASE([$host_os:$host_cpu],
@ -45,4 +49,3 @@ AS_CASE([$host_os:$host_cpu],
AC_SUBST([LUAJIT_LDFLAGS])
])

View File

@ -1,5 +1,5 @@
# Copyright (C) 2006 MySQL AB
# Copyright (C) 2006-2008 Alexey Kopytov <akopytov@gmail.com>
# Copyright (C) 2006-2016 Alexey Kopytov <akopytov@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -18,5 +18,3 @@
noinst_LIBRARIES = libsbscript.a
libsbscript_a_SOURCES = sb_script.c sb_script.h script_lua.c script_lua.h
libsbscript_a_CPPFLAGS = $(LUAJIT_CFLAGS) $(AM_CPPFLAGS)

View File

@ -1,5 +1,5 @@
/* Copyright (C) 2004 MySQL AB
Copyright (C) 2004-2015 Alexey Kopytov <akopytov@gmail.com>
Copyright (C) 2004-2016 Alexey Kopytov <akopytov@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -70,6 +70,7 @@
#include "db_driver.h"
#include "sb_rnd.h"
#include "sb_thread.h"
#include "luajit.h"
#define VERSION_STRING PACKAGE" "PACKAGE_VERSION
@ -263,8 +264,9 @@ static int register_tests(void)
void print_header(void)
{
log_text(LOG_NOTICE, VERSION_STRING
": multi-threaded system evaluation benchmark\n");
log_text(LOG_NOTICE,
"%s (using %s %s)\n",
VERSION_STRING, SB_WITH_LUAJIT, LUAJIT_VERSION);
}

29
third_party/luajit/Makefile.am vendored Normal file
View File

@ -0,0 +1,29 @@
# Copyright (C) 2016 Alexey Kopytov <akopytov@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = luajit
all-local: $(builddir)/lib/libluajit-5.1.a
$(builddir)/lib/libluajit-5.1.a: luajit/src
$(MAKE) -C $(srcdir)/luajit
$(MAKE) -C $(srcdir)/luajit \
PREFIX=$(abs_top_builddir)/third_party/luajit \
INSTALL_INC=$(abs_top_builddir)/third_party/luajit/inc \
install
clean-local:
$(MAKE) -C luajit clean
rm -rf bin inc lib share