X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=761e412535cedbef9e4ed712457d59085233440a;hp=1a710ab271339bc789b9f52de12ef9bdaef11292;hb=bca50d0d8592defee6c584fdedd25f4b1a31345b;hpb=b0bdfbb1c78346047c54d8e516a104fcff586e52 diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 1a710ab2..761e4125 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 2003-2016,2017 Free Software Foundation, Inc. * +dnl Copyright (c) 2003-2017,2018 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -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.149 2017/12/26 22:17:17 tom Exp $ +dnl $Id: aclocal.m4,v 1.155 2018/01/05 01:37:04 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -490,17 +490,61 @@ 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 CF_CHECK_CURSES_LIB version: 2 updated: 2018/01/03 04:47:33 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 +dnl $4 = optional parameter list for $3 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)]) +AC_REQUIRE([CF_PKG_CONFIG]) + +cf_have_curses_lib=no + +: ${NCURSES_CONFIG_PKG:=none} +if test "x${NCURSES_CONFIG_PKG}" = xnone; then + : +elif test "x${PKG_CONFIG:=none}" != xnone; then + AC_MSG_CHECKING(pkg-config for $1$2) + if "$PKG_CONFIG" --exists $1$2 ; then + AC_MSG_RESULT(yes) + + AC_MSG_CHECKING(if the $1$2 package files work) + + cf_save_CPPFLAGS="$CPPFLAGS" + cf_save_LIBS="$LIBS" + + CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $1$2`) + CF_ADD_LIBS(`$PKG_CONFIG --libs $1$2`) + + AC_TRY_LINK([#include <$1.h>], + [(void) $3 ( ]ifelse([$4],,,[[$4]])[ );], + [AC_TRY_RUN([#include <$1.h> + int main(void) + { (void) $3 ( ]ifelse([$4],,,[[$4]])[ ); return 0; }], + [cf_have_curses_lib=yes], + [cf_have_curses_lib=no], + [cf_have_curses_lib=maybe])], + [cf_have_curses_lib=no]) + AC_MSG_RESULT($cf_have_curses_lib) + test "$cf_have_curses_lib" = maybe && cf_have_curses_lib=yes + if test "$cf_have_curses_lib" != "yes" + then + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + else + CF_UPPER(cf_upper,have_lib$1) + AC_DEFINE_UNQUOTED($cf_upper,1) + fi + fi +fi +if test "$cf_have_curses_lib" = no; then + 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)]) +fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 @@ -557,7 +601,7 @@ done test "$cf_cv_curses_acs_map" != unknown && AC_DEFINE_UNQUOTED(CURSES_ACS_ARRAY,$cf_cv_curses_acs_map,[Define as needed to override ncurses prefix _nc_]) ]) dnl --------------------------------------------------------------------------- -dnl CF_CURSES_CHECK_DATA version: 6 updated: 2017/07/28 19:05:31 +dnl CF_CURSES_CHECK_DATA version: 7 updated: 2018/01/03 04:47:33 dnl -------------------- dnl Check if curses.h defines the given data/variable. dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG. @@ -589,7 +633,7 @@ extern char $cf_data; int main(void) { void *foo = &($cf_data); - fprintf(stderr, "testing linkage of $cf_data:%p\n", foo); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); }],[cf_result=yes ],[cf_result=no],[ @@ -598,7 +642,7 @@ int main(void) [extern char $cf_data;],[ do { void *foo = &($cf_data); - fprintf(stderr, "testing linkage of $cf_data:%p\n", foo); + fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); ${cf_cv_main_return:-return}(foo == 0); } while (0) ],[cf_result=yes],[cf_result=no]) @@ -678,7 +722,7 @@ CF_CURSES_HEADER CF_TERM_HEADER ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_FUNCS version: 18 updated: 2014/07/19 18:44:41 +dnl CF_CURSES_FUNCS version: 19 updated: 2018/01/03 04:47:33 dnl --------------- dnl Curses-functions are a little complicated, since a lot of them are macros. AC_DEFUN([CF_CURSES_FUNCS], @@ -699,9 +743,9 @@ do [ #ifndef ${cf_func} long foo = (long)(&${cf_func}); -fprintf(stderr, "testing linkage of $cf_func:%p\n", foo); -if (foo + 1234 > 5678) - ${cf_cv_main_return:-return}(foo); +fprintf(stderr, "testing linkage of $cf_func:%p\n", (void *)foo); +if (foo + 1234L > 5678L) + ${cf_cv_main_return:-return}(foo != 0); #endif ], [cf_result=yes], @@ -745,7 +789,7 @@ fi AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_LIBS version: 40 updated: 2017/09/07 17:06:24 +dnl CF_CURSES_LIBS version: 41 updated: 2017/12/31 19:23:43 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. @@ -827,7 +871,10 @@ if test ".$ac_cv_func_initscr" != .yes ; then AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[ for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown do - AC_CHECK_LIB($cf_term_lib,tgoto,[break]) + AC_CHECK_LIB($cf_term_lib,tgoto,[ + : ${cf_nculib_root:=$cf_term_lib} + break + ]) done ]) fi @@ -2057,7 +2104,7 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 18 updated: 2017/07/23 18:30:00 +dnl CF_NCURSES_CONFIG version: 20 updated: 2018/01/03 04:47:33 dnl ----------------- dnl Tie together the configure-script macros for ncurses, preferring these in dnl order: @@ -2104,8 +2151,8 @@ if test "x${PKG_CONFIG:=none}" != xnone; then else AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries]) NCURSES_CONFIG_PKG=$cf_ncuconfig_root + CF_TERM_HEADER fi - CF_TERM_HEADER else AC_MSG_RESULT(no)