X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Faclocal.m4;h=d3a395f190860e00ef44a9f170e1071b89f4b822;hp=423744872bee9f61f41390aa5340c2380c2034df;hb=18f51bcf99101e5bf4c737239c44064227f34db8;hpb=c55d387cebf1cee4757ca2c2ef4fbeae59ee4175 diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 42374487..d3a395f1 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -1,5 +1,6 @@ dnl*************************************************************************** -dnl Copyright (c) 2003-2019,2020 Free Software Foundation, Inc. * +dnl Copyright 2018-2019,2020 Thomas E. Dickey * +dnl Copyright 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 +27,7 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl $Id: aclocal.m4,v 1.172 2020/01/18 17:30:44 tom Exp $ +dnl $Id: aclocal.m4,v 1.177 2020/02/27 10:21:59 tom Exp $ dnl dnl Author: Thomas E. Dickey dnl @@ -680,7 +681,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: 7 updated: 2018/01/03 04:47:33 +dnl CF_CURSES_CHECK_DATA version: 9 updated: 2020/02/08 21:00:26 dnl -------------------- dnl Check if curses.h defines the given data/variable. dnl Use this after CF_NCURSES_CONFIG or CF_CURSES_CONFIG. @@ -693,9 +694,9 @@ for cf_data in $1 do AC_MSG_CHECKING(for data $cf_data declaration in ${cf_cv_ncurses_header:-curses.h}) -AC_TRY_COMPILE(CF__CURSES_HEAD,[ -void *foo = &($cf_data) -],[cf_result=yes +AC_TRY_COMPILE(CF__CURSES_HEAD, +CF__CURSES_DATA(foo,$cf_data) +,[cf_result=yes ],[cf_result=no]) AC_MSG_RESULT($cf_result) @@ -711,8 +712,7 @@ else extern char $cf_data; int main(void) { - void *foo = &($cf_data); - fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); + ]CF__CURSES_DATA(foo,$cf_data)[ ${cf_cv_main_return:-return}(foo == 0); }],[cf_result=yes ],[cf_result=no],[ @@ -720,8 +720,7 @@ int main(void) AC_TRY_LINK(CF__CURSES_HEAD [extern char $cf_data;],[ do { - void *foo = &($cf_data); - fprintf(stderr, "testing linkage of $cf_data:%p\n", (void *)foo); + ]CF__CURSES_DATA(foo,$cf_data)[ ${cf_cv_main_return:-return}(foo == 0); } while (0) ],[cf_result=yes],[cf_result=no]) @@ -2350,7 +2349,7 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CONFIG version: 21 updated: 2018/06/20 20:23:13 +dnl CF_NCURSES_CONFIG version: 23 updated: 2020/02/27 05:21:59 dnl ----------------- dnl Tie together the configure-script macros for ncurses, preferring these in dnl order: @@ -2372,11 +2371,47 @@ if test "x${PKG_CONFIG:=none}" != xnone; then AC_MSG_CHECKING(if the $cf_ncuconfig_root package files work) cf_have_ncuconfig=unknown + cf_save_CFLAGS="$CFLAGS" cf_save_CPPFLAGS="$CPPFLAGS" cf_save_LIBS="$LIBS" - CF_ADD_CFLAGS(`$PKG_CONFIG --cflags $cf_ncuconfig_root`) - CF_ADD_LIBS(`$PKG_CONFIG --libs $cf_ncuconfig_root`) + cf_pkg_cflags=`$PKG_CONFIG --cflags $cf_ncuconfig_root` + cf_pkg_libs=`$PKG_CONFIG --libs $cf_ncuconfig_root` + + # while -W for passing linker flags is prevalent, it is not "standard". + # At least one wrapper for c89/c99 (in Apple's xcode) has its own + # incompatible _and_ non-standard -W option which gives an error. Work + # around that pitfall. + case "x${CC}@@${cf_pkg_libs}@${cf_pkg_cflags}" in + (x*c[[89]]9@@*-W*) + CF_ADD_CFLAGS($cf_pkg_cflags) + CF_ADD_LIBS($cf_pkg_libs) + + 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_test_ncuconfig=yes], + [cf_test_ncuconfig=no], + [cf_test_ncuconfig=maybe])], + [cf_test_ncuconfig=no]) + + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + LIBS="$cf_save_LIBS" + + if test "x$cf_test_ncuconfig" != xyes; then + cf_temp=`echo "x$cf_pkg_cflags" | sed -e s/^x// -e 's/-W[[^ ]]*//g'` + cf_pkg_cflags="$cf_temp" + cf_temp=`echo "x$cf_pkg_libs" | sed -e s/^x// -e 's/-W[[^ ]]*//g'` + cf_pkg_libs="$cf_temp" + fi + ;; + esac + + CF_ADD_CFLAGS($cf_pkg_cflags) + CF_ADD_LIBS($cf_pkg_libs) AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>], [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);], @@ -4433,6 +4468,24 @@ to makefile.]) fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF__CURSES_DATA version: 2 updated: 2020/02/08 21:00:26 +dnl --------------- +dnl Attempt to make a copy of a curses data item. This is needed in the +dnl check-data configure tests when using ncurses, because the symbol may be +dnl actually a function return-value. That could happen if the linker is +dnl broken (does not resolve data-only references), or if ncurses is configured +dnl to support re-entrant code. +dnl $1 = target +dnl $2 = source +define([CF__CURSES_DATA],[ +#if defined($2) && ((defined(NCURSES_WRAPPED_VAR) && (NCURSES_VERSION_PATCH < 20200208)) || defined(NCURSES_BROKEN_LINKER) || defined(NCURSES_REENTRANT)) + const void *$1 = (const void *)($2); +#else + const void *$1 = &($2); +#endif + fprintf(stderr, "testing linkage of $2:%p\n", (const void *)$1); +])dnl +dnl --------------------------------------------------------------------------- dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49 dnl --------------- dnl Define a reusable chunk which includes and when they