diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a0551298..1b7e573bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ STRING(REPLACE "\";\"" "\ " PKG_STRING ${PKG_STRING}) OPTION(DISABLE_NCURSES "Disable Ncurses interface") OPTION(ENABLE_GTK "Enable GTK interface") +OPTION(DISABLE_IRC "Disable IRC protocol") OPTION(DISABLE_NLS "Disable Native Language Support") OPTION(DISABLE_GNUTLS "Disable SSLv3/TLS connection support") OPTION(DISABLE_PLUGINS "Disable Plugins support") diff --git a/configure.in b/configure.in index 8351c8656..d603fb8dc 100644 --- a/configure.in +++ b/configure.in @@ -93,6 +93,7 @@ AC_CHECK_FUNCS([gethostbyname gethostname getsockname gettimeofday inet_ntoa mem AH_VERBATIM([PREFIX], [#undef PREFIX]) AH_VERBATIM([WEECHAT_LIBDIR], [#undef WEECHAT_LIBDIR]) AH_VERBATIM([WEECHAT_SHAREDIR], [#undef WEECHAT_SHAREDIR]) +AH_VERBATIM([PROTOCOL_IRC], [#undef PROTOCOL_IRC]) AH_VERBATIM([PLUGINS], [#undef PLUGINS]) AH_VERBATIM([PLUGIN_PERL], [#undef PLUGIN_PERL]) AH_VERBATIM([PLUGIN_PYTHON], [#undef PLUGIN_PYTHON]) @@ -110,6 +111,7 @@ AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interf AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no) AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk interface (default=no Gtk)],enable_gtk=$enableval,enable_gtk=no) AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no) +AC_ARG_ENABLE(irc, [ --disable-irc Turn off IRC protocol support (default=compiled)],enable_irc=$enableval,enable_irc=yes) AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes) AC_ARG_ENABLE(plugins, [ --disable-plugins Turn off plugins support (default=plugins enabled)],enable_plugins=$enableval,enable_plugins=yes) AC_ARG_ENABLE(perl, [ --disable-perl Turn off Perl script plugin (default=compiled if found)],enable_perl=$enableval,enable_perl=yes) @@ -125,6 +127,10 @@ AC_ARG_WITH(doc_xsl_prefix, [ --with-doc-xsl-prefix=DIR Docbook html/chunk.xsl AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=1)],debug=$withval,debug=1) not_found="" +WEECHAT_STATIC_LIBS="" +WEECHAT_STATIC_LIBS="$WEECHAT_STATIC_LIBS ../lib_weechat_gui_common.a" +WEECHAT_STATIC_LIBS="$WEECHAT_STATIC_LIBS ../../common/lib_weechat_main.a" +WEECHAT_STATIC_LIBS="$WEECHAT_STATIC_LIBS ../../protocols/lib_weechat_protocols.a" # ------------------------------------------------------------------------------ # GUI @@ -192,6 +198,15 @@ if test "x$enable_gtk" = "xyes" ; then fi fi +# ------------------------------------------------------------------------------ +# IRC +# ------------------------------------------------------------------------------ + +if test "x$enable_irc" = "xyes" ; then + WEECHAT_STATIC_LIBS="$WEECHAT_STATIC_LIBS ../../protocols/irc/lib_weechat_irc.a" + AC_DEFINE(PROTOCOL_IRC) +fi + # ------------------------------------------------------------------------------ # iconv # ------------------------------------------------------------------------------ @@ -239,7 +254,9 @@ fi PLUGINS_LIBS= -if test "x$enable_plugins" != "xyes" ; then +if test "x$enable_plugins" = "xyes" ; then + WEECHAT_STATIC_LIBS="$WEECHAT_STATIC_LIBS ../../plugins/lib_weechat_plugins.a" +else enable_plugins="no" enable_perl="no" enable_python="no" @@ -723,6 +740,8 @@ if test "$GAS"; then else AC_MSG_RESULT(no) fi + +AC_SUBST(WEECHAT_STATIC_LIBS) CFLAGS=`echo $CFLAGS | sed s/-g//g` if test "x$CFLAGS" = "x" ; then @@ -775,6 +794,7 @@ AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes") AM_CONDITIONAL(GUI_WXWIDGETS, test "$enable_wxwidgets" = "yes") AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes") AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes") +AM_CONDITIONAL(PROTOCOL_IRC, test "$enable_irc" = "yes") AM_CONDITIONAL(PLUGINS, test "$enable_plugins" = "yes") AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes") AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes") @@ -825,13 +845,13 @@ if test "x$enable_ncurses" = "xyes" ; then listgui="$listgui ncurses" fi if test "x$enable_wxwidgets" = "xyes"; then - listgui="$listgui WxWidgets" + listgui="$listgui wxwidgets" fi if test "x$enable_gtk" = "xyes" ; then - listgui="$listgui Gtk" + listgui="$listgui gtk" fi if test "x$enable_qt" = "xyes" ; then - listgui="$listgui Qt" + listgui="$listgui qt" fi if test "x$listgui" = "x" ; then @@ -840,6 +860,16 @@ if test "x$listgui" = "x" ; then *** Please enable at least ncurses, WxWidgets, Gtk or Qt.]) fi +listprotocols="" +if test "x$enable_irc" = "xyes" ; then + listprotocols="$listprotocols irc" +fi + +if test "x$listprotocols" = "x" ; then + AC_MSG_WARN([ +*** WeeChat will be built without any protocol, is that really what you want ?]) +fi + if test "x$not_found" != "x" ; then echo "" echo "Following components were asked but not found, they will not be built:" @@ -879,6 +909,7 @@ fi echo "" echo "Interfaces........................ :$listgui" +echo "Protocols......................... :$listprotocols" echo "Build with GNUtls support......... : $enable_gnutls" echo "Build with flock support.......... : $enable_flock" echo "Build with Plugin support......... : $enable_plugins" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 343ab8fc4..2b53eb7f3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -107,7 +107,11 @@ ADD_SUBDIRECTORY( common ) LIST(APPEND STATIC_LIBS weechat_main) ADD_SUBDIRECTORY( protocols ) -LIST(APPEND STATIC_LIBS weechat_irc) +LIST(APPEND STATIC_LIBS weechat_protocols) + +IF(NOT DISABLE_IRC) + LIST(APPEND STATIC_LIBS weechat_irc) +ENDIF(NOT DISABLE_IRC) IF(NOT DISABLE_PLUGINS) ADD_SUBDIRECTORY( plugins ) diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt index 667564698..53c5bb4ee 100644 --- a/src/gui/curses/CMakeLists.txt +++ b/src/gui/curses/CMakeLists.txt @@ -40,7 +40,8 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_CURSES_SRC}) -INCLUDE_DIRECTORIES(.. ../../common ../../protocols/irc ../../plugins) +INCLUDE_DIRECTORIES(.. ../../common ../../protocols ../../protocols/irc +../../plugins) TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS}) INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin) diff --git a/src/gui/curses/Makefile.am b/src/gui/curses/Makefile.am index 8188ce434..ac5290a16 100644 --- a/src/gui/curses/Makefile.am +++ b/src/gui/curses/Makefile.am @@ -18,22 +18,10 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" bin_PROGRAMS = weechat-curses -if PLUGINS -weechat_curses_LDADD = ../lib_weechat_gui_common.a \ - ../../common/lib_weechat_main.a \ - ../../protocols/irc/lib_weechat_irc.a \ - ../../plugins/lib_weechat_plugins.a \ +weechat_curses_LDADD = $(WEECHAT_STATIC_LIBS) \ $(PLUGINS_LIBS) \ $(NCURSES_LIBS) \ $(GNUTLS_LFLAGS) -else -weechat_curses_LDADD = ../lib_weechat_gui_common.a \ - ../../common/lib_weechat_main.a \ - ../../protocols/irc/lib_weechat_irc.a \ - $(PLUGINS_LIBS) \ - $(NCURSES_LIBS) \ - $(GNUTLS_LFLAGS) -endif weechat_curses_SOURCES = gui-curses-chat.c \ gui-curses-color.c \ diff --git a/src/gui/gtk/CMakeLists.txt b/src/gui/gtk/CMakeLists.txt index ac5964aee..68704769e 100644 --- a/src/gui/gtk/CMakeLists.txt +++ b/src/gui/gtk/CMakeLists.txt @@ -32,7 +32,8 @@ IF(PKG_CONFIG_FOUND) ENDIF(PKG_CONFIG_FOUND) ADD_EXECUTABLE(${EXECUTABLE} ${WEECHAT_GTK_SRC}) -INCLUDE_DIRECTORIES(.. ../../common ../../protocols/irc ../../plugins) +INCLUDE_DIRECTORIES(.. ../../common ../../protocols ../../protocols/irc +../../plugins) TARGET_LINK_LIBRARIES(${EXECUTABLE} ${STATIC_LIBS} ${EXTRA_LIBS}) INSTALL(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin) diff --git a/src/gui/gtk/Makefile.am b/src/gui/gtk/Makefile.am index a84db860c..c6968762f 100644 --- a/src/gui/gtk/Makefile.am +++ b/src/gui/gtk/Makefile.am @@ -18,22 +18,10 @@ INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(GTK_CFLAGS) bin_PROGRAMS = weechat-gtk -if PLUGINS -weechat_gtk_LDADD = ../lib_weechat_gui_common.a \ - ../../common/lib_weechat_main.a \ - ../../protocols/irc/lib_weechat_irc.a \ - ../../plugins/lib_weechat_plugins.a \ +weechat_gtk_LDADD = $(WEECHAT_STATIC_LIBS) \ $(PLUGINS_LIBS) \ $(GTK_LIBS) \ $(GNUTLS_LFLAGS) -else -weechat_gtk_LDADD = ../lib_weechat_gui_common.a \ - ../../common/lib_weechat_main.a \ - ../../protocols/irc/lib_weechat_irc.a \ - $(PLUGINS_LIBS) \ - $(GTK_LIBS) \ - $(GNUTLS_LFLAGS) -endif weechat_gtk_SOURCES = gui-gtk-chat.c \ gui-gtk-color.c \ diff --git a/src/protocols/CMakeLists.txt b/src/protocols/CMakeLists.txt index ada49f185..7d4ec7aa5 100644 --- a/src/protocols/CMakeLists.txt +++ b/src/protocols/CMakeLists.txt @@ -14,4 +14,11 @@ # along with this program. If not, see . # -ADD_SUBDIRECTORY( irc ) +SET(LIB_PROTOCOLS_SRC protocols.c protocols.h) + +INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) +ADD_LIBRARY(weechat_protocols STATIC ${LIB_PROTOCOLS_SRC}) + +IF(NOT DISABLE_IRC) + ADD_SUBDIRECTORY( irc ) +ENDIF(NOT DISABLE_IRC) diff --git a/src/protocols/Makefile.am b/src/protocols/Makefile.am index 8e8b5c2a7..185926a8b 100644 --- a/src/protocols/Makefile.am +++ b/src/protocols/Makefile.am @@ -14,4 +14,15 @@ # along with this program. If not, see . # -SUBDIRS = irc +INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" + +noinst_LIBRARIES = lib_weechat_protocols.a + +lib_weechat_protocols_a_SOURCES = protocols.c \ + protocols.h + +if PROTOCOL_IRC +irc_dir=irc +endif + +SUBDIRS = . $(irc_dir) diff --git a/src/protocols/protocols.c b/src/protocols/protocols.c new file mode 100644 index 000000000..8851bfe96 --- /dev/null +++ b/src/protocols/protocols.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2003-2007 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * 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 3 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, see . + */ + +/* protocols.c: manages WeeChat protocols (dynamic C libraries) */ + + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "../common/weechat.h" +#include "protocols.h" diff --git a/src/protocols/protocols.h b/src/protocols/protocols.h new file mode 100644 index 000000000..2b5306c9f --- /dev/null +++ b/src/protocols/protocols.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2003-2007 by FlashCode + * See README for License detail, AUTHORS for developers list. + * + * 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 3 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, see . + */ + +#ifndef __WEECHAT_PROTOCOLS_H +#define __WEECHAT_PROTOCOLS_H 1 + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +struct t_weechat_protocol +{ +}; + +#endif /* protocols.h */