[patch #8847] AX_PTHREAD: improve support for Solaris

Alan Coopersmith <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.archive-maintainers
Message-ID <[email protected]>
URL:
  <http://savannah.gnu.org/patch/?8847>

                 Summary: AX_PTHREAD: improve support for Solaris
                 Project: GNU Autoconf Archive
            Submitted by: alanc
            Submitted on: Sun 10 Jan 2016 04:33:43 AM GMT
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

This patch improves the selection of flags for gcc & Sun cc on
Solaris, dropping those no longer needed on modern versions,
while preserving support for older versions that still need them.

It also modifies the fix for http://savannah.gnu.org/patch/?7666
to use the existing compiler tests - previously that wasn't
effective because -lpthread was tested before -mt so it never
got to the -mt test - now it tests -mt & -lpthread in unison
so we add -mt only for compilers that support it, not for all
which aren't gcc (hence removing the need for the "What about
clang?" comment).

To test, I wrote a quick stub configure.ac:

AC_INIT(test, 0.1)
AM_INIT_AUTOMAKE([foreign])

AX_PTHREAD()

AC_MSG_NOTICE([host_os:        ${host_os}])
AC_MSG_NOTICE([PTHREAD_CC:     ${PTHREAD_CC}])
AC_MSG_NOTICE([PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}])
AC_MSG_NOTICE([PTHREAD_LIBS:   ${PTHREAD_LIBS}])
        
AC_OUTPUT

Output on various machines using Studio cc:

configure: host_os:        solaris2.12
configure: PTHREAD_CC:     cc
configure: PTHREAD_CFLAGS:
configure: PTHREAD_LIBS:

configure: host_os:        solaris2.11
configure: PTHREAD_CC:     cc
configure: PTHREAD_CFLAGS: -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
configure: PTHREAD_LIBS:

configure: host_os:        solaris2.10
configure: PTHREAD_CC:     cc
configure: PTHREAD_CFLAGS: -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
configure: PTHREAD_LIBS:

configure: host_os:        solaris2.9
configure: PTHREAD_CC:     cc
configure: PTHREAD_CFLAGS: -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -mt
configure: PTHREAD_LIBS:   -lpthread

And using gcc:

configure: host_os:        solaris2.12
configure: PTHREAD_CC:     gcc
configure: PTHREAD_CFLAGS: 
configure: PTHREAD_LIBS:

configure: host_os:        solaris2.11
configure: PTHREAD_CC:     gcc
configure: PTHREAD_CFLAGS: -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
configure: PTHREAD_LIBS:

configure: host_os:        solaris2.10
configure: PTHREAD_CC:     gcc
configure: PTHREAD_CFLAGS: -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
configure: PTHREAD_LIBS:

[I couldn't find a working pre-S10 machine with gcc to test on.]

And for comparison, prior to this fix:

configure: host_os:        solaris2.12
configure: PTHREAD_CC:     cc
configure: PTHREAD_CFLAGS: -mt -D_REENTRANT
configure: PTHREAD_LIBS:   -lpthread

configure: host_os:        solaris2.12
configure: PTHREAD_CC:     gcc
configure: PTHREAD_CFLAGS: -D_REENTRANT -pthreads
configure: PTHREAD_LIBS:

I've confirmed with the Solaris libc/threads, linker, and compiler teams that
these are the correct flags for these OS'es.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 10 Jan 2016 04:33:43 AM GMT  Name:
0001-AX_PTHREAD-improve-support-for-Solaris.patch  Size: 5kB   By: alanc

<http://savannah.gnu.org/patch/download.php?file_id=35959>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?8847>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.