Skip to content

Commit 850f1c2

Browse files
committed
Prefer $ocaml_cv_cc_vendor to undocumented $cc_basename
$cc_basename is an internal, undocumented feature of Autoconf. It could be wrong for compilers masquerading as other compilers, or command aliases. Prefer our own $ocaml_cv_cc_vendor. This fixes detection of features on macOS, where the basename of the default compiler is "cc" but not "clang".
1 parent fe92a34 commit 850f1c2

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

configure

+20-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+17-16
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ AS_CASE([$flexdll_source_dir,$supports_shared_libraries,$flexlink,$host],
971971

972972
mkexe_cmd_exp="$CC"
973973

974-
AS_CASE([$cc_basename,$host],
974+
AS_CASE([$ocaml_cv_cc_vendor,$host],
975975
[*,x86_64-*-darwin*],
976976
[oc_ldflags='-Wl,-no_compact_unwind';
977977
AC_DEFINE([HAS_ARCH_CODE32], [1])],
@@ -1013,10 +1013,10 @@ AS_CASE([$cc_basename,$host],
10131013
mkexedebugflag=''],
10141014
[*,x86_64-*-linux*],
10151015
AC_DEFINE([HAS_ARCH_CODE32], [1]),
1016-
[xlc*,powerpc-ibm-aix*],
1016+
[xlc-*,powerpc-ibm-aix*],
10171017
[oc_ldflags='-brtl -bexpfull'
10181018
AC_DEFINE([HAS_ARCH_CODE32], [1])],
1019-
[gcc*,powerpc-*-linux*],
1019+
[gcc-*,powerpc-*-linux*],
10201020
[oc_ldflags="-mbss-plt"])
10211021

10221022
## Program to use to install files
@@ -1177,8 +1177,8 @@ AS_IF([test x"$enable_shared" != "xno"],
11771177
[[*-*-linux*|*-*-freebsd[3-9]*|*-*-freebsd[1-9][0-9]*\
11781178
|*-*-openbsd*|*-*-netbsd*|*-*-dragonfly*|*-*-gnu*|*-*-haiku*]],
11791179
[sharedlib_cflags="-fPIC"
1180-
AS_CASE([$cc_basename,$host],
1181-
[*gcc*,powerpc-*-linux*],
1180+
AS_CASE([$ocaml_cv_cc_vendor,$host],
1181+
[gcc-*,powerpc-*-linux*],
11821182
[mkdll_flags='-shared -mbss-plt'],
11831183
[[*,i[3456]86-*]],
11841184
# Disable DT_TEXTREL warnings on Linux and BSD i386
@@ -1257,7 +1257,7 @@ AS_CASE([$enable_native_toplevel,$natdynlink],
12571257
[install_ocamlnat=false])
12581258

12591259
# Try to work around the Skylake/Kaby Lake processor bug.
1260-
AS_CASE(["$cc_basename,$host"],
1260+
AS_CASE(["$ocaml_cv_cc_vendor,$host"],
12611261
[*gcc*,x86_64-*|*gcc*,i686-*],
12621262
[OCAML_CC_HAS_FNO_TREE_VRP
12631263
AS_IF([$cc_has_fno_tree_vrp],
@@ -1418,10 +1418,10 @@ AC_DEFINE_UNQUOTED([OCAML_OS_TYPE], ["$ostype"])
14181418

14191419
AC_CHECK_TOOL([DIRECT_LD],[ld])
14201420
AS_IF([test -z "$PARTIALLD"],
1421-
[AS_CASE(["$host,$cc_basename"],
1422-
[x86_64-*-darwin*,*gcc*], [PACKLD_FLAGS=' -arch x86_64'],
1423-
[powerpc64le*-*-linux*,*gcc*], [PACKLD_FLAGS=' -m elf64lppc'],
1424-
[powerpc*-*-linux*,*gcc*],
1421+
[AS_CASE(["$host,$ocaml_cv_cc_vendor"],
1422+
[x86_64-*-darwin*,gcc-*], [PACKLD_FLAGS=' -arch x86_64'],
1423+
[powerpc64le*-*-linux*,gcc-*], [PACKLD_FLAGS=' -m elf64lppc'],
1424+
[powerpc*-*-linux*,gcc-*],
14251425
[AS_IF([$arch64],
14261426
[PACKLD_FLAGS=' -m elf64ppc'],
14271427
[PACKLD_FLAGS=' -m elf32ppclinux'])],
@@ -1430,10 +1430,11 @@ AS_IF([test -z "$PARTIALLD"],
14301430
# output filename. Don't assume that all C compilers understand GNU -ofoo
14311431
# form, so ensure that the definition includes a space at the end (which is
14321432
# achieved using the $(EMPTY) expansion trick in Makefile.config.in).
1433-
AS_IF([test x"$cc_basename" = "xcl"],
1434-
# For the Microsoft C compiler there must be no space at the end of the
1435-
# string.
1436-
[PACKLD="link -lib -nologo $machine -out:"],
1433+
AS_CASE(["$ocaml_cv_cc_vendor"],
1434+
[msvc-*],
1435+
# For the Microsoft C compiler there must be no space at the end of the
1436+
# string.
1437+
[PACKLD="link -lib -nologo $machine -out:"],
14371438
[PACKLD="$DIRECT_LD -r$PACKLD_FLAGS -o "])],
14381439
[PACKLD="$PARTIALLD -o "])
14391440

@@ -2264,8 +2265,8 @@ AS_IF([$native_compiler],
22642265
## Frame pointers
22652266

22662267
AS_IF([test x"$enable_frame_pointers" = "xyes"],
2267-
[AS_CASE(["$host,$cc_basename"],
2268-
[x86_64-*-linux*,gcc*|x86_64-*-linux*,clang*],
2268+
[AS_CASE(["$host,$ocaml_cv_cc_vendor"],
2269+
[x86_64-*-linux*,gcc-*|x86_64-*-linux*,clang-*],
22692270
[common_cflags="$common_cflags -g -fno-omit-frame-pointer"
22702271
frame_pointers=true
22712272
AC_DEFINE([WITH_FRAME_POINTERS])

0 commit comments

Comments
 (0)