changeset 14428:f3645fe3da47

[gaim-migrate @ 17142] Let's find the ncurses.h we're after, without a bunch of hacking in individual files for it. This checks for some ncursesw specific stuff, and now will not build gntgaim unless we have ncursesw.h. This could be adapted to just add a define in case we want to support non ncursesw, but this is more than adequate for the time being. committer: Tailor Script <tailor@pidgin.im>
author Gary Kramlich <grim@reaperworld.com>
date Sun, 03 Sep 2006 18:44:11 +0000
parents 1e00e8245720
children 59b4751c8f1e
files configure.ac console/Makefile.am console/libgnt/gntcolors.c console/libgnt/gntmain.c console/libgnt/gntwidget.h console/libgnt/gntwm.h
diffstat 6 files changed, 50 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sun Sep 03 08:01:12 2006 +0000
+++ b/configure.ac	Sun Sep 03 18:44:11 2006 +0000
@@ -810,16 +810,61 @@
 dnl #######################################################################
 dnl # GNT Gaim
 dnl #######################################################################
-GNT_LIBS=
+GNT_LIBS=""
+GNT_CFLAGS=""
 if test "x$enable_gnt" = "xyes"; then
 	AC_CHECK_LIB(ncursesw, initscr, [GNT_LIBS="-lncursesw"], [enable_gnt=no])
 	AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"], [enable_gnt=no])
 
-	# Some distros put the headers in ncursesw/, some don't
-	AC_CHECK_HEADER(ncursesw/ncurses.h, [AC_DEFINE(HAVE_NCURSESW_INC, 1, [Define if you have the ncursesw headers in ncursesw/])])
+	LIBS_save="$LIBS"
+	LIBS="$LIBS $GNT_LIBS"
+
+	dnl # Some distros put the headers in ncursesw/, some don't
+	found_ncurses_h=no
+	for f in ncurses.h ncursesw/ncurses.h
+	do
+		AC_CHECK_HEADER($f,[
+			AC_MSG_CHECKING([if $f supports wide characters])
+			AC_TRY_COMPILE([
+				#define _XOPEN_SOURCE_EXTENDED
+				#include <$f>
+			], [
+				#ifndef get_wch
+				# error get_wch not found!
+				#endif
+			], [
+				dir=`dirname $f`
+				if test x"$dir" != x"." ; then
+					GNT_CFLAGS="-I $dir/"
+				else
+					GNT_CFLAGS=""
+				fi
+
+				found_ncurses_h=yes
+				AC_MSG_RESULT([yes])
+				break
+			], [
+				AC_MSG_RESULT([no])
+			])
+		])
+	done
+
+	LIBS="$LIBS_save"
+
+	if test x"$found_ncurses_h" = x"no" ; then
+		GNT_LIBS=""
+		GNT_CFLAGS=""
+		enable_gnt=no
+		AC_MSG_RESULT([no])
+	else
+		AC_MSG_RESULT([yes])
+	fi
 fi
+
 AC_SUBST(GNT_LIBS)
+AC_SUBST(GNT_CFLAGS)
 AM_CONDITIONAL(ENABLE_GNT, test "x$enable_gnt" = "xyes")
+
 AC_CHECK_FUNC(wcwidth, [AC_DEFINE([HAVE_WCWIDTH], [1], [Define to 1 if you have wcwidth function.])])
 
 dnl #######################################################################
--- a/console/Makefile.am	Sun Sep 03 08:01:12 2006 +0000
+++ b/console/Makefile.am	Sun Sep 03 18:44:11 2006 +0000
@@ -61,5 +61,6 @@
 	$(DEBUG_CFLAGS) \
 	$(GLIB_CFLAGS) \
 	$(DBUS_CFLAGS) \
-	$(LIBXML_CFLAGS) 
+	$(LIBXML_CFLAGS) \
+	$(GNT_CFLAGS)
 endif
--- a/console/libgnt/gntcolors.c	Sun Sep 03 08:01:12 2006 +0000
+++ b/console/libgnt/gntcolors.c	Sun Sep 03 18:44:11 2006 +0000
@@ -1,10 +1,6 @@
 #include "config.h"
 
-#ifdef HAVE_NCURSESW_INC
-#include <ncursesw/ncurses.h>
-#else
 #include <ncurses.h>
-#endif
 
 #include "gntcolors.h"
 #include "gntstyle.h"
--- a/console/libgnt/gntmain.c	Sun Sep 03 08:01:12 2006 +0000
+++ b/console/libgnt/gntmain.c	Sun Sep 03 18:44:11 2006 +0000
@@ -3,11 +3,7 @@
 
 #include "config.h"
 
-#ifdef HAVE_NCURSESW_INC
-#include <ncursesw/panel.h>
-#else
 #include <panel.h>
-#endif
 
 #include <gmodule.h>
 
--- a/console/libgnt/gntwidget.h	Sun Sep 03 08:01:12 2006 +0000
+++ b/console/libgnt/gntwidget.h	Sun Sep 03 18:44:11 2006 +0000
@@ -6,11 +6,7 @@
 #include <stdio.h>
 #include <glib.h>
 #include <glib-object.h>
-#ifdef HAVE_NCURSESW_INC
-#include <ncursesw/ncurses.h>
-#else
 #include <ncurses.h>
-#endif
 
 #define GNT_TYPE_WIDGET				(gnt_widget_get_gtype())
 #define GNT_WIDGET(obj)				(G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_WIDGET, GntWidget))
--- a/console/libgnt/gntwm.h	Sun Sep 03 08:01:12 2006 +0000
+++ b/console/libgnt/gntwm.h	Sun Sep 03 18:44:11 2006 +0000
@@ -1,10 +1,6 @@
 #include "config.h"
 
-#ifdef HAVE_NCURSESW_INC
-#include <ncursesw/panel.h>
-#else
 #include <panel.h>
-#endif
 
 #include "gntwidget.h"