make: silence clang complaining of -pthread
The clang linker doesn't need -pthread and warns of unknown command-line option. This detects clang and forgoes the -pthread flag to the linker. Change-Id: I658cd887c567a5beeeae0e6e1b6d596231894c1b Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
parent
fd87ab6b32
commit
c6dd263ab1
3 changed files with 26 additions and 2 deletions
|
@ -83,7 +83,12 @@ if !ENABLE_DEBUG
|
|||
AM_CPPFLAGS += -DNDEBUG
|
||||
endif
|
||||
|
||||
AM_LDFLAGS = -pthread -Wl,-E -lpam $(ZLIB_LIBS) $(ZSTD_LIBS) ${PNG_LIBS}
|
||||
AM_LDFLAGS = -Wl,-E -lpam $(ZLIB_LIBS) $(ZSTD_LIBS) ${PNG_LIBS}
|
||||
|
||||
# Clang's linker doesn't like -pthread.
|
||||
if !HAVE_CLANG
|
||||
AM_LDFLAGS += -pthread
|
||||
endif
|
||||
|
||||
if ENABLE_SSL
|
||||
AM_LDFLAGS += ${OPENSSL_LIBS}
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -1023,6 +1023,20 @@ else
|
|||
AC_MSG_ERROR(Compiler doesn't support C++17)
|
||||
fi
|
||||
|
||||
# Check if we have clang, rather than gcc, which
|
||||
# doesn't like -pthread on the linker command-line.
|
||||
AC_MSG_CHECKING([whether the compiler is clang])
|
||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
||||
#if !defined(__clang__)
|
||||
#error not clang
|
||||
#endif
|
||||
])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_CLANG],1,[whether the C++ compiler is clang])],
|
||||
[AC_MSG_RESULT([no])
|
||||
AC_DEFINE([HAVE_CLANG],0,[whether the C++ compiler is clang])])
|
||||
AM_CONDITIONAL([HAVE_CLANG], [test "$HAVE_CLANG" = "1"])
|
||||
|
||||
AS_IF([test "$ENABLE_GTKAPP" != true],
|
||||
[CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXXSTD"])
|
||||
|
||||
|
|
|
@ -93,7 +93,12 @@ endif
|
|||
noinst_LTLIBRARIES = ${all_la_unit_tests}
|
||||
|
||||
MAGIC_TO_FORCE_SHLIB_CREATION = -rpath /dummy
|
||||
AM_LDFLAGS = -pthread -module $(MAGIC_TO_FORCE_SHLIB_CREATION) $(ZLIB_LIBS) $(ZSTD_LIBS) ${PNG_LIBS}
|
||||
AM_LDFLAGS = -module $(MAGIC_TO_FORCE_SHLIB_CREATION) $(ZLIB_LIBS) $(ZSTD_LIBS) ${PNG_LIBS}
|
||||
|
||||
# Clang's linker doesn't like -pthread.
|
||||
if !HAVE_CLANG
|
||||
AM_LDFLAGS += -pthread
|
||||
endif
|
||||
|
||||
if ENABLE_SSL
|
||||
AM_LDFLAGS += ${OPENSSL_LIBS}
|
||||
|
|
Loading…
Reference in a new issue