From 90b8a6f489a730ada3083c57469226436f5518ac Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Tue, 5 Sep 2023 20:05:12 +0000 Subject: [lcdf-typetools] Accommodate 'nullptr' for older compilers. Code from https://github.com/kohler/lcdf-typetools/commit/6ddfef2450171f26aae5d0969930a871c88545b0 plus 'autoupdate'. git-svn-id: svn://tug.org/texlive/trunk@68180 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/lcdf-typetools/configure | 56 ++++++++++++++++++++++ Build/source/texk/lcdf-typetools/configure.ac | 68 ++++++++++++++++----------- 2 files changed, 97 insertions(+), 27 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/lcdf-typetools/configure b/Build/source/texk/lcdf-typetools/configure index eb64e47b3e5..7126ca5f191 100755 --- a/Build/source/texk/lcdf-typetools/configure +++ b/Build/source/texk/lcdf-typetools/configure @@ -19729,6 +19729,62 @@ fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nullptr" >&5 +printf %s "checking for nullptr... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + int* x = nullptr; + return !!x; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: supported" >&5 +printf "%s\n" "supported" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not supported" >&5 +printf "%s\n" "not supported" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for nullptr with -std=gnu++11" >&5 +printf %s "checking for nullptr with -std=gnu++11... " >&6; } + OLD_CXX="$CXX" + CXX="$CXX -std=gnu++11" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + int* x = nullptr; + return !!x; + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: supported" >&5 +printf "%s\n" "supported" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: not supported" >&5 +printf "%s\n" "not supported" >&6; } + as_fn_error $? "The $OLD_CXX compiler does not support the C++11 \`nullptr\` keyword." "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + + printf "%s\n" "#define WORDS_BIGENDIAN_SET 1" >>confdefs.h diff --git a/Build/source/texk/lcdf-typetools/configure.ac b/Build/source/texk/lcdf-typetools/configure.ac index 829db6ef763..d7ffee060fd 100644 --- a/Build/source/texk/lcdf-typetools/configure.ac +++ b/Build/source/texk/lcdf-typetools/configure.ac @@ -14,8 +14,8 @@ dnl dnl ********************************************************************* dnl m4_include([version.ac])[] dnl define lcdf_typetools_version -AC_INIT([LCDF typetools (TeX Live)], lcdf_typetools_version, [tex-k@tug.org]) -AC_PREREQ([2.65]) +AC_INIT([LCDF typetools (TeX Live)],[lcdf_typetools_version],[tex-k@tug.org]) +AC_PREREQ([2.71]) AC_CONFIG_SRCDIR([lcdf-typetools-src/NEWS.md]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIRS([../../m4 m4]) @@ -43,7 +43,7 @@ AC_ARG_ENABLE([adobe-code], [AS_HELP_STRING([--disable-adobe-code], [do not include Adobe code])], [], [enable_adobe_code=yes]) if test "$enable_adobe_code" = yes; then - AC_DEFINE([HAVE_ADOBE_CODE], [1], [Define to incldue Adobe code in output fonts.]) + AC_DEFINE([HAVE_ADOBE_CODE], [1], [Define to include Adobe code in output fonts.]) fi AC_CXX_TEMPLATE_OBJS @@ -55,7 +55,7 @@ dnl dnl directory searching dnl -AC_LANG_C +AC_LANG([C]) AC_HEADER_DIRENT AC_CHECK_HEADERS([fcntl.h unistd.h sys/time.h sys/wait.h]) @@ -64,19 +64,38 @@ dnl dnl and/or dnl -AC_LANG_CPLUSPLUS +AC_LANG([C++]) AC_CACHE_CHECK([whether works], ac_cv_good_new_hdr, -[AC_TRY_LINK([#include ], [ +[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ int a; int *b = new(&a) int; return 0; -], ac_cv_good_new_hdr=yes, ac_cv_good_new_hdr=no)]) +]])],[ac_cv_good_new_hdr=yes],[ac_cv_good_new_hdr=no])]) if test "$ac_cv_good_new_hdr" = yes; then AC_DEFINE([HAVE_NEW_HDR], [1], [Define if exists and works.]) fi AC_CHECK_HEADERS([new.h]) +dnl +dnl `nullptr` +dnl + +AC_MSG_CHECKING([for nullptr]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ + int* x = nullptr; + return !!x; +]])],[AC_MSG_RESULT([supported])],[AC_MSG_RESULT([not supported]) + AC_MSG_CHECKING([for nullptr with -std=gnu++11]) + OLD_CXX="$CXX" + CXX="$CXX -std=gnu++11" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ + int* x = nullptr; + return !!x; + ]])],[AC_MSG_RESULT([supported])],[AC_MSG_RESULT([not supported]) + AC_MSG_ERROR([The $OLD_CXX compiler does not support the C++11 `nullptr` keyword.])])]) + + dnl dnl endianness dnl @@ -90,43 +109,41 @@ dnl functions such as strerror, working strtod, working strnlen, strtoul, dnl time headers such as unistd.h dnl -AC_LANG_C +AC_LANG([C]) need_fixlibc=0 AC_CHECK_FUNCS([strerror], [], [need_fixlibc=1]) AC_CACHE_CHECK([for broken strtod], [ac_cv_broken_strtod], -[AC_TRY_RUN([#include +[AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include int main(int c, char **v) { char s[] = "12 "; char *endp; double d = strtod(s, &endp); return (s + 2) == endp; -}], [ac_cv_broken_strtod=yes], [ac_cv_broken_strtod=no], -[ac_cv_broken_strtod=no])]) +}]])],[ac_cv_broken_strtod=yes],[ac_cv_broken_strtod=no],[ac_cv_broken_strtod=no])]) if test "x$ac_cv_broken_strtod" = xyes; then need_fixlibc=1 AC_DEFINE([HAVE_BROKEN_STRTOD], [1], [Define if strtod is broken.]) fi -AC_LANG_CPLUSPLUS +AC_LANG([C++]) AC_CHECK_DECLS([strnlen], [], [], [#include ]) AC_CHECK_FUNCS([strnlen], [have_strnlen=1], [need_fixlibc=1]) if test "x$have_strnlen" = x1; then AC_CACHE_CHECK([for broken strnlen], [ac_cv_broken_strnlen], - [AC_TRY_RUN([#include + [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include #include int main(int c, char **v) { char s[] = "01234567891"; return strnlen(s, 10) == 10; -}], [ac_cv_broken_strnlen=yes], [ac_cv_broken_strnlen=no], -[ac_cv_broken_strnlen=no])]) +}]])],[ac_cv_broken_strnlen=yes],[ac_cv_broken_strnlen=no],[ac_cv_broken_strnlen=no])]) if test "x$ac_cv_broken_strnlen" = xyes; then need_fixlibc=1 AC_DEFINE([HAVE_BROKEN_STRNLEN], [1], [Define if strnlen is broken.]) fi fi -AC_LANG_C +AC_LANG([C]) AC_CHECK_FUNCS([ctime ftruncate mkstemp sigaction strdup strtoul vsnprintf waitpid]) AC_CHECK_FUNC([floor], [], [AC_CHECK_LIB([m], [floor])]) @@ -186,7 +203,7 @@ dnl dnl ntohs, ntohl (need them in C++ code) dnl -AC_LANG_CPLUSPLUS +AC_LANG([C++]) AC_CHECK_HEADERS(byteorder.h netinet/in.h sys/param.h) AC_MSG_CHECKING([whether ntohs and ntohl are defined]) ac_ntoh_defined=no @@ -238,7 +255,7 @@ Cannot find a definition for ntohs and/or ntohl! AC_MSG_ERROR([exiting]) fi fi -AC_LANG_C +AC_LANG([C]) AC_SEARCH_LIBS([ntohs], [-lnet -lwinsock32]) KPSE_CHECK_WIN32 @@ -250,10 +267,10 @@ dnl dnl is va_list addressable? dnl -AC_LANG_CPLUSPLUS +AC_LANG([C++]) AC_CACHE_CHECK([for addressable va_list type], ac_cv_va_list_addr, - [AC_TRY_COMPILE([#include + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include void f(va_list *) { } void g(va_list val) { @@ -264,7 +281,7 @@ void h(int a, ...) { va_start(val, a); g(val); va_end(val); -}], [h(2, 3, 4);], ac_cv_va_list_addr=yes, ac_cv_va_list_addr=no)]) +}]], [[h(2, 3, 4);]])],[ac_cv_va_list_addr=yes],[ac_cv_va_list_addr=no])]) if test "x$ac_cv_va_list_addr" = xyes; then AC_DEFINE(HAVE_ADDRESSABLE_VA_LIST, 1, [Define if the va_list type is addressable.]) fi @@ -277,13 +294,11 @@ dnl m4_include([ac/lcdf-typetools.ac]) SELECTED_SUBDIRS= -AC_FOREACH([Kpse_Prog], kpse_lcdf_typetools_progs, - [test "x$enable_[]Kpse_Prog" = xno || SELECTED_SUBDIRS="$SELECTED_SUBDIRS Kpse_Prog" +m4_foreach_w([Kpse_Prog],[kpse_lcdf_typetools_progs],[test "x$enable_[]Kpse_Prog" = xno || SELECTED_SUBDIRS="$SELECTED_SUBDIRS Kpse_Prog" ]) AC_SUBST(SELECTED_SUBDIRS) -AC_FOREACH([Kpse_Opt], kpse_otftotfm_auto_opts, - [AS_IF([test "x$enable_auto_]Kpse_Opt[" != xno], +m4_foreach_w([Kpse_Opt],[kpse_otftotfm_auto_opts],[AS_IF([test "x$enable_auto_]Kpse_Opt[" != xno], [AC_DEFINE([HAVE_AUTO_]AS_TR_CPP(Kpse_Opt), 1, [Define to run ]Kpse_Opt[ from otftotfm.])]) ]) @@ -421,7 +436,6 @@ dnl AC_SUBST([LCDF_TYPETOOLS_TREE], [lcdf-typetools-src]) AC_CONFIG_FILES([Makefile lcdf-typetools-src/Makefile]) -AC_FOREACH([Kpse_Prog], [liblcdf libefont] kpse_lcdf_typetools_progs, - [AC_CONFIG_FILES([lcdf-typetools-src/]Kpse_Prog[/Makefile])]) +m4_foreach_w([Kpse_Prog],[liblcdf libefont kpse_lcdf_typetools_progs],[AC_CONFIG_FILES([lcdf-typetools-src/]Kpse_Prog[/Makefile])]) AC_OUTPUT -- cgit v1.2.3