Skip to content

Commit f418f8f

Browse files
author
ripley
committed
tweaks for macOS' static libraries
git-svn-id: https://svn.r-project.org/R/trunk@87943 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 2135fa3 commit f418f8f

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

configure

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ gt_needs=
656656
ac_func_c_list=
657657
enable_year2038=no
658658
ac_subst_vars='LTLIBOBJS
659+
LIBS_PKGS
659660
FC_VER
660661
REC_INSTALL_OPT
661662
CC_VER
@@ -27549,7 +27550,7 @@ _ACEOF
2754927550
# flags.
2755027551
r_save_CFLAGS=$CFLAGS
2755127552
CFLAGS="$CFLAGS $r_verb"
27552-
(eval echo $as_me:27552: \"$ac_link\") >&5
27553+
(eval echo $as_me:27553: \"$ac_link\") >&5
2755327554
r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
2755427555
echo "$r_c_v_output" >&5
2755527556
CFLAGS=$r_save_CFLAGS
@@ -27627,7 +27628,7 @@ _ACEOF
2762727628
# flags.
2762827629
r_save_CFLAGS=$CFLAGS
2762927630
CFLAGS="$CFLAGS $r_cv_prog_c_v"
27630-
(eval echo $as_me:27630: \"$ac_link\") >&5
27631+
(eval echo $as_me:27631: \"$ac_link\") >&5
2763127632
r_c_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
2763227633
echo "$r_c_v_output" >&5
2763327634
CFLAGS=$r_save_CFLAGS
@@ -63978,6 +63979,18 @@ CFLAGS=${CFLAGS_KEEP}
6397863979
FFLAGS=${FFLAGS_KEEP}
6397963980
CXXFLAGS=${CXXFLAGS_KEEP}
6398063981

63982+
## allow different LIBS in etc/Makeconf
63983+
LIBS_PKGS=${LIBS}
63984+
case "${host_os}" in
63985+
darwin*)
63986+
## This will usually include -lpcre2-8 -ldeflate -lzstd -llzma all
63987+
## of which are static and not part of a binary distribution, so we
63988+
## strip them. This is macOS, so could use sed -E (which is POSIX)
63989+
LIBS_PKGS=`echo ${LIBS} | sed s/\ -lpcre2-8// | sed s/\ -ldeflate// | sed s/\ -lzstd// | sed s/\ -llzma//`
63990+
;;
63991+
esac
63992+
63993+
6398163994
cat >confcache <<\_ACEOF
6398263995
# This file is a shell script that caches the results of configure
6398363996
# tests run on this system so they can be shared between configure

configure.ac

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2928,8 +2928,8 @@ if test "${USE_NLS}" = "yes"; then
29282928
if test -n "$INTL_MACOSX_LIBS"; then
29292929
dnl This is no longer valid (if it ever was)
29302930
dnl XTRA_INTL_CPPFLAGS=-I/System/Library/Frameworks/CoreFoundation.framework/Headers
2931-
dnl On a macOS build which uses static libraries, libintk_dgettext
2932-
dnl etc are provided by libR.dylib
2931+
dnl On a macOS build which uses static libraries, libintl_dgettext
2932+
dnl etc are provided by libR.dylib.
29332933
LIBINTL_PKGS=
29342934
else
29352935
LIBINTL_PKGS=${LIBINTL}
@@ -3162,6 +3162,18 @@ CFLAGS=${CFLAGS_KEEP}
31623162
FFLAGS=${FFLAGS_KEEP}
31633163
CXXFLAGS=${CXXFLAGS_KEEP}
31643164

3165+
## allow different LIBS in etc/Makeconf
3166+
LIBS_PKGS=${LIBS}
3167+
case "${host_os}" in
3168+
darwin*)
3169+
## This will usually include -lpcre2-8 -ldeflate -lzstd -llzma all
3170+
## of which are static and not part of a binary distribution, so we
3171+
## strip them. This is macOS, so could use sed -E (which is POSIX)
3172+
LIBS_PKGS=`echo ${LIBS} | sed s/\ -lpcre2-8// | sed s/\ -ldeflate// | sed s/\ -lzstd// | sed s/\ -llzma//`
3173+
;;
3174+
esac
3175+
AC_SUBST(LIBS_PKGS)
3176+
31653177
AC_OUTPUT
31663178

31673179
## Summarize configure results.

etc/Makeconf.in

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,7 @@ LIBM = @LIBM@
9999
LIBR0 = @LIBR0@
100100
LIBR1 = @LIBR1@
101101
LIBR = @LIBR0@ @LIBR1@
102-
## FIXME: LIBS is approporiate for building R,
103-
## but not for packages if static libs are used.
104-
LIBS = @LIBS@
102+
LIBS = @LIBS_PKGS@
105103
## needed by R CMD config
106104
LIBnn = @LIBnn@
107105
LIBTOOL = $(SHELL) "$(R_HOME)/bin/libtool"

m4/R.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3961,7 +3961,7 @@ fi
39613961
## -------
39623962
## Look for iconv, possibly in libiconv.
39633963
## Need to include <iconv.h> as this may define iconv as a macro.
3964-
## libiconv, e.g. on macOS, has iconv as a macro and needs -liconv.
3964+
## GNU libiconv, e.g. on older macOS, has iconv as a macro and needs -liconv.
39653965
AC_DEFUN([R_ICONV],
39663966
[AC_CHECK_HEADERS(iconv.h)
39673967
dnl need to ignore cache for this as it may set LIBS
@@ -3976,6 +3976,7 @@ AC_CACHE_CHECK(for iconv, ac_cv_func_iconv, [
39763976
iconv_close(cd);]])],[ac_cv_func_iconv=yes],[])
39773977
if test "$ac_cv_func_iconv" != yes; then
39783978
r_save_LIBS="$LIBS"
3979+
dnl libiconv is system and hence dynamic on macOS
39793980
LIBS="$LIBS -liconv"
39803981
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
39813982
#ifdef HAVE_ICONV_H

0 commit comments

Comments
 (0)