X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=2ef2d46a2ff9273a075bd2e5bb042894d461fc89;hp=7c1f93100aa256594cb879359e5bf834e4c3fd99;hb=ee1bcda2cbb28cd84f136d8343cf83b7e576bd79;hpb=0819b56c3096ed77dd36312b0c4e8f37e7d46c88 diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 7c1f9310..2ef2d46a 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -26,7 +26,7 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl $Id: aclocal.m4,v 1.107 2015/04/18 13:06:59 tom Exp $ +dnl $Id: aclocal.m4,v 1.112 2015/04/26 00:54:24 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -434,6 +434,19 @@ AC_TRY_LINK([#include ],[printf("Hello world");],, fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CURSES_LIB version: 1 updated: 2015/04/25 20:53:11 +dnl ------------------- +dnl $1 = nominal library name, used also for header lookup +dnl $2 = suffix to append to library name +dnl $3 = function to check for using AC_CHECK_LIB +AC_DEFUN([CF_CHECK_CURSES_LIB], +[ +AC_CHECK_LIB($1$2,$3,[ +CF_UPPER(cf_upper,have_lib$1) +CF_ADD_LIBS(-l$1$2) +AC_DEFINE_UNQUOTED($cf_upper,1)]) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines @@ -639,7 +652,7 @@ if (foo + 1234 > 5678) done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_HEADER version: 4 updated: 2015/04/18 09:03:58 +dnl CF_CURSES_HEADER version: 5 updated: 2015/04/23 20:35:30 dnl ---------------- dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common dnl variations of ncurses' installs. @@ -648,11 +661,9 @@ dnl $1 = ncurses when looking for ncurses, or is empty AC_DEFUN([CF_CURSES_HEADER],[ AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[ cf_cv_ncurses_header=none -for cf_header in ifelse($1,,,[ \ - $1/ncurses.h \ - $1/curses.h]) \ - ncurses.h \ - curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) +for cf_header in \ + ncurses.h ifelse($1,,,[$1/ncurses.h]) \ + curses.h ifelse($1,,,[$1/curses.h]) ifelse($1,,[ncurses/ncurses.h ncurses/curses.h]) do AC_TRY_COMPILE([#include <${cf_header}>], [initscr(); tgoto("?", 0,0)], @@ -1899,46 +1910,86 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51 +dnl CF_NCURSES_CONFIG version: 12 updated: 2015/04/24 20:52:45 dnl ----------------- dnl Tie together the configure-script macros for ncurses. dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis. dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable. dnl dnl $1 is the root library name (default: "ncurses") -AC_DEFUN([CF_NCURSES_CONFIG], -[ +AC_DEFUN([CF_NCURSES_CONFIG],[ +AC_REQUIRE([CF_PKG_CONFIG]) cf_ncuconfig_root=ifelse($1,,ncurses,$1) +cf_have_ncuconfig=no -echo "Looking for ${cf_ncuconfig_root}-config" +if test "x$PKG_CONFIG" != xnone; then + AC_MSG_CHECKING(pkg-config for $cf_ncuconfig_root) + if "$PKG_CONFIG" --exists $cf_ncuconfig_root ; then + AC_MSG_RESULT(yes) -CF_ACVERSION_CHECK(2.52, - [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], - [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) + AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) + cf_have_ncuconfig=unknown -if test "$NCURSES_CONFIG" != none ; then + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" -CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" -CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) + CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags $cf_ncuconfig_root`" + CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) -# even with config script, some packages use no-override for curses.h -CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) + AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], + [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], + [AC_TRY_RUN([#include <${cf_cv_ncurses_header:-curses.h}> + int main(void) + { char *xx = curses_version(); return (xx == 0); }], + [cf_have_ncuconfig=yes], + [cf_have_ncuconfig=no])], + [cf_have_ncuconfig=no]) + + AC_MSG_RESULT($cf_have_ncuconfig) + if test "$cf_have_ncuconfig" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + else + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + fi -dnl like CF_NCURSES_CPPFLAGS -AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + else + AC_MSG_RESULT(no) + fi +fi -dnl like CF_NCURSES_LIBS -CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) -AC_DEFINE_UNQUOTED($cf_nculib_ROOT) +if test "x$cf_have_ncuconfig" = "xno"; then + echo "Looking for ${cf_ncuconfig_root}-config" -dnl like CF_NCURSES_VERSION -cf_cv_ncurses_version=`$NCURSES_CONFIG --version` + CF_ACVERSION_CHECK(2.52, + [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)], + [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}-config ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)]) -else + if test "$NCURSES_CONFIG" != none ; then + + CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`" + CF_ADD_LIBS(`$NCURSES_CONFIG --libs`) -CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) -CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) + # even with config script, some packages use no-override for curses.h + CF_CURSES_HEADER(ifelse($1,,ncurses,$1)) + dnl like CF_NCURSES_CPPFLAGS + AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) + + dnl like CF_NCURSES_LIBS + CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root) + AC_DEFINE_UNQUOTED($cf_nculib_ROOT) + + dnl like CF_NCURSES_VERSION + cf_cv_ncurses_version=`$NCURSES_CONFIG --version` + + else + + CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1)) + CF_NCURSES_LIBS(ifelse($1,,ncurses,$1)) + + fi fi ])dnl dnl --------------------------------------------------------------------------- @@ -3107,7 +3158,7 @@ if test "$with_dmalloc" = yes ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_NCURSES_ETC version: 3 updated: 2015/04/17 21:26:14 +dnl CF_WITH_NCURSES_ETC version: 4 updated: 2015/04/25 20:53:11 dnl ------------------- dnl Use this macro for programs which use any variant of "curses", e.g., dnl "ncurses", and "PDCurses". Programs that can use curses and some unrelated @@ -3121,6 +3172,10 @@ CF_WITH_CURSES_DIR cf_cv_screen=curses AC_MSG_CHECKING(for specified curses library type) +AC_ARG_WITH(screen, + [ --with-screen=XXX use specified curses-libraries], + [cf_cv_screen=$withval],[ + AC_ARG_WITH(ncursesw, [ --with-ncursesw use wide ncurses-libraries], [cf_cv_screen=ncursesw],[ @@ -3139,7 +3194,7 @@ AC_ARG_WITH(curses-colr, AC_ARG_WITH(curses-5lib, [ --with-curses-5lib compile/link with SunOS 5lib curses], - [cf_cv_screen=curses_5lib])])])])]) + [cf_cv_screen=curses_5lib])])])])])]) AC_MSG_RESULT($cf_cv_screen) @@ -3147,16 +3202,19 @@ case $cf_cv_screen in (curses|curses_*) CF_CURSES_CONFIG ;; -(ncurses) - CF_NCURSES_CONFIG - ;; -(ncursesw) +(ncursesw*) CF_UTF8_LIB - CF_NCURSES_CONFIG(ncursesw) + CF_NCURSES_CONFIG($cf_cv_screen) + ;; +(ncurses*) + CF_NCURSES_CONFIG($cf_cv_screen) ;; (pdcurses) CF_PDCURSES_X11 ;; +(*) + AC_MSG_ERROR(unexpected screen-value: $cf_cv_screen) + ;; esac ])dnl