1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-15 17:00:26 +00:00

Allow building on MacOS with MacPorts and libgccjit

* configure.ac: Check for the "port" command (MacPorts).
Add the required lib/include directories for nativecomp.

* src/Makefile.in (LIBGCCJIT_CFLAGS, LIBGCCJIT_LIBS): Split into
two parts to allow including -L/-I for MacPorts.
(LIBES): Adjust.
(EMACS_CFLAGS): Ditto.
This commit is contained in:
Lars Ingebrigtsen 2021-08-07 11:56:37 +02:00
parent 0b049fe71d
commit 8ce7a697ca
2 changed files with 33 additions and 7 deletions

View File

@ -1334,6 +1334,9 @@ if test -n "$BREW"; then
[`$BREW --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
fi
# Check MacPorts on macOS.
AC_PATH_PROG(HAVE_MACPORTS, port)
## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals.
: ${MAKEINFO:=makeinfo}
case `($MAKEINFO --version) 2>/dev/null` in
@ -3807,7 +3810,8 @@ source on this site:
<https://gcc.gnu.org/wiki/JIT>.])])
HAVE_NATIVE_COMP=no
LIBGCCJIT_LIB=
LIBGCCJIT_LIBS=
LIBGCCJIT_CFLAGS=
if test "${with_native_compilation}" != "no"; then
if test "${HAVE_PDUMPER}" = no; then
AC_MSG_ERROR(['--with-nativecomp' requires '--with-dumping=pdumper'])
@ -3827,6 +3831,20 @@ if test "${with_native_compilation}" != "no"; then
fi
fi
# Ensure libgccjit installed by MacPorts can be found.
if test -n "$HAVE_MACPORTS"; then
# Determine which gcc version has been installed (gcc11, for
# instance).
PORT_PACKAGE=$(port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \
awk '{ print $1; }')
MACPORTS_LIBGCCJIT_INCLUDE=$(dirname $(port contents $PORT_PACKAGE | \
grep libgccjit.h))
MACPORTS_LIBGCCJIT_LIB=$(dirname $(port contents $PORT_PACKAGE | \
grep libgccjit.dylib))
CFLAGS="$CFLAGS -I${MACPORTS_LIBGCCJIT_INCLUDE}"
LDFLAGS="$LDFLAGS -L${MACPORTS_LIBGCCJIT_LIB}"
fi
# Check if libgccjit is available.
AC_CHECK_LIB(gccjit, gcc_jit_context_acquire, [], [libgccjit_not_found])
AC_CHECK_HEADERS(libgccjit.h, [], [libgccjit_dev_not_found])
@ -3841,17 +3859,24 @@ if test "${with_native_compilation}" != "no"; then
mingw32) ;;
# OpenBSD doesn't have libdl, all the functions are in libc
netbsd|openbsd)
LIBGCCJIT_LIB="-lgccjit" ;;
LIBGCCJIT_LIBS="-lgccjit" ;;
*)
LIBGCCJIT_LIB="-lgccjit -ldl" ;;
LIBGCCJIT_LIBS="-lgccjit -ldl" ;;
esac
NEED_DYNLIB=yes
AC_DEFINE(HAVE_NATIVE_COMP, 1, [Define to 1 if native compiler is available.])
# Ensure libgccjit installed by MacPorts can be found.
if test -n "$HAVE_MACPORTS"; then
LIBGCCJIT_CFLAGS="$LIBGCCJIT_CFLAGS -I${MACPORTS_LIBGCCJIT_INCLUDE}"
LIBGCCJIT_LIBS="-L${MACPORTS_LIBGCCJIT_LIB} $LIBGCCJIT_LIBS"
fi
fi
AC_DEFINE_UNQUOTED(NATIVE_ELISP_SUFFIX, ".eln",
[System extension for native compiled elisp])
AC_SUBST(HAVE_NATIVE_COMP)
AC_SUBST(LIBGCCJIT_LIB)
AC_SUBST(LIBGCCJIT_CFLAGS)
AC_SUBST(LIBGCCJIT_LIBS)
DYNLIB_OBJ=
if test "${NEED_DYNLIB}" = yes; then

View File

@ -326,7 +326,8 @@ GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
LIBGMP = @LIBGMP@
LIBGCCJIT = @LIBGCCJIT_LIB@
LIBGCCJIT_LIBS = @LIBGCCJIT_LIBS@
LIBGCCJIT_CFLAGS = @LIBGCCJIT_CFLAGS@
## dynlib.o if necessary, else empty
DYNLIB_OBJ = @DYNLIB_OBJ@
@ -367,7 +368,7 @@ EMACS_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
-I$(lib) -I$(top_srcdir)/lib \
$(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
$(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
$(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
$(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(LIBGCCJIT_CFLAGS) $(DBUS_CFLAGS) \
$(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) $(XFIXES_CFLAGS) $(XDBE_CFLAGS) \
$(WEBKIT_CFLAGS) $(LCMS2_CFLAGS) \
$(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
@ -516,7 +517,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) $(LIBIMAGE) \
$(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(HARFBUZZ_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
$(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) $(LCMS2_LIBS) \
$(NOTIFY_LIBS) $(LIB_MATH) $(LIBZ) $(LIBMODULES) $(LIBSYSTEMD_LIBS) \
$(JSON_LIBS) $(LIBGMP) $(LIBGCCJIT)
$(JSON_LIBS) $(LIBGMP) $(LIBGCCJIT_LIBS)
## FORCE it so that admin/unidata can decide whether this file is
## up-to-date. Although since charprop depends on bootstrap-emacs,