diff configure.ac @ 15251:85aae248c589

[gaim-migrate @ 18040] Fix bug #1618129. Add a --with-ncurses-headers option for configure. The script will also look in NCURSES_HEADERS environment variable. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 21 Dec 2006 23:57:27 +0000
parents ce2212022a6b
children 4458ed5f8c4c
line wrap: on
line diff
--- a/configure.ac	Thu Dec 21 09:32:11 2006 +0000
+++ b/configure.ac	Thu Dec 21 23:57:27 2006 +0000
@@ -370,6 +370,9 @@
 dnl #######################################################################
 GNT_LIBS=""
 GNT_CFLAGS=""
+AC_ARG_WITH(ncurses-headers, [AC_HELP_STRING([--with-ncurses-headers=DIR],
+		[compile gaim-text against the ncurses includes in DIR])],
+		[ac_ncurses_includes="$withval"], [ac_ncurses_includes=""])
 if test "x$enable_consoleui" = "xyes"; then
 	AC_CHECK_LIB(ncursesw, initscr, [GNT_LIBS="-lncursesw"], [enable_consoleui=no])
 	AC_CHECK_LIB(panelw, update_panels, [GNT_LIBS="$GNT_LIBS -lpanelw"], [enable_consoleui=no])
@@ -377,8 +380,9 @@
 	if test "x$enable_consoleui" = "xyes"; then
 		dnl # Some distros put the headers in ncursesw/, some don't
 		found_ncurses_h=no
-		for f in /usr/include/ncursesw/ncurses.h /usr/include/ncurses.h
+		for location in $ac_ncurses_includes $NCURSES_HEADERS /usr/include/ncursesw /usr/include
 		do
+			f="$location/ncurses.h"
 			AC_CHECK_HEADER($f,[
 				AC_MSG_CHECKING([if $f supports wide characters])
 				AC_TRY_COMPILE([
@@ -389,7 +393,7 @@
 					# error get_wch not found!
 					#endif
 				], [
-					dir=`dirname $f`
+					dir=location
 					if test x"$dir" != x"." ; then
 						GNT_CFLAGS="-I$dir/"
 					else
@@ -419,6 +423,13 @@
 		AC_CHECK_LIB(ncurses, initscr, [GNT_LIBS="-lncurses"], [enable_consoleui=no])
 		AC_CHECK_LIB(panel, update_panels, [GNT_LIBS="$GNT_LIBS -lpanel"], [enable_consoleui=no])
 		AC_DEFINE(NO_WIDECHAR, 1, [Define to 1 if you don't have wide-character support.])
+		if test x"$ac_ncurses_includes" != "x"; then
+			GNT_CFLAGS="-I$ac_ncurses_includes"
+		else
+			if test x"$NCURSES_HEADERS" != "x"; then
+				GNT_CFLAGS="-I$NCURSES_HEADERS"
+			fi
+		fi
 	fi
 
 	PKG_CHECK_MODULES(X11, x11,