From be1ae7087f6e8aa3cb7b38e1c0717198c218efe9 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Sun, 25 Feb 2018 04:32:15 +0100 Subject: m4/nx-macros.m4: add NX_TARGET_USE_ELF macro, setting TARGET_ELF automake conditional if target compiler is generating ELF binaries. --- m4/nx-macros.m4 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/m4/nx-macros.m4 b/m4/nx-macros.m4 index 1c0e1ea7a..81d6ea147 100644 --- a/m4/nx-macros.m4 +++ b/m4/nx-macros.m4 @@ -407,6 +407,23 @@ FreeBSD= test "$nxconf_cv_freebsd" = yes && FreeBSD=yes ]) # NX_BUILD_ON_FreeBSD +# Check to see if we're generating binaries in ELF format. + +AC_DEFUN([NX_TARGET_USE_ELF], +[AC_CACHE_CHECK([if target system is ELF-based], [nxconf_cv_targetelf], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( +[[ +#ifndef __ELF__ +#error not an ELF-based system +error! +#endif +]], +[[ +]])], +[nxconf_cv_targetelf=yes], [nxconf_cv_targetelf=no])]) +AM_CONDITIONAL([TARGET_ELF], [test x"$nxconf_cv_targetelf" = "xyes"]) +]) # NX_TARGET_USE_ELF + AC_DEFUN([LIBJPEG_FALLBACK_CHECK],[ AC_MSG_CHECKING([for libjpeg shared libary file and headers]) AC_CHECK_LIB([jpeg], [jpeg_destroy_compress], -- cgit v1.2.3 From 990e61cc8931be57bda5526a69e6e204e1ee2dda Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Sun, 25 Feb 2018 04:33:52 +0100 Subject: nxcompshad/{configure.ac,src/Makefile.am}: only enable new ELF dtags if target system actually is ELF-based. --- nxcompshad/configure.ac | 2 ++ nxcompshad/src/Makefile.am | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nxcompshad/configure.ac b/nxcompshad/configure.ac index 3113918b2..181e43a04 100644 --- a/nxcompshad/configure.ac +++ b/nxcompshad/configure.ac @@ -47,6 +47,8 @@ AC_LANG([C++]) NX_COMPILER_BRAND NX_DEFAULT_OPTIONS +NX_TARGET_USE_ELF + AC_ARG_ENABLE([cxx11], [AS_HELP_STRING([--enable-cxx11], [enable optional features requiring C++11 support (disabled by default)])], diff --git a/nxcompshad/src/Makefile.am b/nxcompshad/src/Makefile.am index f7beac86e..4580149ad 100644 --- a/nxcompshad/src/Makefile.am +++ b/nxcompshad/src/Makefile.am @@ -39,10 +39,14 @@ AM_CPPFLAGS = \ libXcompshad_la_LDFLAGS = \ -version-number @LT_COMPSHAD_VERSION@ -no-undefined \ - -Wl,--enable-new-dtags \ -R '$(libdir)/nx/X11' \ $(NULL) +if TARGET_ELF +libXcompshad_la_LDFLAGS += \ + -Wl,--enable-new-dtags \ +endif TARGET_ELF + libXcompshadincludedir = $(includedir)/nx libXcompshadinclude_HEADERS = \ $(top_srcdir)/include/Shadow.h \ -- cgit v1.2.3 From 06c14b83184f30498e27fed435d38d6e33338f2c Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Sun, 25 Feb 2018 04:35:07 +0100 Subject: nxproxy/{configure.ac,src/Makefile.am}: only enable new ELF dtags if target system actually is ELF-based. Fixes: ArcticaProject/nx-libs#661 --- nxproxy/configure.ac | 2 ++ nxproxy/src/Makefile.am | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/nxproxy/configure.ac b/nxproxy/configure.ac index a1dcab442..6a0a41cbb 100644 --- a/nxproxy/configure.ac +++ b/nxproxy/configure.ac @@ -26,6 +26,8 @@ AC_LANG([C]) NX_COMPILER_BRAND NX_DEFAULT_OPTIONS +NX_TARGET_USE_ELF + dnl This is a workaround for a nasty libtool bug. dnl We actually compile libXcomp with pthread support, but libtool uses g++ ... -nostdlib ... -pthread dnl on Linux. -nostdlib causes -pthread to be ignored. diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index ecf2a0486..fbe52cbf8 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -15,8 +15,13 @@ nxproxy_LDADD = \ nxproxy_LDFLAGS = \ $(PTHREAD_LDFLAGS) \ + $(NULL) + +if TARGET_ELF +nxproxy_LDFLAGS += \ -Wl,--enable-new-dtags \ $(NULL) +endif TARGET_ELF nxproxy_CFLAGS = \ $(BASE_CFLAGS) \ -- cgit v1.2.3