]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- OSX clang, stop -pthread unused during link stage warnings.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 11 Dec 2015 13:15:40 +0000 (13:15 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 11 Dec 2015 13:15:40 +0000 (13:15 +0000)
git-svn-id: file:///svn/unbound/trunk@3583 be551aaa-1e26-0410-a405-d3ace91eadb9

Makefile.in
configure
configure.ac
doc/Changelog

index 282c7d683316aed2a3e20c3ed707411416217f83..293e63c0ac3e9531738129f1bbf6cf4997d91573 100644 (file)
@@ -243,7 +243,7 @@ ALL_OBJ=$(COMMON_OBJ) $(UNITTEST_OBJ) $(DAEMON_OBJ) \
        $(COMPAT_OBJ) $(PYUNBOUND_OBJ) \
        $(SVCINST_OBJ) $(SVCUNINST_OBJ) $(ANCHORUPD_OBJ) $(SLDNS_OBJ)
 
-COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS)
+COMPILE=$(LIBTOOL) --tag=CC --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) @PTHREAD_CFLAGS_ONLY@
 LINK=$(LIBTOOL) --tag=CC --mode=link $(CC) $(staticexe) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
 LINK_LIB=$(LIBTOOL) --tag=CC --mode=link $(CC) $(RUNTIME_PATH) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(staticexe) -version-info @LIBUNBOUND_CURRENT@:@LIBUNBOUND_REVISION@:@LIBUNBOUND_AGE@ -no-undefined
 
@@ -353,7 +353,7 @@ delayer$(EXEEXT):   $(DELAYER_OBJ_LINK)
        $(LINK) -o $@ $(DELAYER_OBJ_LINK) $(SSLLIB) $(LIBS)
 
 signit$(EXEEXT):       testcode/signit.c
-       $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ testcode/signit.c $(LDFLAGS) -lldns $(SSLLIB) $(LIBS)
+       $(CC) $(CPPFLAGS) $(CFLAGS) @PTHREAD_CFLAGS_ONLY@ -o $@ testcode/signit.c $(LDFLAGS) -lldns $(SSLLIB) $(LIBS)
 
 unbound.h:     $(srcdir)/libunbound/unbound.h
        sed -e 's/@''UNBOUND_VERSION_MAJOR@/$(UNBOUND_VERSION_MAJOR)/' -e 's/@''UNBOUND_VERSION_MINOR@/$(UNBOUND_VERSION_MINOR)/' -e 's/@''UNBOUND_VERSION_MICRO@/$(UNBOUND_VERSION_MICRO)/' < $(srcdir)/libunbound/unbound.h > $@
@@ -567,7 +567,7 @@ DEPEND_TARGET2=Makefile.in
 # then, remove srcdir from the (generated) parser and lexer.
 # and mention the .lo
 depend:
-       (cd $(srcdir) ; $(CC) $(DEPFLAG) $(CPPFLAGS) $(CFLAGS) $(ALL_SRC) $(COMPAT_SRC)) | \
+       (cd $(srcdir) ; $(CC) $(DEPFLAG) $(CPPFLAGS) $(CFLAGS) @PTHREAD_CFLAGS_ONLY@ $(ALL_SRC) $(COMPAT_SRC)) | \
                sed -e 's!'$$HOME'[^ ]* !!g' -e 's!'$$HOME'[^ ]*$$!!g' \
                        -e 's!/usr[^ ]* !!g' -e 's!/usr[^ ]*$$!!g' \
                        -e 's!/opt[^ ]* !!g' -e 's!/opt[^ ]*$$!!g' | \
index 6f627b512464a2af7cd8b194e98f590b003541d1..2b766c9849bb60efa0618f415176d1675dc0b9a6 100755 (executable)
--- a/configure
+++ b/configure
@@ -684,6 +684,7 @@ PYTHON_LDFLAGS
 PYTHON_CPPFLAGS
 PYTHON
 PYTHON_VERSION
+PTHREAD_CFLAGS_ONLY
 PTHREAD_CFLAGS
 PTHREAD_LIBS
 PTHREAD_CC
@@ -15873,6 +15874,43 @@ _ACEOF
 fi
 
 
+               if echo "$CFLAGS" | grep -e "-pthread" >/dev/null; then
+               { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -pthread unused during linking" >&5
+$as_echo_n "checking if -pthread unused during linking... " >&6; }
+               # catch clang warning 'argument unused during compilation'
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+
+int main(void) {return 0;}
+
+_ACEOF
+               pthread_unused="yes"
+               # first compile
+               echo "$CC $CFLAGS -c conftest.c -o conftest.o" >&5
+               $CC $CFLAGS -c conftest.c -o conftest.o 2>&5 >&5
+               if test $? = 0; then
+                       # then link
+                       echo "$CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest contest.o" >&5
+                       $CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest conftest.o 2>&5 >&5
+                       if test $? -ne 0; then
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+                               CFLAGS=`echo "$CFLAGS" | sed -e 's/-pthread//'`
+                               PTHREAD_CFLAGS_ONLY="-pthread"
+
+                       else
+                               { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                       fi
+               else
+                       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+               fi # endif cc successful
+               rm -f conftest conftest.c conftest.o
+               fi # endif -pthread in CFLAGS
+
+
         :
 else
         ax_pthread_ok=no
index 49075254bde1398ad6220b616604eab121d4fe1e..d3f4ef67284fdcab7ee6926a10cca1c5d9696d52 100644 (file)
@@ -418,6 +418,36 @@ if test x_$withval != x_no; then
                CC="$PTHREAD_CC"
                ub_have_pthreads=yes
                AC_CHECK_TYPES([pthread_spinlock_t, pthread_rwlock_t],,,[#include <pthread.h>])
+
+               if echo "$CFLAGS" | grep -e "-pthread" >/dev/null; then
+               AC_MSG_CHECKING([if -pthread unused during linking])
+               # catch clang warning 'argument unused during compilation'
+               AC_LANG_CONFTEST([AC_LANG_SOURCE(AC_INCLUDES_DEFAULT
+[[
+int main(void) {return 0;}
+]])])
+               pthread_unused="yes"
+               # first compile
+               echo "$CC $CFLAGS -c conftest.c -o conftest.o" >&AS_MESSAGE_LOG_FD
+               $CC $CFLAGS -c conftest.c -o conftest.o 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
+               if test $? = 0; then 
+                       # then link
+                       echo "$CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest contest.o" >&AS_MESSAGE_LOG_FD
+                       $CC $CFLAGS -Werror $LDFLAGS $LIBS -o conftest conftest.o 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD
+                       if test $? -ne 0; then
+                               AC_MSG_RESULT(yes)
+                               CFLAGS=`echo "$CFLAGS" | sed -e 's/-pthread//'`
+                               PTHREAD_CFLAGS_ONLY="-pthread"
+                               AC_SUBST(PTHREAD_CFLAGS_ONLY)
+                       else
+                               AC_MSG_RESULT(no)
+                       fi
+               else
+                       AC_MSG_RESULT(no)
+               fi # endif cc successful
+               rm -f conftest conftest.c conftest.o
+               fi # endif -pthread in CFLAGS
+
                ])
 fi
 
index 681b203e210b8b5e6a1a182d2022201e6a84c087..47277b6fffa25489934111709684c9e958df4f1b 100644 (file)
@@ -3,6 +3,7 @@
        - updated ax_pthread.m4 to version 21 with clang support, this
          removes a warning from compilation.
        - OSX portability, detect if sbrk is deprecated.
+       - OSX clang, stop -pthread unused during link stage warnings.
 
 10 December 2015: Wouter
        - 1.5.7 release