From 9ccee0a31b6ee025e65502570579ecb5c6336d5f Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 3 Oct 1999 14:37:29 +0000 Subject: [PATCH] Command line argument handling works. -c server [-p port] : connects to server at startup -n : don't autoconnect to any servers git-svn-id: http://svn.irssi.org/repos/irssi/trunk@33 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- acconfig.h | 19 ++++++++++++------- configure.in | 44 ++++++++++++++++++++++++++++++++++++++------ src/common.h | 38 +++++++++----------------------------- 3 files changed, 59 insertions(+), 42 deletions(-) diff --git a/acconfig.h b/acconfig.h index e90d0d05..3ff17f52 100644 --- a/acconfig.h +++ b/acconfig.h @@ -1,17 +1,22 @@ -#undef HAVE_GTK -#undef HAVE_GNOME -#undef HAVE_GNOME_PANEL #undef SYSCONFDIR #undef PLUGINSDIR #undef PERLSCRIPTDIR -#undef GTK_10 -#undef HAVE_SOCKS_H + +#undef HAVE_GTK #undef HAVE_IMLIB -#undef MEM_DEBUG -#undef HAVE_IPV6 +#undef HAVE_GNOME +#undef HAVE_GNOME_PANEL + #undef GTK_HEBREW #undef GTK_HEBREW_RC +#undef MEM_DEBUG +#undef HAVE_IPV6 + +#undef HAVE_POPT_H +#undef HAVE_POPT_GNOME_H +#undef HAVE_SOCKS_H + #undef HAVE_NCURSES_USE_DEFAULT_COLORS #undef HAVE_CURSES_IDCOK diff --git a/configure.in b/configure.in index 7cf531e9..603b53fe 100644 --- a/configure.in +++ b/configure.in @@ -182,6 +182,38 @@ AM_CONDITIONAL(BUILD_SERVERTEST, test "x$want_servertest" = "xyes") AC_DEFINE_UNQUOTED(SYSCONFDIR, "$prefix/etc") AC_DEFINE_UNQUOTED(PLUGINSDIR, "$prefix/lib/irssi/plugins") +dnl ** +dnl ** check for popt.h +dnl ** +if test "x$popt_dir" = "x"; then + AC_CHECK_HEADER(popt.h, [ + AC_DEFINE(HAVE_POPT_H) + LIBS="-lpopt" + ]) +else + poptlib=-L$popt_dir/lib + CFLAGS="$CFLAGS -I$popt_dir/include" + LIBS="$LIBS $poptlib -lpopt" + if test -f $popt_dir/include/popt.h; then + AC_DEFINE(HAVE_POPT_H) + else + if test -f $popt_dir/include/popt-gnome.h; then + AC_DEFINE(HAVE_POPT_GNOME_H) + fi + fi +fi + +AC_CHECK_LIB(popt, poptGetContext, [ + POPT_LIBS="$poptlib -lpopt" +], [ + AC_CHECK_LIB(gnomesupport, poptGetContext, [ + POPT_LIBS="$poptlib $GNOME_LIBDIR -lgnomesupport" + ], [ + AC_ERROR(["libpropt or libgnomesupport not found"]) + ], $LIBS $poptlib $GNOME_LIBDIR -lgnomesupport) +], $LIBS $poptlib -lpopt) + + dnl ** dnl ** check for libPropList dnl ** @@ -237,8 +269,11 @@ if test "x$want_gnome" = "xyes"; then AC_DEFINE(HAVE_GTK) AC_DEFINE(HAVE_GNOME) AC_DEFINE(HAVE_IMLIB) + AC_DEFINE(HAVE_POPT_GNOME_H) GNOME_SUPPORT_CHECKS - GUI_CFLAGS="$GNOME_INCLUDEDIR" + + dnl ** needed for including popt-gnome.h + CFLAGS="$CFLAGS $GNOME_INCLUDEDIR" dnl ** dnl ** check for gnome panel applet library @@ -260,13 +295,9 @@ else want_gnome_panel="no" AC_DEFINE(HAVE_GTK) AM_PATH_GTK(1.2.0) - GUI_CFLAGS="$GTK_CFLAGS" + GUI_CFLAGS="$GTK_CFLAGS $POPT_LIBS" GUI_LIBS="$GTK_LIBS" - if test "x$gtk_config_minor_version" = "x0"; then - AC_DEFINE(GTK_10) - fi - if test "x$want_imlib" = "xyes"; then AM_PATH_GDK_IMLIB(, [define_imlib=true]) if test x$define_imlib = xtrue; then @@ -281,6 +312,7 @@ if test "x$GUI_LIBS" != "x"; then GUI_LIBS="$GUI_LIBS $HEBREW_LIBS" fi +AC_SUBST(POPT_LIBS) AC_SUBST(GUI_LIBS) AC_SUBST(GUI_CFLAGS) AM_CONDITIONAL(BUILD_GNOMEUI, test "x$GUI_LIBS" != "x") diff --git a/src/common.h b/src/common.h index d78a5562..7dfa2094 100644 --- a/src/common.h +++ b/src/common.h @@ -26,6 +26,14 @@ #include #include +#ifdef HAVE_POPT_H +#include +#else +# ifdef HAVE_POPT_GNOME_H +# include +# endif +#endif + #ifdef HAVE_UNISTD_H # include #endif @@ -60,6 +68,7 @@ typedef struct } IPADDR; +#include "irc-base/memdebug.h" #include "lib-config/irssi-config.h" #include "common-setup.h" @@ -82,33 +91,4 @@ void gui_input_remove(gint tag); guint gui_timeout_add(guint32 interval, GUITimeoutFunction function, gpointer data); void gui_timeout_remove(gint tag); -#ifdef MEM_DEBUG - -void ig_mem_profile(void); - -void ig_set_data(gchar *data); - -gpointer ig_malloc(gint size, gchar *file, gint line); -gpointer ig_malloc0(gint size, gchar *file, gint line); -gpointer ig_realloc(gpointer mem, gulong size, gchar *file, gint line); -gchar *ig_strdup(const char *str, gchar *file, gint line); -gchar *ig_strconcat(const char *str, ...); -gchar *ig_strdup_printf(const gchar *format, ...) G_GNUC_PRINTF (1, 2); -void ig_free(gpointer p); -GString *ig_string_new(gchar *str); -void ig_string_free(GString *str, gboolean freeit); - -#define g_malloc(a) ig_malloc(a, __FILE__, __LINE__) -#define g_malloc0(a) ig_malloc0(a, __FILE__, __LINE__) -#define g_realloc(a,b) ig_realloc(a, b, __FILE__, __LINE__) -#define g_strdup(a) ig_strdup(a, __FILE__, __LINE__) -#define g_strconcat ig_strconcat -#define g_strdup_printf ig_strdup_printf -#define g_strdup_vprintf ig_strdup_vprintf -#define g_free ig_free -#define g_string_new ig_string_new -#define g_string_free ig_string_free - -#endif - #endif