diff configure.ac @ 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 64e28f46c695
children 2e1ad5ecb6e4
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 #######################################################################