Skip to content

Commit

Permalink
a possible fix for #431 ::max_align_t
Browse files Browse the repository at this point in the history
  • Loading branch information
gagolews committed May 13, 2021
1 parent 8eea0c4 commit 7f5ca06
Show file tree
Hide file tree
Showing 124 changed files with 826 additions and 657 deletions.
251 changes: 170 additions & 81 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2533,6 +2533,10 @@ else
ICUDT_DIR_FORCE="no"
fi
### AUXILIARY FUNCTIONS ########################################################
disable_cxx11() {
echo "*** Trying with C++11 compiler disabled."
enable_cxx11="no"
Expand All @@ -2551,8 +2555,16 @@ disable_cxx11() {
unset ac_cv_cxx_namespaces
unset ac_cv_cxx_have_stl
unset ac_cv_objext
return 0
}
################################################################################
while true; do
# if C++11 support is enabled, we'll try it first;
# if it fails, we'll switch to C++98
Expand Down Expand Up @@ -3811,9 +3823,10 @@ fi
##### Checking whether the C++ compiler supports the long long type and STL
# Basic C++ compiler checks: are long long type and stl data structures
# available? These are absolutely needed to compile ICU>=55.
#
# If this is the case, return 0
check_cpp() {
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
Expand Down Expand Up @@ -4247,15 +4260,12 @@ fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
CPP_OK=1
return 0
} # end check_cpp()
CPP_OK=0
check_cpp
##### Checking whether the C++ compiler supports the long long type etc.
if test $CPP_OK = 0; then
if ! check_cpp; then
if test "x$enable_cxx11" = "xyes"; then
disable_cxx11
continue
Expand All @@ -4267,13 +4277,11 @@ rm -f core conftest.err conftest.$ac_objext \
##### CHECK FOR ICU4C ##########################################################
##### 1. Get settings from pkg-config or system
# Note that according to
# https://unicode-org.github.io/icu/userguide/icu/howtouseicu.html,
# icu-config is deprecated and no longer recommended for production use.
detect_icu_with_pkg_config() {
# Note that according to
# https://unicode-org.github.io/icu/userguide/icu/howtouseicu.html,
# icu-config is deprecated and no longer recommended for production use.
# Retrieve pkg-config's path
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
Expand Down Expand Up @@ -4373,6 +4381,7 @@ $as_echo "done" >&6; }
return 0
} # end detect_icu_with_pkg_config()
check_icu_with_pkg_config() {
CPPFLAGS="${CPPFLAGS} ${ICU_CPPFLAGS}"
LDFLAGS="${LDFLAGS} ${ICU_LDFLAGS}"
Expand Down Expand Up @@ -4665,43 +4674,17 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
echo "*** The available ICU4C cannot be used."
echo "${MSG_CONFIG_FAIL}"
#echo "${MSG_CONFIG_FAIL}"
return 1
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ICU_FOUND=1 # DONE
return 0
} # end check_icu_with_pkg_config()
ICU_FOUND=0
if test $ICU_FOUND = 0; then
if test $enable_pkg_config = "no"; then
# 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
ICU_CPPFLAGS=""
ICU_LDFLAGS=""
ICU_LIBS="-licui18n -licuuc -licudata"
fi
check_icu_with_pkg_config
CPPFLAGS=$OLD_CPPFLAGS
LDFLAGS=$OLD_LDFLAGS
LIBS=$OLD_LIBS
fi
fi
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 \
Expand Down Expand Up @@ -4758,13 +4741,7 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
echo "*** The ICU bundle cannot be built."
if test "x$enable_cxx11" = "xyes"; then
disable_cxx11
continue
else
echo "${MSG_CONFIG_FAIL}"
exit 1
fi
return 1
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
Expand Down Expand Up @@ -4816,13 +4793,7 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
echo "*** The ICU4C bundle cannot be built."
if test "x$enable_cxx11" = "xyes"; then
disable_cxx11
continue
else
echo "${MSG_CONFIG_FAIL}"
exit 1
fi
return 1
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
Expand Down Expand Up @@ -4854,6 +4825,7 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
old_with_extra_cxxflags="${with_extra_cxxflags}"
with_extra_cxxflags="${with_extra_cxxflags} -D_XPG6"
CXXFLAGS="${CXXFLAGS} -D_XPG6"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we may compile src/icu${ICU_BUNDLE_VERSION}/i18n/number_affixutils.cpp with -D_XPG6" >&5
Expand All @@ -4873,50 +4845,167 @@ else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
with_extra_cxxflags="${old_with_extra_cxxflags}"
echo "*** The ICU4C bundle cannot be built."
if test "x$enable_cxx11" = "xyes"; then
disable_cxx11
continue
else
echo "${MSG_CONFIG_FAIL}"
exit 1
fi
return 1
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
if test ${ICU_BUNDLE_VERSION} -ge 69; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether alignof(std::max_align_t) is available" >&5
$as_echo_n "checking whether alignof(std::max_align_t) is available... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <iostream>
#include <cstddef>
int main() {
std::cout << alignof(std::max_align_t) << std::endl;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
old_with_extra_cxxflags="${with_extra_cxxflags}"
with_extra_cxxflags="${with_extra_cxxflags} -DSTRINGI_MAX_ALIGN_T_STD"
CXXFLAGS="${CXXFLAGS} -D_XPG6"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether alignof(::max_align_t) is available" >&5
$as_echo_n "checking whether alignof(::max_align_t) is available... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <iostream>
#include <cstddef>
#ifdef __cplusplus
#include <stddef.h>
extern "C++"
{
namespace std
{
using ::max_align_t;
}
}
#endif
int main() {
std::cout << alignof(std::max_align_t) << std::endl;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
with_extra_cxxflags="${old_with_extra_cxxflags}"
echo "*** The ICU4C bundle cannot be built."
return 1
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
return 0
} # end check_flags_icu_bundle()
if test $ICU_FOUND = 0; then
if test $enable_icu_bundle = "no"; then
echo "*** Failed to configure package build with forced system ICU usage."
echo "*** Consider installing, e.g., libicu-devel (RedHat, Fedora) or libicu-dev (Debian, Ubuntu)"
echo "*** together with pkg-config."
if test "x$enable_cxx11" = "xyes"; then
disable_cxx11
continue
else
echo "${MSG_CONFIG_FAIL}"
exit 1
fi
fi
OLD_CFLAGS=$CFLAGS
OLD_CXXFLAGS=$CXXFLAGS
ICU_FOUND=0
if test $enable_pkg_config = "no"; then
# Use of pkg-config disabled, nothing to do
echo "*** System ICU4C has been disabled."
else
OLD_CPPFLAGS=$CPPFLAGS
OLD_LDFLAGS=$LDFLAGS
OLD_LIBS=$LIBS
check_flags_icu_bundle
CFLAGS=$OLD_CFLAGS
CXXFLAGS=$OLD_CXXFLAGS
if ! detect_icu_with_pkg_config; then
echo "*** Trying with 'standard' fallback flags"
# (#238, #220) trying "standard" fallback flags
ICU_CPPFLAGS=""
ICU_LDFLAGS=""
ICU_LIBS="-licui18n -licuuc -licudata"
fi
if check_icu_with_pkg_config; then
ICU_FOUND=1 # success
fi
CPPFLAGS=$OLD_CPPFLAGS
LDFLAGS=$OLD_LDFLAGS
LIBS=$OLD_LIBS
fi
if test $ICU_FOUND = 1; then
break # all set!
fi
if test $enable_icu_bundle = "no"; then
echo "*** Failed to configure package build with forced system ICU usage."
echo "*** Consider installing, e.g., libicu-devel (RedHat, Fedora) or libicu-dev (Debian, Ubuntu)"
echo "*** together with pkg-config."
if test "x$enable_cxx11" = "xyes"; then
disable_cxx11
continue
else
echo "${MSG_CONFIG_FAIL}"
exit 1
fi
fi
echo "*** Using the ICU ${ICU_BUNDLE_VERSION} bundle."
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!
fi
echo "*** Failed to configure package build with the ICU bundle usage."
if test "x$enable_cxx11" = "xyes"; then
disable_cxx11
continue
else
echo "${MSG_CONFIG_FAIL}"
exit 1
fi
break # if we reach this point, we have found an okay config
done # end while
###### DOWNLOAD ICUDT (IF NEEDED) ##############################################
Expand Down
Loading

0 comments on commit 7f5ca06

Please sign in to comment.