Added SQLite3 support to configure script

* Renamed aclocal.m4 to local.m4
* Created autogen.sh script
* Added SQLite3 stuff in configure.in (using pkg-config)
* Added SQLite3 stuff in Makefile templates

Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely Polonkai (W00d5t0ck) 2012-03-06 16:40:04 +01:00
parent 4a5524e601
commit 55605b3f97
8 changed files with 6338 additions and 3167 deletions

1
cnf/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
autom4te.cache

237
cnf/aclocal.m4 vendored
View File

@ -1,77 +1,174 @@
AC_DEFUN(AC_CHECK_PROTO,
[
ac_safe=translit($1, './+-', '__p_');
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
AC_MSG_CHECKING([if $1 is prototyped])
AC_CACHE_VAL(ac_cv_prototype_$ac_safe, [#
if test $ac_cv_gcc_fnb = yes; then
OLDCFLAGS=$CFLAGS
CFLAGS="$CFLAGS -fno-builtin"
fi
AC_TRY_COMPILE([
#define NO_LIBRARY_PROTOTYPES
#define __COMM_C__
#define __ACT_OTHER_C__
#include "src/sysdep.h"
#ifdef $1
error - already defined!
#endif
void $1(int a, char b, int c, char d, int e, char f, int g, char h);
],dnl
,
eval "ac_cv_prototype_$ac_safe=no",eval "ac_cv_prototype_$ac_safe=yes")
if test $ac_cv_gcc_fnb = yes; then
CFLAGS=$OLDCFLAGS
fi
])
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
if eval "test \"`echo '$ac_cv_prototype_'$ac_safe`\" = yes"; then
AC_MSG_RESULT(yes)
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
#
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED
# -----------------------------
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
AC_DEFINE(builtin(format, NEED_%s_PROTO, translit($1, 'a-z', 'A-Z')), , Check for a prototype to $1.)
AC_MSG_RESULT(no)
fi
])
dnl @@@t1="MAKE_PROTO_SAFE($1)"; t2="MAKE_PROTO_NAME($t1)"; literals="$literals $t2"@@@])
_pkg_short_errors_supported=no
fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED
AC_DEFUN(AC_UNSAFE_CRYPT, [
AC_CACHE_CHECK([whether crypt needs over 10 characters], ac_cv_unsafe_crypt, [
if test ${ac_cv_header_crypt_h-no} = yes; then
use_crypt_header="#include <crypt.h>"
fi
if test ${ac_cv_lib_crypt_crypt-no} = yes; then
ORIGLIBS=$LIBS
LIBS="-lcrypt $LIBS"
fi
AC_TRY_RUN(
changequote(<<, >>)dnl
<<
#define _XOPEN_SOURCE
#include <string.h>
#include <unistd.h>
$use_crypt_header
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND])
#
#
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
int main(void)
{
char pwd[11], pwd2[11];
pkg_failed=no
AC_MSG_CHECKING([for $1])
strncpy(pwd, (char *)crypt("FooBar", "BazQux"), 10);
pwd[10] = '\0';
strncpy(pwd2, (char *)crypt("xyzzy", "BazQux"), 10);
pwd2[10] = '\0';
if (strcmp(pwd, pwd2) == 0)
exit(0);
exit(1);
}
>>
changequote([, ])dnl
, ac_cv_unsafe_crypt=yes, ac_cv_unsafe_crypt=no, ac_cv_unsafe_crypt=no)])
if test $ac_cv_unsafe_crypt = yes; then
AC_DEFINE(HAVE_UNSAFE_CRYPT)
fi
if test ${ac_cv_lib_crypt_crypt-no} = yes; then
LIBS=$ORIGLIBS
fi
])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])# PKG_CHECK_MODULES
m4_include([local.m4])

2
cnf/autogen.sh Executable file
View File

@ -0,0 +1,2 @@
aclocal -I .
autoconf

View File

@ -1,5 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/act.comm.c)
AC_CONFIG_MACRO_DIR([.])
AC_SUBST(MYFLAGS)
AC_SUBST(NETLIB)
AC_SUBST(CRYPTLIB)
@ -210,6 +211,10 @@ AC_CHECK_PROTO(unlink)
AC_CHECK_PROTO(vsnprintf)
AC_CHECK_PROTO(write)
PKG_CHECK_MODULES([SQLITE3], sqlite3)
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LIBS)
AC_OUTPUT(src/Makefile src/util/Makefile)
#
echo "Configuration completed. To compile, type: cd src; make"

77
cnf/local.m4 Normal file
View File

@ -0,0 +1,77 @@
AC_DEFUN(AC_CHECK_PROTO,
[
ac_safe=translit($1, './+-', '__p_');
AC_MSG_CHECKING([if $1 is prototyped])
AC_CACHE_VAL(ac_cv_prototype_$ac_safe, [#
if test $ac_cv_gcc_fnb = yes; then
OLDCFLAGS=$CFLAGS
CFLAGS="$CFLAGS -fno-builtin"
fi
AC_TRY_COMPILE([
#define NO_LIBRARY_PROTOTYPES
#define __COMM_C__
#define __ACT_OTHER_C__
#include "src/sysdep.h"
#ifdef $1
error - already defined!
#endif
void $1(int a, char b, int c, char d, int e, char f, int g, char h);
],dnl
,
eval "ac_cv_prototype_$ac_safe=no",eval "ac_cv_prototype_$ac_safe=yes")
if test $ac_cv_gcc_fnb = yes; then
CFLAGS=$OLDCFLAGS
fi
])
if eval "test \"`echo '$ac_cv_prototype_'$ac_safe`\" = yes"; then
AC_MSG_RESULT(yes)
else
AC_DEFINE(builtin(format, NEED_%s_PROTO, translit($1, 'a-z', 'A-Z')), , Check for a prototype to $1.)
AC_MSG_RESULT(no)
fi
])
dnl @@@t1="MAKE_PROTO_SAFE($1)"; t2="MAKE_PROTO_NAME($t1)"; literals="$literals $t2"@@@])
AC_DEFUN(AC_UNSAFE_CRYPT, [
AC_CACHE_CHECK([whether crypt needs over 10 characters], ac_cv_unsafe_crypt, [
if test ${ac_cv_header_crypt_h-no} = yes; then
use_crypt_header="#include <crypt.h>"
fi
if test ${ac_cv_lib_crypt_crypt-no} = yes; then
ORIGLIBS=$LIBS
LIBS="-lcrypt $LIBS"
fi
AC_TRY_RUN(
changequote(<<, >>)dnl
<<
#define _XOPEN_SOURCE
#include <string.h>
#include <unistd.h>
$use_crypt_header
int main(void)
{
char pwd[11], pwd2[11];
strncpy(pwd, (char *)crypt("FooBar", "BazQux"), 10);
pwd[10] = '\0';
strncpy(pwd2, (char *)crypt("xyzzy", "BazQux"), 10);
pwd2[10] = '\0';
if (strcmp(pwd, pwd2) == 0)
exit(0);
exit(1);
}
>>
changequote([, ])dnl
, ac_cv_unsafe_crypt=yes, ac_cv_unsafe_crypt=no, ac_cv_unsafe_crypt=no)])
if test $ac_cv_unsafe_crypt = yes; then
AC_DEFINE(HAVE_UNSAFE_CRYPT)
fi
if test ${ac_cv_lib_crypt_crypt-no} = yes; then
LIBS=$ORIGLIBS
fi
])

9111
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -19,9 +19,9 @@ PROFILE =
BINDIR = ../bin
CFLAGS = @CFLAGS@ $(MYFLAGS) $(PROFILE)
CFLAGS = @CFLAGS@ @SQLITE3_CFLAGS@ $(MYFLAGS) $(PROFILE)
LIBS = @LIBS@ @CRYPTLIB@ @NETLIB@
LIBS = @LIBS@ @SQLITE3_LIBS@ @CRYPTLIB@ @NETLIB@
OBJFILES = act.comm.o act.informative.o act.item.o act.movement.o \
act.offensive.o act.other.o act.social.o act.wizard.o alias.o ban.o \
@ -29,7 +29,7 @@ OBJFILES = act.comm.o act.informative.o act.item.o act.movement.o \
graph.o handler.o house.o interpreter.o limits.o magic.o mail.o \
mobact.o modify.o objsave.o olc.o random.o shop.o spec_assign.o \
spec_procs.o spell_parser.o spells.o utils.o weather.o \
bsd-snprintf.o
bsd-snprintf.o races.o
CXREF_FILES = act.comm.c act.informative.c act.item.c act.movement.c \
act.offensive.c act.other.c act.social.c act.wizard.c alias.c ban.c \
@ -37,7 +37,7 @@ CXREF_FILES = act.comm.c act.informative.c act.item.c act.movement.c \
graph.c handler.c house.c interpreter.c limits.c magic.c mail.c \
mobact.c modify.c objsave.c olc.c random.c shop.c spec_assign.c\
spec_procs.c spell_parser.c spells.c utils.c weather.c \
bsd-snprintf.c
bsd-snprintf.c races.c
default: all
@ -179,6 +179,8 @@ objsave.o: objsave.c conf.h sysdep.h structs.h comm.h handler.h db.h \
olc.o: olc.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h handler.h db.h \
olc.h
$(CC) -c $(CFLAGS) olc.c
races.o: races.c conf.h sysdep.h structs.h interpreter.h utils.h
$(CC) -c $(CFLAGS) races.c
random.o: random.c utils.h
$(CC) -c $(CFLAGS) random.c
shop.o: shop.c conf.h sysdep.h structs.h comm.h handler.h db.h interpreter.h \

View File

@ -19,7 +19,9 @@ BINDIR = ../../bin
# location of Circle include files
INCDIR = ..
CFLAGS = @CFLAGS@ $(MYFLAGS) $(PROFILE) -I$(INCDIR)
CFLAGS = @CFLAGS@ @SQLITE3_CFLAGS@ $(MYFLAGS) $(PROFILE) -I$(INCDIR)
LIBS = @LIBS@ @SQLITE3_LIBS@
default: all
@ -52,40 +54,40 @@ wld2html: $(BINDIR)/wld2html
$(BINDIR)/autowiz: autowiz.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \
$(INCDIR)/structs.h $(INCDIR)/utils.h $(INCDIR)/db.h
$(CC) $(CFLAGS) -o $(BINDIR)/autowiz autowiz.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/autowiz autowiz.c
$(BINDIR)/delobjs: delobjs.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \
$(INCDIR)/structs.h $(INCDIR)/utils.h
$(CC) $(CFLAGS) -o $(BINDIR)/delobjs delobjs.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/delobjs delobjs.c
$(BINDIR)/listrent: listrent.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \
$(INCDIR)/structs.h
$(CC) $(CFLAGS) -o $(BINDIR)/listrent listrent.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/listrent listrent.c
$(BINDIR)/mudpasswd: mudpasswd.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \
$(INCDIR)/structs.h $(INCDIR)/utils.h
$(CC) $(CFLAGS) -o $(BINDIR)/mudpasswd mudpasswd.c @CRYPTLIB@
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/mudpasswd mudpasswd.c @CRYPTLIB@
$(BINDIR)/play2to3: play2to3.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h
$(CC) $(CFLAGS) -o $(BINDIR)/play2to3 play2to3.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/play2to3 play2to3.c
$(BINDIR)/purgeplay: purgeplay.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \
$(INCDIR)/structs.h $(INCDIR)/utils.h
$(CC) $(CFLAGS) -o $(BINDIR)/purgeplay purgeplay.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/purgeplay purgeplay.c
$(BINDIR)/shopconv: shopconv.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \
$(INCDIR)/structs.h $(INCDIR)/db.h $(INCDIR)/utils.h $(INCDIR)/shop.h
$(CC) $(CFLAGS) -o $(BINDIR)/shopconv shopconv.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/shopconv shopconv.c
$(BINDIR)/showplay: showplay.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h \
$(INCDIR)/structs.h
$(CC) $(CFLAGS) -o $(BINDIR)/showplay showplay.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/showplay showplay.c
$(BINDIR)/sign: sign.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h
$(CC) $(CFLAGS) -o $(BINDIR)/sign sign.c @NETLIB@
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/sign sign.c @NETLIB@
$(BINDIR)/split: split.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h
$(CC) $(CFLAGS) -o $(BINDIR)/split split.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/split split.c
$(BINDIR)/wld2html: wld2html.c $(INCDIR)/conf.h $(INCDIR)/sysdep.h
$(CC) $(CFLAGS) -o $(BINDIR)/wld2html wld2html.c
$(CC) $(CFLAGS) $(LIBS) -o $(BINDIR)/wld2html wld2html.c