mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
Merge pull request #203 from jevolk/master
Bison C++ linkage + build improvements
This commit is contained in:
commit
b68010df31
19 changed files with 150 additions and 117 deletions
|
@ -108,6 +108,11 @@ cache:
|
|||
|
||||
script:
|
||||
- export CC=$CCOMPILER CXX=$CXXCOMPILER
|
||||
- git rev-parse --verify HEAD
|
||||
- m4 --version
|
||||
- autoconf --version
|
||||
- automake --version
|
||||
- make --version
|
||||
- $CC --version
|
||||
- $CXX --version
|
||||
- time bash autogen.sh
|
||||
|
|
|
@ -18,6 +18,9 @@ SUBDIRS += tools
|
|||
SUBDIRS += help
|
||||
SUBDIRS += doc
|
||||
|
||||
.PHONY: subdirs $(SUBDIRS)
|
||||
$(SUBDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
mrproper-local:
|
||||
rm -f aclocal.m4
|
||||
|
|
|
@ -76,12 +76,13 @@
|
|||
* - Dianora
|
||||
*/
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include <rb/rb.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <netdb.h>
|
||||
|
||||
typedef struct addrinfo rb_addrinfo;
|
||||
|
||||
#else
|
||||
|
|
60
configure.ac
60
configure.ac
|
@ -3,7 +3,7 @@ dnl the most major changes have already been made and it looks like
|
|||
dnl said functions need to be just about as complex as they already are.
|
||||
|
||||
AC_PREREQ(2.63)
|
||||
AUTOMAKE_OPTIONS = 1.14
|
||||
AUTOMAKE_OPTIONS = 1.11
|
||||
|
||||
AC_INIT([charybdis], [5-dev])
|
||||
AC_GNU_SOURCE
|
||||
|
@ -254,12 +254,7 @@ AC_DEFUN([RB_CHK_SYSHEADER],
|
|||
AC_DEFINE([HAVE_$2], [1], [ Indication $1 is available. ])
|
||||
RB_DEFINE_UNQUOTED([INC_$2], [$1>], [ The computed-include location of $1. ])
|
||||
], [
|
||||
AM_COND_IF([MINGW],
|
||||
[
|
||||
RB_DEFINE_UNQUOTED([INC_$2], [stdint.h>], [ The dead-header in place of $1. ])
|
||||
], [
|
||||
RB_DEFINE_UNQUOTED([INC_$2], [/dev/null>], [ The dead-header in place of $1. ])
|
||||
])
|
||||
RB_DEFINE_UNQUOTED([INC_$2], [stddef.h>], [ The dead-header in place of $1. ])
|
||||
])
|
||||
])
|
||||
|
||||
|
@ -780,7 +775,7 @@ dnl
|
|||
|
||||
AC_MSG_CHECKING([whether to use boost sources included here])
|
||||
AC_ARG_WITH(included-boost,
|
||||
AC_HELP_STRING([--with-included-boost], [Use the boost sources from included submodule]),
|
||||
AC_HELP_STRING([--with-included-boost[[[=shared]]]], [Use the boost sources from included submodule]),
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_NOTICE([Bootstrapping boost])
|
||||
|
@ -798,17 +793,30 @@ AC_HELP_STRING([--with-included-boost], [Use the boost sources from included sub
|
|||
AC_MSG_ERROR([Failed to build included boost.])
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([Bootstrapping boost: done])
|
||||
|
||||
AC_SUBST(BOOST_CPPFLAGS, "-isystem $PWD/boost/include")
|
||||
|
||||
AM_COND_IF([MINGW],
|
||||
[
|
||||
AC_SUBST(BOOST_LDFLAGS, "-L$PWD/boost/stage/lib")
|
||||
boost_libdir="$PWD/boost/stage/lib"
|
||||
], [
|
||||
AC_SUBST(BOOST_LDFLAGS, "-L$PWD/boost/lib")
|
||||
boost_libdir="$PWD/boost/lib"
|
||||
])
|
||||
|
||||
AC_SUBST(BOOST_CPPFLAGS, ["-isystem $PWD/boost/include"])
|
||||
AC_SUBST(BOOST_LDFLAGS, ["-L$boost_libdir"])
|
||||
|
||||
boost_linkage="$withval"
|
||||
AC_MSG_CHECKING([whether to use shared boost])
|
||||
if [[ $withval = "shared" ]]; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BOOST_LDFLAGS += " -Wl,-rpath -Wl,$boost_libdir"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
AC_DEFINE(HAVE_LIB_BOOST_SYSTEM, 1, [Define if you have boost_system])
|
||||
AC_MSG_NOTICE([Bootstrapping boost: done])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
|
||||
AC_SEARCH_LIBS(boost_system, boost_system,
|
||||
[
|
||||
AC_DEFINE(HAVE_LIB_BOOST_SYSTEM, 1, [Define if you have boost_system])
|
||||
|
@ -818,17 +826,23 @@ AC_HELP_STRING([--with-included-boost], [Use the boost sources from included sub
|
|||
|
||||
AC_SUBST(BOOST_CPPFLAGS, "")
|
||||
AC_SUBST(BOOST_LDFLAGS, "")
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
AM_COND_IF([MINGW],
|
||||
[
|
||||
dnl TODO
|
||||
AC_SUBST(BOOST_LIBS, "-lboost_system-mgw53-1_61.dll")
|
||||
], [
|
||||
AC_SUBST(BOOST_LIBS, "-lboost_system")
|
||||
])
|
||||
|
||||
if [[ "$boost_linkage" = "shared" ]]; then
|
||||
AM_COND_IF([MINGW],
|
||||
[
|
||||
AC_SUBST(BOOST_LIBS, ["-lboost_system-mgw53-1_61.dll"])
|
||||
], [
|
||||
AC_SUBST(BOOST_LIBS, ["-lboost_system"])
|
||||
])
|
||||
else
|
||||
AM_COND_IF([MINGW],
|
||||
[
|
||||
AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_system-mgw53-1_61.dll.a"])
|
||||
], [
|
||||
AC_SUBST(BOOST_LIBS, ["$boost_libdir/libboost_system.a"])
|
||||
])
|
||||
fi
|
||||
|
||||
AC_DEFINE([HAVE_BOOST_ASIO_HPP], [1], [ boost asio. ])
|
||||
RB_DEFINE_UNQUOTED([INC_BOOST_ASIO_HPP], [boost/asio.hpp>], [ boost asio. ])
|
||||
|
|
|
@ -5,6 +5,10 @@ AM_CPPFLAGS = \
|
|||
$(LTDLINCL) \
|
||||
@BOOST_CPPFLAGS@
|
||||
|
||||
if BUILD_PCH
|
||||
AM_CPPFLAGS += -include $(top_srcdir)/include/rb/rb.pic.h
|
||||
endif
|
||||
|
||||
AM_LDFLAGS = \
|
||||
-L$(top_srcdir)/ircd \
|
||||
-L$(top_srcdir)/rb \
|
||||
|
|
|
@ -54,7 +54,7 @@ struct Client;
|
|||
extern void init_main_logfile(void);
|
||||
extern void open_logfiles(void);
|
||||
extern void close_logfiles(void);
|
||||
RB_EXTERN_C void ilog(ilogfile dest, const char *fmt, ...) AFP(2, 3);
|
||||
void ilog(ilogfile dest, const char *fmt, ...) AFP(2, 3);
|
||||
extern void idebug(const char *fmt, ...) AFP(1, 2);
|
||||
extern void inotice(const char *fmt, ...) AFP(1, 2);
|
||||
extern void iwarn(const char *fmt, ...) AFP(1, 2);
|
||||
|
|
|
@ -189,9 +189,9 @@ extern void load_all_modules(bool warn);
|
|||
extern void load_core_modules(bool);
|
||||
|
||||
extern bool unload_one_module(const char *, bool);
|
||||
RB_EXTERN_C bool load_one_module(const char *, int, bool);
|
||||
bool load_one_module(const char *, int, bool);
|
||||
extern bool load_a_module(const char *, bool, int, bool);
|
||||
RB_EXTERN_C struct module *findmodule_byname(const char *);
|
||||
struct module *findmodule_byname(const char *);
|
||||
extern void init_modules(void);
|
||||
|
||||
extern rb_dlink_list module_list;
|
||||
|
|
|
@ -63,11 +63,11 @@ extern struct TopConf *conf_cur_block;
|
|||
extern char *current_file;
|
||||
|
||||
int read_config(char *);
|
||||
RB_EXTERN_C int conf_start_block(char *, char *);
|
||||
RB_EXTERN_C int conf_end_block(struct TopConf *);
|
||||
RB_EXTERN_C int conf_call_set(struct TopConf *, char *, conf_parm_t *);
|
||||
RB_EXTERN_C void conf_report_error(const char *, ...);
|
||||
RB_EXTERN_C void conf_report_warning(const char *, ...);
|
||||
int conf_start_block(char *, char *);
|
||||
int conf_end_block(struct TopConf *);
|
||||
int conf_call_set(struct TopConf *, char *, conf_parm_t *);
|
||||
void conf_report_error(const char *, ...);
|
||||
void conf_report_warning(const char *, ...);
|
||||
void newconf_init(void);
|
||||
int add_conf_item(const char *topconf, const char *name, int type, void (*func) (void *));
|
||||
int remove_conf_item(const char *topconf, const char *name);
|
||||
|
|
|
@ -357,9 +357,9 @@ extern char *get_user_ban_reason(struct ConfItem *aconf);
|
|||
extern void get_printable_kline(struct Client *, struct ConfItem *,
|
||||
char **, char **, char **, char **);
|
||||
|
||||
RB_EXTERN_C void yyerror(const char *);
|
||||
RB_EXTERN_C int conf_yy_fatal_error(const char *);
|
||||
RB_EXTERN_C int conf_fgets(char *, int, FILE *);
|
||||
void yyerror(const char *);
|
||||
int conf_yy_fatal_error(const char *);
|
||||
int conf_fgets(char *, int, FILE *);
|
||||
|
||||
extern int valid_wild_card(const char *, const char *);
|
||||
extern void add_temp_kline(struct ConfItem *);
|
||||
|
|
|
@ -22,64 +22,4 @@
|
|||
*/
|
||||
|
||||
#include <rb/rb.h>
|
||||
#include "defaults.h" /* Needed for some reasons here -- dwr */
|
||||
|
||||
/* AIX requires this to be the first thing in the file. */
|
||||
#ifdef __GNUC__
|
||||
#undef alloca
|
||||
#define alloca __builtin_alloca
|
||||
#else
|
||||
# ifdef _MSC_VER
|
||||
# include <malloc.h>
|
||||
# define alloca _alloca
|
||||
# else
|
||||
# if HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# ifdef _AIX
|
||||
#pragma alloca
|
||||
# else
|
||||
# ifndef alloca /* predefined by HP cc +Olibcalls */
|
||||
char *alloca ();
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#else
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
|
||||
# ifdef __unused
|
||||
# undef __unused
|
||||
# endif
|
||||
# ifdef __printf
|
||||
# undef __printf
|
||||
# endif
|
||||
# ifdef __noreturn
|
||||
# undef __noreturn
|
||||
# endif
|
||||
|
||||
# define __unused __attribute__((__unused__))
|
||||
# define __printf(x) __attribute__((__format__ (__printf__, x, x + 1)))
|
||||
# define __noreturn __attribute__((__noreturn__))
|
||||
#else
|
||||
# define __unused
|
||||
# define __printf
|
||||
# define __noreturn
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef strdupa
|
||||
#define LOCAL_COPY(s) strdupa(s)
|
||||
#else
|
||||
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
|
||||
# define LOCAL_COPY(s) __extension__({ char *_s = (char *)alloca(strlen(s) + 1); strcpy(_s, s); _s; })
|
||||
#else
|
||||
# define LOCAL_COPY(s) strcpy((char *)alloca(strlen(s) + 1), s)
|
||||
#endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */
|
||||
#endif /* strdupa */
|
||||
#include "defaults.h"
|
||||
|
|
1
include/rb/.gitignore
vendored
1
include/rb/.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
config.h*
|
||||
rb.pic.h
|
||||
|
|
|
@ -7,14 +7,20 @@ AM_CXXFLAGS = -fpch-deps
|
|||
endif
|
||||
|
||||
if BUILD_PCH
|
||||
BUILT_SOURCES = rb.h.gch
|
||||
BUILT_SOURCES = rb.h.gch rb.pic.h.gch
|
||||
endif
|
||||
|
||||
rb.h.gch:
|
||||
$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -o rb.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) rb.h
|
||||
|
||||
rb.pic.h.gch:
|
||||
cp rb.h rb.pic.h
|
||||
$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) -fPIC -o rb.pic.h.gch $(DEFS) $(CPPFLAGS) $(AM_CPPFLAGS) rb.pic.h
|
||||
|
||||
clean-local:
|
||||
rm -f rb.h.gch
|
||||
rm -f rb.pic.h
|
||||
rm -f rb.pic.h.gch
|
||||
|
||||
mrproper-local:
|
||||
rm -f config.h
|
||||
|
|
|
@ -92,6 +92,41 @@ char *alloca();
|
|||
#define rb_unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
|
||||
|
||||
#ifdef __unused
|
||||
#undef __unused
|
||||
#endif
|
||||
|
||||
#ifdef __printf
|
||||
#undef __printf
|
||||
#endif
|
||||
|
||||
#ifdef __noreturn
|
||||
#undef __noreturn
|
||||
#endif
|
||||
|
||||
#define __unused __attribute__((__unused__))
|
||||
#define __printf(x) __attribute__((__format__ (__printf__, x, x + 1)))
|
||||
#define __noreturn __attribute__((__noreturn__))
|
||||
|
||||
#else
|
||||
|
||||
#ifndef __unused
|
||||
#define __unused
|
||||
#endif
|
||||
|
||||
#ifndef __printf
|
||||
#define __printf
|
||||
#endif
|
||||
|
||||
#ifndef __noreturn
|
||||
#define __noreturn
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#define rb_get_errno() do { errno = WSAGetLastError(); WSASetLastError(errno); } while(0)
|
||||
typedef SOCKET rb_platform_fd_t;
|
||||
|
@ -321,6 +356,17 @@ while(0)
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef strdupa
|
||||
#define LOCAL_COPY(s) strdupa(s)
|
||||
#else
|
||||
#if defined(__INTEL_COMPILER) || defined(__GNUC__)
|
||||
#define LOCAL_COPY(s) __extension__({ char *_s = (char *)alloca(strlen(s) + 1); strcpy(_s, s); _s; })
|
||||
#else
|
||||
#define LOCAL_COPY(s) strcpy((char *)alloca(strlen(s) + 1), s)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
7
ircd/.gitignore
vendored
7
ircd/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
ircd_parser.h
|
||||
ircd_parser.c
|
||||
ircd_lexer.c
|
||||
ircd_parser.h*
|
||||
ircd_parser.c*
|
||||
ircd_lexer.c*
|
||||
stack.hh
|
||||
|
|
|
@ -2,14 +2,19 @@ AUTOMAKE_OPTIONS = foreign
|
|||
|
||||
libircddir = @libdir@
|
||||
|
||||
AM_YFLAGS = -d # --language=c++
|
||||
AM_LFLAGS = # --c++
|
||||
# NOTE: the c++ version has a radically different API
|
||||
#AM_YFLAGS = -d --language=c++
|
||||
AM_YFLAGS = -d
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
@LTDLINCL@ \
|
||||
@BOOST_CPPFLAGS@
|
||||
|
||||
if BUILD_PCH
|
||||
AM_CPPFLAGS += -include $(top_srcdir)/include/rb/rb.pic.h
|
||||
endif
|
||||
|
||||
if MINGW
|
||||
PLATFORM_LDFLAGS = -Wl,--enable-runtime-pseudo-reloc -export-symbols-regex '*'
|
||||
endif
|
||||
|
@ -24,8 +29,7 @@ AM_LDFLAGS += \
|
|||
-L$(top_srcdir)/rb \
|
||||
@BOOST_LDFLAGS@
|
||||
|
||||
BUILT_SOURCES = ircd_parser.h
|
||||
|
||||
BUILT_SOURCES = ircd_lexer.cc ircd_parser.cc
|
||||
|
||||
libircd_LTLIBRARIES = libircd.la
|
||||
|
||||
|
@ -50,8 +54,8 @@ libircd_la_SOURCES = \
|
|||
hook.cc \
|
||||
hostmask.cc \
|
||||
ircd.cc \
|
||||
ircd_parser.y \
|
||||
ircd_lexer.l \
|
||||
ircd_lexer.cc \
|
||||
ircd_parser.cc \
|
||||
ircd_signal.cc \
|
||||
listener.cc \
|
||||
logger.cc \
|
||||
|
@ -82,11 +86,17 @@ libircd_la_SOURCES = \
|
|||
whowas.cc \
|
||||
wsproc.cc
|
||||
|
||||
ircd_lexer.cc:
|
||||
flex $(AM_LFLAGS) -o ircd_lexer.cc ircd_lexer.ll
|
||||
|
||||
ircd_parser.cc:
|
||||
$(YACC) $(AM_YFLAGS) -o ircd_parser.cc ircd_parser.yy
|
||||
|
||||
install-data-local:
|
||||
test -d $(prefix)/@logdir@ || mkdir -p $(prefix)/@logdir@
|
||||
|
||||
clean-local:
|
||||
rm -f ircd_lexer.c
|
||||
rm -f ircd_parser.c
|
||||
rm -f ircd_parser.h
|
||||
rm -f ircd_lexer.c ircd_lexer.cc
|
||||
rm -f ircd_parser.c ircd_parser.cc
|
||||
rm -f ircd_parser.h ircd_parser.hh
|
||||
rm -f stack.hh
|
||||
|
|
|
@ -30,9 +30,8 @@
|
|||
#include <ircd/newconf.h>
|
||||
#include <ircd/s_conf.h>
|
||||
#include <ircd/logger.h>
|
||||
#include "ircd_parser.h"
|
||||
#include "ircd_parser.hh"
|
||||
|
||||
int yyparse(void);
|
||||
void yyerror(const char *);
|
||||
|
||||
YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
|
||||
|
@ -144,11 +143,11 @@ int c;
|
|||
/* log(L_NOTICE, "got comment"); */
|
||||
while (1)
|
||||
{
|
||||
while ((c = input()) != '*' && c != EOF)
|
||||
while ((c = yyinput()) != '*' && c != EOF)
|
||||
if (c == '\n') ++lineno;
|
||||
if (c == '*')
|
||||
{
|
||||
while ((c = input()) == '*');
|
||||
while ((c = yyinput()) == '*');
|
||||
if (c == '/')
|
||||
break;
|
||||
if (c == '\n') ++lineno;
|
|
@ -11,7 +11,6 @@
|
|||
#include <ircd/newconf.h>
|
||||
#include <ircd/s_conf.h>
|
||||
#include <ircd/logger.h>
|
||||
#include "ircd_parser.h"
|
||||
|
||||
int yylex();
|
||||
void yyerror(const char *);
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
struct config_server_hide ConfigServerHide;
|
||||
|
||||
RB_EXTERN_C int yyparse(void);
|
||||
int yyparse(void);
|
||||
extern char yy_linebuf[16384]; /* defined in ircd_lexer.l */
|
||||
|
||||
static rb_bh *confitem_heap = NULL;
|
||||
|
|
|
@ -6,6 +6,10 @@ AM_CPPFLAGS = \
|
|||
$(LTDLINCL) \
|
||||
@BOOST_CPPFLAGS@
|
||||
|
||||
if BUILD_PCH
|
||||
AM_CPPFLAGS += -include $(top_srcdir)/include/rb/rb.pic.h
|
||||
endif
|
||||
|
||||
AM_LDFLAGS = \
|
||||
-L$(top_srcdir)/ircd \
|
||||
-L$(top_srcdir)/rb \
|
||||
|
|
Loading…
Reference in a new issue