From c6c1b25aef8e1c7893b90aab359664008c070c2f Mon Sep 17 00:00:00 2001 From: gagolews Date: Sat, 18 Nov 2023 11:02:34 +1100 Subject: [PATCH] #502 ongoing --- DESCRIPTION | 4 +- NEWS | 9 +++ configure | 131 ++++++++++++++++---------------------- configure.ac | 129 +++++++++++++++---------------------- src/Makevars.win | 14 ++-- src/stri_ICU_settings.cpp | 3 +- src/stri_sprintf.cpp | 2 - 7 files changed, 127 insertions(+), 165 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b8f51434..a959cd16 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: stringi -Version: 1.8.1 -Date: 2023-11-17 +Version: 1.8.1.9001 +Date: 2023-11-18 Title: Fast and Portable Character String Processing Facilities Description: A collection of character string/text/natural language processing tools for pattern searching (e.g., with 'Java'-like regular diff --git a/NEWS b/NEWS index 4ce82761..6f1cdba3 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,15 @@ # Changelog +## 1.8.2 (under development) + +* ...TODO... [BUILD TIME] [BUGFIX] #502: `PKG_CPPFLAGS` are now considered + before other `CPPFLAGS` (the same with other flag types) in + the `configure` script. + +* ...TODO... [BUILD TIME] [BUGFIX] #501: Fixed failing build on 32-bit Windows. + + ## 1.8.1 (2023-11-09) * [GENERAL] ICU bundle updated to version 74.1 (Unicode 15.1, CLDR 44). diff --git a/configure b/configure index 581f56f4..a11ddecb 100755 --- a/configure +++ b/configure @@ -2370,7 +2370,6 @@ fi -#with_extra_cflags="${with_extra_cflags} ${STRINGI_CFLAGS}" with_extra_cppflags="${with_extra_cppflags} ${STRINGI_CPPFLAGS}" with_extra_cxxflags="${with_extra_cxxflags} ${STRINGI_CXXFLAGS}" with_extra_ldflags="${with_extra_ldflags} ${STRINGI_LDFLAGS}" @@ -3451,6 +3450,7 @@ printf "%s\n" "yes" >&6; } # detected version of ICU4C is sufficient export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 # always provide system -L { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for additional CPPFLAGS, LDFLAGS, and LIBS required" >&5 printf %s "checking for additional CPPFLAGS, LDFLAGS, and LIBS required... " >&6; } + ICU_CPPFLAGS=`"${PKG_CONFIG}" --cflags icu-uc icu-i18n` ICU_LDFLAGS=`"${PKG_CONFIG}" --libs-only-L icu-uc icu-i18n` ICU_LIBS=`"${PKG_CONFIG}" --libs-only-l icu-uc icu-i18n` @@ -3462,9 +3462,10 @@ printf "%s\n" "done" >&6; } check_icu_with_pkg_config() { - CPPFLAGS="${CPPFLAGS} ${ICU_CPPFLAGS}" - LDFLAGS="${LDFLAGS} ${ICU_LDFLAGS}" - LIBS="${LIBS} ${ICU_LIBS}" + CXXFLAGS="${with_extra_cxxflags} ${R_CXXPICFLAGS} ${R_CXXFLAGS}" + CPPFLAGS="${with_extra_cppflags} ${ICU_CPPFLAGS} ${R_CPPFLAGS}" + LDFLAGS="${with_extra_ldflags} ${ICU_LDFLAGS} ${R_LDFLAGS}" + LIBS="${with_extra_libs} ${ICU_LIBS} ${R_LIBS}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether an ICU4C-based project can be built" >&5 printf %s "checking whether an ICU4C-based project can be built... " >&6; } @@ -3698,9 +3699,26 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ check_flags_icu_bundle() { - CPPFLAGS="${CPPFLAGS} -Isrc/ -Isrc/icu${ICU_BUNDLE_VERSION} -Isrc/icu${ICU_BUNDLE_VERSION}/unicode \ - -Isrc/icu${ICU_BUNDLE_VERSION}/common -Isrc/icu${ICU_BUNDLE_VERSION}/i18n -DU_STATIC_IMPLEMENTATION \ - -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -D_REENTRANT" # don't use uconfig_local yet + # files are relative to src/ now, then we'll make it the current dir + ICU_CPPFLAGS="-DU_STRINGI_PATCHES \ + -Isrc/icu${ICU_BUNDLE_VERSION} \ + -Isrc/icu${ICU_BUNDLE_VERSION}/unicode \ + -Isrc/icu${ICU_BUNDLE_VERSION}/common \ + -Isrc/icu${ICU_BUNDLE_VERSION}/i18n \ + -DU_STATIC_IMPLEMENTATION \ + -DU_COMMON_IMPLEMENTATION \ + -DU_I18N_IMPLEMENTATION \ + -D_REENTRANT \ + -DUCONFIG_USE_LOCAL" # but don't use uconfig_local yet, see below + #-DU_HIDE_DRAFT_API + #-DU_HIDE_DEPRECATED_API" + ICU_LDFLAGS="" + ICU_LIBS="" + + CXXFLAGS="${with_extra_cxxflags} ${R_CXXPICFLAGS} ${R_CXXFLAGS}" + CPPFLAGS="${with_extra_cppflags} ${ICU_CPPFLAGS} ${R_CPPFLAGS} -UUCONFIG_USE_LOCAL" # don't use uconfig_local yet + LDFLAGS="${with_extra_ldflags} ${ICU_LDFLAGS} ${R_LDFLAGS}" + LIBS="${with_extra_libs} ${ICU_LIBS} ${R_LIBS}" # NOTE: One way for dealing with the *Compiler or options invalid for pre-UNIX 03 # X/Open applications and pre-2001 POSIX applications* error on Solaris @@ -3781,11 +3799,10 @@ else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - old_with_extra_cxxflags="${with_extra_cxxflags}" - with_extra_cxxflags="${with_extra_cxxflags} -DSTRINGI_MAX_ALIGN_T_STD" - CXXFLAGS="${CXXFLAGS} ${with_extra_cxxflags}" - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether alignof(::max_align_t) is available with" >&5 -printf %s "checking whether alignof(::max_align_t) is available with... " >&6; } + + CPPFLAGS="${with_extra_cppflags} -DSTRINGI_MAX_ALIGN_T_STD ${ICU_CPPFLAGS} ${R_CPPFLAGS} -UUCONFIG_USE_LOCAL" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether alignof(::max_align_t) is available" >&5 +printf %s "checking whether alignof(::max_align_t) is available... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3814,12 +3831,12 @@ then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } + with_extra_cppflags="${with_extra_cppflags} -DSTRINGI_MAX_ALIGN_T_STD" else $as_nop { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - with_extra_cxxflags="${old_with_extra_cxxflags}" echo "*** The ICU4C bundle cannot be built." return 1 @@ -3846,17 +3863,11 @@ while true; do # Step 2. force_cxx11="yes" # Step 3. Fail. - #CC=`"${R_PATH}" CMD config CC` - #CPP=`"${R_PATH}" CMD config CXXCPP` - #CFLAGS_base=`"${R_PATH}" CMD config CFLAGS` - #CFLAGS_pic=`"${R_PATH}" CMD config CPICFLAGS` - #CFLAGS="${CFLAGS_base} ${CFLAGS_pic}" - - CPPFLAGS=`"${R_PATH}" CMD config CPPFLAGS` - LD=`"${R_PATH}" CMD config SHLIB_CXXLD` - LIBS= - LDFLAGS= + + R_CPPFLAGS=`"${R_PATH}" CMD config CPPFLAGS` + R_LIBS= + R_LDFLAGS= if test $force_cxx11 = "no"; then @@ -3864,9 +3875,8 @@ while true; do CXX=`"${R_PATH}" CMD config CXX` - CXXFLAGS_base=`"${R_PATH}" CMD config CXXFLAGS` - CXXFLAGS_pic=`"${R_PATH}" CMD config CXXPICFLAGS` - CXXFLAGS="${CXXFLAGS_base} ${CXXFLAGS_pic}" + R_CXXFLAGS=`"${R_PATH}" CMD config CXXFLAGS` + R_CXXPICFLAGS=`"${R_PATH}" CMD config CXXPICFLAGS` else STRINGI_CXXSTD="CXX_STD=CXX11" @@ -3874,17 +3884,15 @@ while true; do CXX_tmp2=`"${R_PATH}" CMD config CXX11STD` CXX="${CXX_tmp1} ${CXX_tmp2}" - CXXFLAGS_base=`"${R_PATH}" CMD config CXX11FLAGS` - CXXFLAGS_pic=`"${R_PATH}" CMD config CXX11PICFLAGS` - CXXFLAGS="${CXXFLAGS_base} ${CXXFLAGS_pic}" + R_CXXFLAGS=`"${R_PATH}" CMD config CXX11FLAGS` + R_CXXPICFLAGS=`"${R_PATH}" CMD config CXX11PICFLAGS` fi - #CFLAGS="${CFLAGS} ${with_extra_cflags}" - CXXFLAGS="${CXXFLAGS} ${with_extra_cxxflags}" - CPPFLAGS="${CPPFLAGS} ${with_extra_cppflags}" - LDFLAGS="${LDFLAGS} ${with_extra_ldflags}" - LIBS="${LIBS} ${with_extra_libs}" + CXXFLAGS="${with_extra_cxxflags} ${R_CXXFLAGS}" + CPPFLAGS="${with_extra_cppflags} ${R_CPPFLAGS}" + LDFLAGS="${with_extra_ldflags} ${R_LDFLAGS}" + LIBS="${with_extra_libs} ${R_LIBS}" if ! check_cpp; then if test $force_cxx11 = "no"; then @@ -3903,9 +3911,6 @@ while true; do # Use of pkg-config disabled, nothing to do echo "*** System ICU4C has been disabled." else - OLD_CPPFLAGS=$CPPFLAGS - OLD_LDFLAGS=$LDFLAGS - OLD_LIBS=$LIBS if ! detect_icu_with_pkg_config; then echo "*** Trying with 'standard' fallback flags" # (#238, #220) trying "standard" fallback flags @@ -3916,9 +3921,6 @@ while true; do if check_icu_with_pkg_config; then ICU_FOUND=1 # success fi - CPPFLAGS=$OLD_CPPFLAGS - LDFLAGS=$OLD_LDFLAGS - LIBS=$OLD_LIBS fi @@ -3943,17 +3945,9 @@ while true; do echo "*** Using the ICU ${ICU_BUNDLE_VERSION} bundle that comes with 'stringi'." ICU_BUNDLE_OK=0 - #OLD_CFLAGS=$CFLAGS - OLD_CXXFLAGS=$CXXFLAGS - OLD_CPPFLAGS=$CPPFLAGS - OLD_LIBS=$LIBS if check_flags_icu_bundle; then ICU_BUNDLE_OK=1 # success fi - #CFLAGS=$OLD_CFLAGS - CXXFLAGS=$OLD_CXXFLAGS - CPPFLAGS=$OLD_CPPFLAGS - if test $ICU_BUNDLE_OK = 1; then break # all set! @@ -4016,7 +4010,7 @@ if test $ICU_FOUND = 0; then # There are systems with no internet access { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the ICU data library is available" >&5 printf %s "checking whether the ICU data library is available... " >&6; } - "${R_PATH}" --vanilla --slave -e "setwd(\"src/\"); \ + "${R_PATH}" --vanilla -s -e "setwd(\"src/\"); \ source(\"../R/install.R\"); \ if (identical(FALSE,stri_download_icudt(\"${ICUDT_DIR}\",${ICU_BUNDLE_VERSION}))) \ stop(\"Stopping on error\")" @@ -4061,34 +4055,18 @@ if test $ICU_FOUND = 0; then # build ICU4C from sources STRINGI_OBJECTS="\$(STRI_OBJECTS) \$(ICU_COMMON_OBJECTS) \ \$(ICU_I18N_OBJECTS) \$(ICU_STUBDATA_OBJECTS)" - #STRINGI_CFLAGS="" - STRINGI_CPPFLAGS="-I. -Iicu${ICU_BUNDLE_VERSION} \ - -DU_STRINGI_PATCHES \ - -Iicu${ICU_BUNDLE_VERSION}/unicode -Iicu${ICU_BUNDLE_VERSION}/common \ - -Iicu${ICU_BUNDLE_VERSION}/i18n -DU_STATIC_IMPLEMENTATION \ - -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL" - #-DU_HIDE_DRAFT_API -DU_HIDE_DEPRECATED_API" - STRINGI_CXXFLAGS="" - STRINGI_LDFLAGS="" - STRINGI_LIBS="" + + # replace all occurrences of -Isrc/* with -I* in ICU_CPPFLAGS via a rich man's 'sed' ;) + ICU_CPPFLAGS=`"${R_PATH}" --vanilla -s -e "cat(gsub('-Isrc/', '-I', '${ICU_CPPFLAGS}', fixed=TRUE))"` else # use system ICU4C STRINGI_OBJECTS="\$(STRI_OBJECTS)" - #STRINGI_CFLAGS="" - STRINGI_CPPFLAGS="-I. ${ICU_CPPFLAGS}" - STRINGI_CXXFLAGS="" - STRINGI_LDFLAGS="${ICU_LDFLAGS}" - STRINGI_LIBS="${ICU_LIBS}" fi -#with_extra_cflags="${with_extra_cflags} ${CFLAGS_pic}" -with_extra_cxxflags="${with_extra_cxxflags} ${CXXFLAGS_pic}" - -#STRINGI_CFLAGS="${STRINGI_CFLAGS} ${with_extra_cflags}" -STRINGI_CPPFLAGS="${STRINGI_CPPFLAGS} ${with_extra_cppflags}" -STRINGI_CXXFLAGS="${STRINGI_CXXFLAGS} ${with_extra_cxxflags}" -STRINGI_LDFLAGS="${STRINGI_LDFLAGS} ${with_extra_ldflags}" -STRINGI_LIBS="${STRINGI_LIBS} ${with_extra_libs}" +STRINGI_CXXFLAGS="${with_extra_cxxflags} ${R_CXXPICFLAGS}" +STRINGI_CPPFLAGS="-I. ${with_extra_cppflags} ${ICU_CPPFLAGS}" +STRINGI_LDFLAGS="${with_extra_ldflags} ${ICU_LDFLAGS}" +STRINGI_LIBS="${with_extra_libs} ${ICU_LIBS}" @@ -5272,7 +5250,6 @@ if test $ICU_FOUND = 0; then echo " ICUDT_ENDIANNESS=${ICUDT_ENDIANNESS}" fi echo " STRINGI_CXXSTD=${STRINGI_CXXSTD}" -#echo " STRINGI_CFLAGS=${STRINGI_CFLAGS}" echo " STRINGI_CXXFLAGS=${STRINGI_CXXFLAGS}" echo " STRINGI_CPPFLAGS=${STRINGI_CPPFLAGS}" echo " STRINGI_LDFLAGS=${STRINGI_LDFLAGS}" @@ -5283,10 +5260,10 @@ echo "*** Compiler settings used:" #echo " CPP=${CPP}" #echo " CFLAGS=${CFLAGS}" echo " CXX=${CXX}" -echo " CXXFLAGS=${CXXFLAGS}" -echo " CPPFLAGS=${CPPFLAGS}" echo " LD=${LD}" -echo " LDFLAGS=${LDFLAGS}" -echo " LIBS=${LIBS}" +echo " CXXFLAGS=${R_CXXFLAGS}" +echo " CPPFLAGS=${R_CPPFLAGS}" +echo " LDFLAGS=${R_LDFLAGS}" +echo " LIBS=${R_LIBS}" echo "" diff --git a/configure.ac b/configure.ac index 0b6f5201..e04547c0 100644 --- a/configure.ac +++ b/configure.ac @@ -178,7 +178,6 @@ AC_ARG_VAR([STRINGI_LIBS], [Additional libraries to link against; see also --with-extra-libs.]) -#with_extra_cflags="${with_extra_cflags} ${STRINGI_CFLAGS}" with_extra_cppflags="${with_extra_cppflags} ${STRINGI_CPPFLAGS}" with_extra_cxxflags="${with_extra_cxxflags} ${STRINGI_CXXFLAGS}" with_extra_ldflags="${with_extra_ldflags} ${STRINGI_LDFLAGS}" @@ -392,6 +391,7 @@ detect_icu_with_pkg_config() { export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 # always provide system -L AC_MSG_CHECKING([for additional CPPFLAGS, LDFLAGS, and LIBS required]) + ICU_CPPFLAGS=`"${PKG_CONFIG}" --cflags icu-uc icu-i18n` ICU_LDFLAGS=`"${PKG_CONFIG}" --libs-only-L icu-uc icu-i18n` ICU_LIBS=`"${PKG_CONFIG}" --libs-only-l icu-uc icu-i18n` @@ -402,9 +402,10 @@ detect_icu_with_pkg_config() { check_icu_with_pkg_config() { - CPPFLAGS="${CPPFLAGS} ${ICU_CPPFLAGS}" - LDFLAGS="${LDFLAGS} ${ICU_LDFLAGS}" - LIBS="${LIBS} ${ICU_LIBS}" + CXXFLAGS="${with_extra_cxxflags} ${R_CXXPICFLAGS} ${R_CXXFLAGS}" + CPPFLAGS="${with_extra_cppflags} ${ICU_CPPFLAGS} ${R_CPPFLAGS}" + LDFLAGS="${with_extra_ldflags} ${ICU_LDFLAGS} ${R_LDFLAGS}" + LIBS="${with_extra_libs} ${ICU_LIBS} ${R_LIBS}" AC_MSG_CHECKING([whether an ICU4C-based project can be built]) AC_LINK_IFELSE([AC_LANG_SOURCE([ @@ -586,9 +587,26 @@ check_icu_with_pkg_config() { check_flags_icu_bundle() { - CPPFLAGS="${CPPFLAGS} -Isrc/ -Isrc/icu${ICU_BUNDLE_VERSION} -Isrc/icu${ICU_BUNDLE_VERSION}/unicode \ - -Isrc/icu${ICU_BUNDLE_VERSION}/common -Isrc/icu${ICU_BUNDLE_VERSION}/i18n -DU_STATIC_IMPLEMENTATION \ - -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -D_REENTRANT" # don't use uconfig_local yet + # files are relative to src/ now, then we'll make it the current dir + ICU_CPPFLAGS="-DU_STRINGI_PATCHES \ + -Isrc/icu${ICU_BUNDLE_VERSION} \ + -Isrc/icu${ICU_BUNDLE_VERSION}/unicode \ + -Isrc/icu${ICU_BUNDLE_VERSION}/common \ + -Isrc/icu${ICU_BUNDLE_VERSION}/i18n \ + -DU_STATIC_IMPLEMENTATION \ + -DU_COMMON_IMPLEMENTATION \ + -DU_I18N_IMPLEMENTATION \ + -D_REENTRANT \ + -DUCONFIG_USE_LOCAL" # but don't use uconfig_local yet, see below + #-DU_HIDE_DRAFT_API + #-DU_HIDE_DEPRECATED_API" + ICU_LDFLAGS="" + ICU_LIBS="" + + CXXFLAGS="${with_extra_cxxflags} ${R_CXXPICFLAGS} ${R_CXXFLAGS}" + CPPFLAGS="${with_extra_cppflags} ${ICU_CPPFLAGS} ${R_CPPFLAGS} -UUCONFIG_USE_LOCAL" # don't use uconfig_local yet + LDFLAGS="${with_extra_ldflags} ${ICU_LDFLAGS} ${R_LDFLAGS}" + LIBS="${with_extra_libs} ${ICU_LIBS} ${R_LIBS}" # NOTE: One way for dealing with the *Compiler or options invalid for pre-UNIX 03 # X/Open applications and pre-2001 POSIX applications* error on Solaris @@ -635,10 +653,9 @@ check_flags_icu_bundle() { AC_MSG_RESULT([yes]) ],[ AC_MSG_RESULT([no]) - old_with_extra_cxxflags="${with_extra_cxxflags}" - with_extra_cxxflags="${with_extra_cxxflags} -DSTRINGI_MAX_ALIGN_T_STD" - CXXFLAGS="${CXXFLAGS} ${with_extra_cxxflags}" - AC_MSG_CHECKING([whether alignof(::max_align_t) is available with]) + + CPPFLAGS="${with_extra_cppflags} -DSTRINGI_MAX_ALIGN_T_STD ${ICU_CPPFLAGS} ${R_CPPFLAGS} -UUCONFIG_USE_LOCAL" + AC_MSG_CHECKING([whether alignof(::max_align_t) is available]) AC_LINK_IFELSE([AC_LANG_SOURCE([ #include #include @@ -661,9 +678,9 @@ check_flags_icu_bundle() { ])], [ AC_MSG_RESULT([yes]) + with_extra_cppflags="${with_extra_cppflags} -DSTRINGI_MAX_ALIGN_T_STD" ],[ AC_MSG_RESULT([no]) - with_extra_cxxflags="${old_with_extra_cxxflags}" echo "*** The ICU4C bundle cannot be built." return 1 ]) @@ -684,17 +701,11 @@ while true; do # Step 2. force_cxx11="yes" # Step 3. Fail. - #CC=`"${R_PATH}" CMD config CC` - #CPP=`"${R_PATH}" CMD config CXXCPP` - #CFLAGS_base=`"${R_PATH}" CMD config CFLAGS` - #CFLAGS_pic=`"${R_PATH}" CMD config CPICFLAGS` - #CFLAGS="${CFLAGS_base} ${CFLAGS_pic}" - - CPPFLAGS=`"${R_PATH}" CMD config CPPFLAGS` - LD=`"${R_PATH}" CMD config SHLIB_CXXLD` - LIBS= - LDFLAGS= + + R_CPPFLAGS=`"${R_PATH}" CMD config CPPFLAGS` + R_LIBS= + R_LDFLAGS= if test $force_cxx11 = "no"; then @@ -702,9 +713,8 @@ while true; do CXX=`"${R_PATH}" CMD config CXX` - CXXFLAGS_base=`"${R_PATH}" CMD config CXXFLAGS` - CXXFLAGS_pic=`"${R_PATH}" CMD config CXXPICFLAGS` - CXXFLAGS="${CXXFLAGS_base} ${CXXFLAGS_pic}" + R_CXXFLAGS=`"${R_PATH}" CMD config CXXFLAGS` + R_CXXPICFLAGS=`"${R_PATH}" CMD config CXXPICFLAGS` else STRINGI_CXXSTD="CXX_STD=CXX11" @@ -712,17 +722,15 @@ while true; do CXX_tmp2=`"${R_PATH}" CMD config CXX11STD` CXX="${CXX_tmp1} ${CXX_tmp2}" - CXXFLAGS_base=`"${R_PATH}" CMD config CXX11FLAGS` - CXXFLAGS_pic=`"${R_PATH}" CMD config CXX11PICFLAGS` - CXXFLAGS="${CXXFLAGS_base} ${CXXFLAGS_pic}" + R_CXXFLAGS=`"${R_PATH}" CMD config CXX11FLAGS` + R_CXXPICFLAGS=`"${R_PATH}" CMD config CXX11PICFLAGS` fi - #CFLAGS="${CFLAGS} ${with_extra_cflags}" - CXXFLAGS="${CXXFLAGS} ${with_extra_cxxflags}" - CPPFLAGS="${CPPFLAGS} ${with_extra_cppflags}" - LDFLAGS="${LDFLAGS} ${with_extra_ldflags}" - LIBS="${LIBS} ${with_extra_libs}" + CXXFLAGS="${with_extra_cxxflags} ${R_CXXFLAGS}" + CPPFLAGS="${with_extra_cppflags} ${R_CPPFLAGS}" + LDFLAGS="${with_extra_ldflags} ${R_LDFLAGS}" + LIBS="${with_extra_libs} ${R_LIBS}" if ! check_cpp; then if test $force_cxx11 = "no"; then @@ -741,9 +749,6 @@ while true; do # Use of pkg-config disabled, nothing to do echo "*** System ICU4C has been disabled." else - OLD_CPPFLAGS=$CPPFLAGS - OLD_LDFLAGS=$LDFLAGS - OLD_LIBS=$LIBS if ! detect_icu_with_pkg_config; then echo "*** Trying with 'standard' fallback flags" # (#238, #220) trying "standard" fallback flags @@ -754,9 +759,6 @@ while true; do if check_icu_with_pkg_config; then ICU_FOUND=1 # success fi - CPPFLAGS=$OLD_CPPFLAGS - LDFLAGS=$OLD_LDFLAGS - LIBS=$OLD_LIBS fi @@ -781,17 +783,9 @@ while true; do echo "*** Using the ICU ${ICU_BUNDLE_VERSION} bundle that comes with 'stringi'." ICU_BUNDLE_OK=0 - #OLD_CFLAGS=$CFLAGS - OLD_CXXFLAGS=$CXXFLAGS - OLD_CPPFLAGS=$CPPFLAGS - OLD_LIBS=$LIBS if check_flags_icu_bundle; then ICU_BUNDLE_OK=1 # success fi - #CFLAGS=$OLD_CFLAGS - CXXFLAGS=$OLD_CXXFLAGS - CPPFLAGS=$OLD_CPPFLAGS - if test $ICU_BUNDLE_OK = 1; then break # all set! @@ -819,7 +813,7 @@ AC_CHECK_HEADER([elf.h], [ if test $ICU_FOUND = 0; then # There are systems with no internet access AC_MSG_CHECKING([whether the ICU data library is available]) - "${R_PATH}" --vanilla --slave -e "setwd(\"src/\"); \ + "${R_PATH}" --vanilla -s -e "setwd(\"src/\"); \ source(\"../R/install.R\"); \ if (identical(FALSE,stri_download_icudt(\"${ICUDT_DIR}\",${ICU_BUNDLE_VERSION}))) \ stop(\"Stopping on error\")" @@ -864,34 +858,18 @@ if test $ICU_FOUND = 0; then # build ICU4C from sources STRINGI_OBJECTS="\$(STRI_OBJECTS) \$(ICU_COMMON_OBJECTS) \ \$(ICU_I18N_OBJECTS) \$(ICU_STUBDATA_OBJECTS)" - #STRINGI_CFLAGS="" - STRINGI_CPPFLAGS="-I. -Iicu${ICU_BUNDLE_VERSION} \ - -DU_STRINGI_PATCHES \ - -Iicu${ICU_BUNDLE_VERSION}/unicode -Iicu${ICU_BUNDLE_VERSION}/common \ - -Iicu${ICU_BUNDLE_VERSION}/i18n -DU_STATIC_IMPLEMENTATION \ - -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL" - #-DU_HIDE_DRAFT_API -DU_HIDE_DEPRECATED_API" - STRINGI_CXXFLAGS="" - STRINGI_LDFLAGS="" - STRINGI_LIBS="" + + # replace all occurrences of -Isrc/* with -I* in ICU_CPPFLAGS via a rich man's 'sed' ;) + ICU_CPPFLAGS=`"${R_PATH}" --vanilla -s -e "cat(gsub('-Isrc/', '-I', '${ICU_CPPFLAGS}', fixed=TRUE))"` else # use system ICU4C STRINGI_OBJECTS="\$(STRI_OBJECTS)" - #STRINGI_CFLAGS="" - STRINGI_CPPFLAGS="-I. ${ICU_CPPFLAGS}" - STRINGI_CXXFLAGS="" - STRINGI_LDFLAGS="${ICU_LDFLAGS}" - STRINGI_LIBS="${ICU_LIBS}" fi -#with_extra_cflags="${with_extra_cflags} ${CFLAGS_pic}" -with_extra_cxxflags="${with_extra_cxxflags} ${CXXFLAGS_pic}" - -#STRINGI_CFLAGS="${STRINGI_CFLAGS} ${with_extra_cflags}" -STRINGI_CPPFLAGS="${STRINGI_CPPFLAGS} ${with_extra_cppflags}" -STRINGI_CXXFLAGS="${STRINGI_CXXFLAGS} ${with_extra_cxxflags}" -STRINGI_LDFLAGS="${STRINGI_LDFLAGS} ${with_extra_ldflags}" -STRINGI_LIBS="${STRINGI_LIBS} ${with_extra_libs}" +STRINGI_CXXFLAGS="${with_extra_cxxflags} ${R_CXXPICFLAGS}" +STRINGI_CPPFLAGS="-I. ${with_extra_cppflags} ${ICU_CPPFLAGS}" +STRINGI_LDFLAGS="${with_extra_ldflags} ${ICU_LDFLAGS}" +STRINGI_LIBS="${with_extra_libs} ${ICU_LIBS}" AC_SUBST(STRINGI_OBJECTS) AC_SUBST(STRINGI_CXXSTD) @@ -921,7 +899,6 @@ if test $ICU_FOUND = 0; then echo " ICUDT_ENDIANNESS=${ICUDT_ENDIANNESS}" fi echo " STRINGI_CXXSTD=${STRINGI_CXXSTD}" -#echo " STRINGI_CFLAGS=${STRINGI_CFLAGS}" echo " STRINGI_CXXFLAGS=${STRINGI_CXXFLAGS}" echo " STRINGI_CPPFLAGS=${STRINGI_CPPFLAGS}" echo " STRINGI_LDFLAGS=${STRINGI_LDFLAGS}" @@ -932,9 +909,9 @@ echo "*** Compiler settings used:" #echo " CPP=${CPP}" #echo " CFLAGS=${CFLAGS}" echo " CXX=${CXX}" -echo " CXXFLAGS=${CXXFLAGS}" -echo " CPPFLAGS=${CPPFLAGS}" echo " LD=${LD}" -echo " LDFLAGS=${LDFLAGS}" -echo " LIBS=${LIBS}" +echo " CXXFLAGS=${R_CXXFLAGS}" +echo " CPPFLAGS=${R_CPPFLAGS}" +echo " LDFLAGS=${R_LDFLAGS}" +echo " LIBS=${R_LIBS}" echo "" diff --git a/src/Makevars.win b/src/Makevars.win index 7febb52c..2b96d6d4 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -27,27 +27,27 @@ PKG_CPPFLAGS=-I. -Iicu74/ -Iicu74/unicode -Iicu74/common -Iicu74/i18n \ STRI_SOURCES_CPP=$(wildcard stri_*.cpp) STRI_OBJECTS=$(STRI_SOURCES_CPP:.cpp=.o) +ICU_STUBDATA_SOURCES_CPP=$(wildcard icu74/stubdata/*.cpp) +ICU_STUBDATA_OBJECTS=$(ICU_STUBDATA_SOURCES_CPP:.cpp=.o) + ICU_COMMON_SOURCES_CPP=$(wildcard icu74/common/*.cpp) ICU_COMMON_OBJECTS=$(ICU_COMMON_SOURCES_CPP:.cpp=.o) ICU_I18N_SOURCES_CPP=$(wildcard icu74/i18n/*.cpp) ICU_I18N_OBJECTS=$(ICU_I18N_SOURCES_CPP:.cpp=.o) -ICU_STUBDATA_SOURCES_CPP=$(wildcard icu74/stubdata/*.cpp) -ICU_STUBDATA_OBJECTS=$(ICU_STUBDATA_SOURCES_CPP:.cpp=.o) - OBJECTS=$(STRI_OBJECTS) .PHONY: all all: $(SHLIB) -$(SHLIB): $(OBJECTS) libicu_common.a libicu_i18n.a libicu_stubdata.a +$(SHLIB): $(OBJECTS) libicu_stubdata.a libicu_common.a libicu_i18n.a + +PKG_LIBS=-L. -licu_stubdata -licu_common -licu_i18n -PKG_LIBS=-L. -licu_common -licu_i18n -licu_stubdata +libicu_stubdata.a: $(ICU_STUBDATA_OBJECTS) libicu_common.a: $(ICU_COMMON_OBJECTS) libicu_i18n.a: $(ICU_I18N_OBJECTS) - -libicu_stubdata.a: $(ICU_STUBDATA_OBJECTS) diff --git a/src/stri_ICU_settings.cpp b/src/stri_ICU_settings.cpp index 1c38065d..c3375e98 100644 --- a/src/stri_ICU_settings.cpp +++ b/src/stri_ICU_settings.cpp @@ -64,7 +64,8 @@ * * @version 1.3.1 (Marek Gagolewski, 2019-02-06) * new retval field: ICU.UTF8 -*/ + * + */ SEXP stri_info() { STRI__ERROR_HANDLER_BEGIN(0) diff --git a/src/stri_sprintf.cpp b/src/stri_sprintf.cpp index 0cff0c57..2b3f01df 100644 --- a/src/stri_sprintf.cpp +++ b/src/stri_sprintf.cpp @@ -377,8 +377,6 @@ class StriSprintfDataProvider }; - - /** Parses and stores info on a single sprintf format (conversion) specifier * * @version 1.6.2 (Marek Gagolewski, 2021-05-24)