diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2013-01-05 09:44:43 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2013-01-05 09:44:43 +0000 |
commit | 31abeb756e78904f1452897fdcaa8a907c2ac1c7 (patch) | |
tree | 6be4c31afebc586237aadf9054e1297097e4c326 | |
parent | fc64f176db15d7daeac02df2d97d5169899b2f68 (diff) |
XeTeX: Build fixes
git-svn-id: svn://tug.org/texlive/trunk@28735 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/c-auto.in | 7 | ||||
-rwxr-xr-x | Build/source/texk/web2c/configure | 59 | ||||
-rw-r--r-- | Build/source/texk/web2c/configure.ac | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 18 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/trans.h | 4 |
9 files changed, 96 insertions, 22 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index 6fc82569e9c..c997ce17a7b 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,7 @@ +2013-01-05 Peter Breitenlohner <peb@mppmu.mpg.de> + + * configure.ac: Check if system defines and declares strndup(). + 2013-01-04 Peter Breitenlohner <peb@mppmu.mpg.de> * texmfmp.h [XeTeX]: We must #include <zlib.h> and diff --git a/Build/source/texk/web2c/c-auto.in b/Build/source/texk/web2c/c-auto.in index 119083937fb..02a5d071205 100644 --- a/Build/source/texk/web2c/c-auto.in +++ b/Build/source/texk/web2c/c-auto.in @@ -64,6 +64,10 @@ /* Define to 1 if you have the Mac OS X Carbon framework. */ #undef HAVE_CARBON +/* Define to 1 if you have the declaration of `strndup', and to 0 if you + don't. */ +#undef HAVE_DECL_STRNDUP + /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H @@ -185,6 +189,9 @@ /* Define to 1 if you have the `strlcpy' function. */ #undef HAVE_STRLCPY +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP + /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR diff --git a/Build/source/texk/web2c/configure b/Build/source/texk/web2c/configure index 313171905cb..efde2090e4e 100755 --- a/Build/source/texk/web2c/configure +++ b/Build/source/texk/web2c/configure @@ -2882,6 +2882,52 @@ rm -f conftest.val as_fn_set_status $ac_retval } # ac_fn_c_compute_int + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -20475,7 +20521,7 @@ if test "$ac_res" != no; then : fi -for ac_func in access atoi fmax ftime gettimeofday mkdtemp setlocale strerror strlcat strlcpy +for ac_func in access atoi fmax ftime gettimeofday mkdtemp setlocale strerror strlcat strlcpy strndup do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -20487,6 +20533,17 @@ _ACEOF fi done +ac_fn_c_check_decl "$LINENO" "strndup" "ac_cv_have_decl_strndup" "$ac_includes_default" +if test "x$ac_cv_have_decl_strndup" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRNDUP $ac_have_decl +_ACEOF + for ac_header in errno.h langinfo.h locale.h sys/time.h sys/timeb.h sys/wait.h time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` diff --git a/Build/source/texk/web2c/configure.ac b/Build/source/texk/web2c/configure.ac index ba6570cc29d..574cd7e6546 100644 --- a/Build/source/texk/web2c/configure.ac +++ b/Build/source/texk/web2c/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with Autoconf to produce a configure script for Web2c. dnl -dnl Copyright (C) 2009-2012 Peter Breitenlohner <tex-live@tug.org> +dnl Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org> dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, @@ -249,7 +249,8 @@ if test $ac_cv_sizeof_int -lt 4; then fi AC_CHECK_SIZEOF([long]) AC_SEARCH_LIBS([pow], [m]) -AC_CHECK_FUNCS([access atoi fmax ftime gettimeofday mkdtemp setlocale strerror strlcat strlcpy]) +AC_CHECK_FUNCS([access atoi fmax ftime gettimeofday mkdtemp setlocale strerror strlcat strlcpy strndup]) +AC_CHECK_DECLS([strndup]) AC_CHECK_HEADERS([errno.h langinfo.h locale.h sys/time.h sys/timeb.h sys/wait.h time.h]) AC_TYPE_LONG_DOUBLE AC_TYPE_LONG_LONG_INT diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index 96cc4ff9654..af93b44e953 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,12 @@ +2013-01-05 Peter Breitenlohner <peb@mppmu.mpg.de> + + * XeTeX_ext.c: If necessary define or declare strndup(). + + * XeTeXFontMgr.cpp, XeTeXLayoutInterface.cpp: Drop definition + of M_PI here ... + * trans.h: ... and '#define M_PI' here immediately after + '#include <math.h>'. + 2013-01-04 Khaled Hosny <khaledhosny@eglug.org> Merge changes from XeTeX repository. diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp index 51297c6d4aa..3521a6b9b35 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontMgr.cpp @@ -39,12 +39,6 @@ authorization from the copyright holders. #include "XeTeXswap.h" #include "sfnt.h" -#ifdef _MSC_VER -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#endif - extern "C" { extern Fixed loadedfontdesignsize; } diff --git a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp index ce6ee2cb78b..082025232c3 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXLayoutInterface.cpp @@ -44,12 +44,6 @@ authorization from the copyright holders. #include "XeTeXFontMgr.h" #include "XeTeXswap.h" -#ifdef _MSC_VER -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif -#endif - struct XeTeXLayoutEngine_rec { XeTeXFontInst* font; diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index 2c7cd172265..68dc7b9a0a7 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -876,20 +876,24 @@ readFeatureNumber(const char* s, const char* e, int* f, int* v) return true; } -#ifdef _MSC_VER +#if !defined(HAVE_STRNDUP) +/* Inspired by the GNU C Library 2.3.6 + * Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc. + */ static char *strndup (const char *str, size_t n) { - char *ret; - size_t len = strlen (str); + const char *p = (const char *) memchr(str, 0, n); + size_t len = p ? p - str : n; /* strnlen(str, n) */ + char *ret = (char *) malloc (len + 1); - if (n < len) - len = n; - ret = (char *) malloc (len + 1); - if (!ret) + if (ret == NULL) return NULL; + ret[len] = '\0'; return (char *) memcpy (ret, str, len); } +#elif !(defined HAVE_DECL_STRNDUP && HAVE_DECL_STRNDUP) +char *strndup (const char *str, size_t n); #endif static void* diff --git a/Build/source/texk/web2c/xetexdir/trans.h b/Build/source/texk/web2c/xetexdir/trans.h index 70c575fa4b3..88facea6d63 100644 --- a/Build/source/texk/web2c/xetexdir/trans.h +++ b/Build/source/texk/web2c/xetexdir/trans.h @@ -42,6 +42,10 @@ typedef CGAffineTransform transform; #else #include <math.h> +/* apparently M_PI isn't defined by <math.h> under VC++ */ +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif typedef struct { double a; |