Skip to content
Snippets Groups Projects
Commit 43f3660c authored by Andreas Fuchs's avatar Andreas Fuchs Committed by Kevin Layer
Browse files

Make clim load Motif from known locations on OS X.

Since the OS X linker hard-codes libraries into climxm.dylib, users had to
install Motif in exactly the same places we had it when we built CLIM. Now,
use the (OS X-only) linker flag -weak-l to link climxm.dylib weakly against
these libraries, and preload them from known locations on startup (sys::*clim-library-search-path*).

This means that now, users can install Motif from source (like they were used
to), or through Homebrew or MacPorts, without having to to worry if CLIM will
load.

This change also changes the build process to no longer use make_shared.mac
[64], and instead uses ld directly, and re-adds /usr/local/{lib,include} to
include and library search paths.
parent 08e062e7
No related branches found
No related tags found
No related merge requests found
......@@ -17,23 +17,26 @@ SET_LIBRARY_PATH =
#CL=../src/xm-dcl
TKLIB=-L/opt/local/lib -lXm
XTLIB=-L/usr/X11R6/lib -lXt
XLIB=-L/usr/X11R6/lib -lX11
# removed /usr/local/lib/liblanginfo.a from XLIB
# Since the linker hard-codes the truenames of these libraries and
# loading climxm.dylib fails when users attempt to load it with the
# files missing, we use -weak-l and preload the libraries (see
# tk/load-xm.lisp):
TKLIB=-L/opt/local/lib -L/usr/local/lib -weak-lXm
XTLIB=-L/usr/X11/lib -weak-lXt
XLIB=-weak-lX11
XINCLUDES=-I/usr/X11R6/include -I/opt/local/include
XINCLUDES=-I/usr/X11R6/include -I/opt/local/include -I/usr/local/include
ifeq ($(SIXTYFOURBIT),yes)
CFLAGS = -arch x86_64 -DAcl64Bit
MAKE_SHARED = sh ../src/bin/make_shared.mac64
MAKE_SHARED = ld -arch x86_64 -bundle /usr/lib/bundle1.o -force_cpusubtype_ALL -flat_namespace
else
ifeq ($(MACHINE),x86)
CFLAGS= -arch i386
MAKE_SHARED = sh ../src/bin/make_shared.mac86
MAKE_SHARED = ld -arch i386 -bundle /usr/lib/bundle1.o -force_cpusubtype_ALL -flat_namespace
else
CFLAGS=
MAKE_SHARED = sh ../src/bin/make_shared.mac
MAKE_SHARED = ld -bundle /usr/lib/bundle1.o -force_cpusubtype_ALL -flat_namespace
endif
endif
......@@ -41,6 +44,9 @@ PICFLAGS =
SHAREFLAGS =
AR = ar cq
# Make sure the wnn build is happy:
REDHATLIBS = -lc
PRODUCT-OBJS= $(PRODUCT-GENERIC-OBJS) $(STATIC-XM-OBJS) $(SHARED-XM-OBJS)
IMPORTS = stub-x.o stub-xt.o stub-motif.o
......
......@@ -19,11 +19,33 @@
;;
;; $Id: load-xm.lisp,v 2.7 2007/04/17 21:45:53 layer Exp $
(in-package :user)
(cl:in-package #:user)
(eval-when (compile eval load)
(require :climg))
(defvar sys::*clim-library-search-path* '("/usr/X11/lib/" "/usr/X11R6/lib/" "/usr/local/lib/"
"/opt/local/lib/" "/sw/lib/"))
;;; On Mac OS X, the linker hard-codes the paths to libraries into
;;; climxm.dylib, so we instruct it to link weakly against Motif (so
;;; it doesn't complain if the file isn't found), and pre-load its
;;; dependency libraries' basenames from known places in the file
;;; system here.
#+macosx
(unless (ff:get-entry-point (ff:convert-foreign-name "XtInitialize"))
(excl.osi:with-command-output (sys::library (format nil "otool -L ~a"
(probe-file
(format nil "clim2:;climxm.~a"
(car excl::*load-foreign-types*)))))
(when (eql (elt sys::library 0) #\Tab)
(let ((sys::library-name (nth-value 2 (match-re ".*/(lib[^ ]+) " sys::library))))
(unless (dolist (pathname sys::*clim-library-search-path*)
(handler-case (progn (load (merge-pathnames sys::library-name pathname))
(return t))
(error (e) nil)))
(error "Can't find ~a in ~{~a~^, ~}~%" sys::library-name sys::*clim-library-search-path*))))))
#+(version>= 5 0)
(unless (ff:get-entry-point (ff:convert-foreign-name "XmCreateMyDrawingArea"))
(let (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment