summaryrefslogtreecommitdiff
path: root/ext/ncurses
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ncurses')
-rw-r--r--ext/ncurses/config.m45
-rw-r--r--ext/ncurses/ncurses_functions.c15
2 files changed, 20 insertions, 0 deletions
diff --git a/ext/ncurses/config.m4 b/ext/ncurses/config.m4
index 8111d02f44..7153888324 100644
--- a/ext/ncurses/config.m4
+++ b/ext/ncurses/config.m4
@@ -40,5 +40,10 @@ if test "$PHP_NCURSES" != "no"; then
PHP_SUBST(NCURSES_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $NCURSES_DIR/lib, SAPRFC_SHARED_LIBADD)
+ AC_CHECK_LIB(ncurses, color_set, [AC_DEFINE(HAVE_NCURSES_COLOR_SET, 1, [ ])])
+ AC_CHECK_LIB(ncurses, slk_color, [AC_DEFINE(HAVE_NCURSES_SLK_COLOR, 1, [ ])])
+ AC_CHECK_LIB(ncurses, use_extended_names, [AC_DEFINE(HAVE_NCURSES_USE_EXTENDED_NAMES, 1, [ ])])
+
+
PHP_EXTENSION(ncurses, $ext_shared)
fi
diff --git a/ext/ncurses/ncurses_functions.c b/ext/ncurses/ncurses_functions.c
index dca635a74b..99cfc81b71 100644
--- a/ext/ncurses/ncurses_functions.c
+++ b/ext/ncurses/ncurses_functions.c
@@ -44,6 +44,7 @@ PHP_FUNCTION(ncurses_addch)
*/
PHP_FUNCTION(ncurses_color_set)
{
+#ifdef HAVE_NCURSES_COLOR_SET
zval **pair;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pair) == FAILURE){
WRONG_PARAM_COUNT;
@@ -52,6 +53,10 @@ PHP_FUNCTION(ncurses_color_set)
convert_to_long_ex(pair);
RETURN_LONG(color_set(_INT(pair),NULL));
+#else
+ php_error(E_WARNING,"%s not supported in this build");
+ RETURN_FALSE;
+#endif
}
/* }}} */
@@ -772,6 +777,7 @@ PHP_FUNCTION(ncurses_slk_attrset)
*/
PHP_FUNCTION(ncurses_slk_color)
{
+#ifdef HAVE_NCURSES_SLK_COLOR
zval **intarg;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
WRONG_PARAM_COUNT;
@@ -780,6 +786,10 @@ PHP_FUNCTION(ncurses_slk_color)
convert_to_long_ex(intarg);
RETURN_LONG(slk_color(_INT(intarg)));
+#else
+ php_error(E_WARNING,"%s not supported in this build");
+ RETURN_FALSE;
+#endif
}
/* }}} */
@@ -847,6 +857,7 @@ PHP_FUNCTION(ncurses_vidattr)
*/
PHP_FUNCTION(ncurses_use_extended_names)
{
+#ifdef HAVE_NCURSES_USE_EXTENDED_NAMES
zval **intarg;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &intarg) == FAILURE){
WRONG_PARAM_COUNT;
@@ -855,6 +866,10 @@ PHP_FUNCTION(ncurses_use_extended_names)
convert_to_long_ex(intarg);
RETURN_LONG(use_extended_names(_INT(intarg)));
+#else
+ php_error(E_WARNING,"%s not supported in this build");
+ RETURN_FALSE;
+#endif
}
/* }}} */