From 03930ce98bd78ca238ad435e48ee2dd66e390186 Mon Sep 17 00:00:00 2001 From: Yuxuan Chen Date: Thu, 15 Feb 2024 10:44:27 -0800 Subject: [PATCH] Add -rpath config to handle case where LLVM libraries are not installed on a system path --- Makefile.in | 1 + clang_delta/Makefile.am | 6 ++++-- clang_delta/Makefile.in | 10 +++++++--- clex/Makefile.in | 1 + configure | 14 +++++++++++++- creduce/Makefile.in | 1 + delta/Makefile.in | 1 + scripts/Makefile.in | 1 + tests/Makefile.in | 1 + unifdef/Makefile.in | 1 + 10 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Makefile.in b/Makefile.in index d9295f1c..ae4db37b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -343,6 +343,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/clang_delta/Makefile.am b/clang_delta/Makefile.am index 9e27f9fa..9e2301d4 100644 --- a/clang_delta/Makefile.am +++ b/clang_delta/Makefile.am @@ -99,6 +99,7 @@ LLVMLDFLAGS := $(shell "$(LLVM_CONFIG)" \--ldflags) LLVMINCLUDEDIR := $(shell "$(LLVM_CONFIG)" --includedir) LLVMLIBS := $(shell "$(LLVM_CONFIG)" \--libs) \ $(shell "$(LLVM_CONFIG)" \--system-libs) +LLVMLIBDIR := $(shell "$(LLVM_CONFIG)" \--prefix)/lib/ clang_delta_CPPFLAGS = \ $(CLANG_CPPFLAGS) \ @@ -108,8 +109,9 @@ clang_delta_CXXFLAGS = \ $(LLVMCXXFLAGS) # See comment below about `clang_delta_LDADD' and `LLVMLDFLAGS'. -# clang_delta_LDFLAGS = \ -# $(LLVMLDFLAGS) +clang_delta_LDFLAGS = \ + $(LLVMLDFLAGS) \ + -Wl,-rpath=$(LLVMLIBDIR) # Try to do the "right thing" by putting these in `clang_delta_LDADD' instead # of `clang_delta_LDFLAGS'. This leads to the funny escape in `LLVMLIBS', diff --git a/clang_delta/Makefile.in b/clang_delta/Makefile.in index ffad0f28..087de2ad 100644 --- a/clang_delta/Makefile.in +++ b/clang_delta/Makefile.in @@ -194,7 +194,7 @@ am__v_lt_0 = --silent am__v_lt_1 = clang_delta_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(clang_delta_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ + $(CXXFLAGS) $(clang_delta_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -471,6 +471,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -546,6 +547,7 @@ LLVMINCLUDEDIR := $(shell "$(LLVM_CONFIG)" --includedir) LLVMLIBS := $(shell "$(LLVM_CONFIG)" \--libs) \ $(shell "$(LLVM_CONFIG)" \--system-libs) +LLVMLIBDIR := $(shell "$(LLVM_CONFIG)" \--prefix)/lib/ clang_delta_CPPFLAGS = \ $(CLANG_CPPFLAGS) \ -I"$(LLVMINCLUDEDIR)/clang" @@ -555,8 +557,10 @@ clang_delta_CXXFLAGS = \ # See comment below about `clang_delta_LDADD' and `LLVMLDFLAGS'. -# clang_delta_LDFLAGS = \ -# $(LLVMLDFLAGS) +clang_delta_LDFLAGS = \ + $(LLVMLDFLAGS) \ + -Wl,-rpath=$(LLVMLIBDIR) + # Try to do the "right thing" by putting these in `clang_delta_LDADD' instead # of `clang_delta_LDFLAGS'. This leads to the funny escape in `LLVMLIBS', diff --git a/clex/Makefile.in b/clex/Makefile.in index 23458b85..77b4adf6 100644 --- a/clex/Makefile.in +++ b/clex/Makefile.in @@ -320,6 +320,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/configure b/configure index 2a1b9671..1d359924 100755 --- a/configure +++ b/configure @@ -753,6 +753,7 @@ infodir docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -845,6 +846,7 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1097,6 +1099,15 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1234,7 +1245,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1387,6 +1398,7 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] diff --git a/creduce/Makefile.in b/creduce/Makefile.in index 91934948..11afdd22 100644 --- a/creduce/Makefile.in +++ b/creduce/Makefile.in @@ -287,6 +287,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/delta/Makefile.in b/delta/Makefile.in index a5e377cc..774a842c 100644 --- a/delta/Makefile.in +++ b/delta/Makefile.in @@ -315,6 +315,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 24691e49..24c39156 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -256,6 +256,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/tests/Makefile.in b/tests/Makefile.in index b3616eae..dbb145fe 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -258,6 +258,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/unifdef/Makefile.in b/unifdef/Makefile.in index b7cbaf15..c6ada757 100644 --- a/unifdef/Makefile.in +++ b/unifdef/Makefile.in @@ -305,6 +305,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@