unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Alan Third <alan@idiocy.org>
Cc: Davide Restivo <davide.restivo@yahoo.it>,
	45934@debbugs.gnu.org, xgutter@yahoo.it,
	Andrea Corallo <akrl@sdf.org>
Subject: bug#45934: native-comp - Dylib ID of ELN files not optimal
Date: Fri, 06 Aug 2021 12:49:39 +0200	[thread overview]
Message-ID: <877dgyc0fw.fsf@gnus.org> (raw)
In-Reply-To: <YQw1Qw58de4nZPaT@idiocy.org> (Alan Third's message of "Thu, 5 Aug 2021 20:00:19 +0100")

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

Alan Third <alan@idiocy.org> writes:

> I finally found the code that works it out for Homebrew. I've never
> used MacPorts but I think all you need to do is something similar to
> (from configure.ac:3820):
>
>     CFLAGS="$CFLAGS -I${BREW_LIBGCCJIT_PREFIX}/include"
>     LDFLAGS="$LDFLAGS -L${brew_libdir} -I${BREW_LIBGCCJIT_PREFIX}/include"
>
> Where "${BREW_LIBGCCJIT_PREFIX}/include" is where the include files
> are and ${brew_libdir} is where the .so files are.

Ah, thanks.  With that I was able to cobble together a patch to make it
compile under Macos with Macports, but it obviously needs more work
before pushing.  I'm not really familiar with the "port" command at all
-- can I get it to cough up which gcc version is installed, for
instance?

I'll poke around some more and clean up the patch.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

[-- Attachment #2: jit --]
[-- Type: application/octet-stream, Size: 3565 bytes --]

diff --git a/configure.ac b/configure.ac
index 79cc56f9a7..cb5f4b58ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1334,6 +1334,9 @@ AC_DEFUN
     [`$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 @@ AC_DEFUN
 <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,13 @@ AC_DEFUN
       fi
     fi
 
+    # Ensure libgccjit installed by MacPorts can be found.
+    if test -n "$HAVE_MACPORTS"; then
+      CPPFLAGS="$CPPFLAGS -I/opt/local/include/gcc11"
+      CFLAGS="$CFLAGS -I/opt/local/include/gcc11"
+      LDFLAGS="$LDFLAGS -L/opt/local/lib/gcc11 -I/opt/local/include/gcc11"
+    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 +3852,24 @@ AC_DEFUN
       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/opt/local/include/gcc11"
+      LIBGCCJIT_LIBS="-L/opt/local/lib/gcc11 $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
diff --git a/src/Makefile.in b/src/Makefile.in
index 22c7aeed5c..732cd8f099 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -326,7 +326,8 @@ 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=
   -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 =
    $(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,

  reply	other threads:[~2021-08-06 10:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <EDAEF3DD-6B4E-4ED9-A7B8-8FB4F236DF42.ref@yahoo.it>
2021-01-17 10:13 ` bug#45934: native-comp - Dylib ID of ELN files not optimal davide.restivo--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-17 12:36   ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-17 16:48     ` davide.restivo--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-17 20:06       ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-23 16:13         ` davide.restivo--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-24 19:37           ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-28 21:59           ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-29  7:09             ` Eli Zaretskii
2021-01-29  8:52               ` akrl--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-01-30  8:18             ` davide.restivo--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-11 16:00               ` xgutter--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-07-30 12:32                 ` Lars Ingebrigtsen
2021-08-02 14:19                   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-04  6:55                     ` Lars Ingebrigtsen
2021-08-04 18:11                       ` Alan Third
2021-08-05 10:54                         ` Lars Ingebrigtsen
2021-08-05 19:00                           ` Alan Third
2021-08-06 10:49                             ` Lars Ingebrigtsen [this message]
2021-08-06 16:37                               ` Alan Third
2021-08-07  9:52                                 ` Lars Ingebrigtsen
2021-08-07  9:57                                   ` Lars Ingebrigtsen
2021-08-07 10:25                                     ` Lars Ingebrigtsen
2021-08-07 13:11                                       ` Alan Third
2021-08-09 12:20                                         ` Lars Ingebrigtsen
2021-08-22 17:18                                           ` Davide Restivo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-22 19:40                                             ` Davide Restivo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-08-22 21:18                                               ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dgyc0fw.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=45934@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=alan@idiocy.org \
    --cc=davide.restivo@yahoo.it \
    --cc=xgutter@yahoo.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).