Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
989bf54c
Commit
989bf54c
authored
5 years ago
by
Thomas Jahns
Browse files
Options
Downloads
Patches
Plain Diff
Fix TLS detection for PGI compiler.
parent
47a3f4e5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
configure
+156
-21
156 additions, 21 deletions
configure
m4/acx_tls_xlc_retry.m4
+23
-12
23 additions, 12 deletions
m4/acx_tls_xlc_retry.m4
m4/ax_tls.m4
+20
-23
20 additions, 23 deletions
m4/ax_tls.m4
src/config.h.in
+1
-1
1 addition, 1 deletion
src/config.h.in
with
200 additions
and
57 deletions
configure
+
156
−
21
View file @
989bf54c
...
...
@@ -546,6 +546,66 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
SHELL=${CONFIG_SHELL-/bin/sh}
as_awk_strverscmp='
# Use only awk features that work with 7th edition Unix awk (1978).
# My, what an old awk you have, Mr. Solaris!
END {
while (length(v1) && length(v2)) {
# Set d1 to be the next thing to compare from v1, and likewise for d2.
# Normally this is a single character, but if v1 and v2 contain digits,
# compare them as integers and fractions as strverscmp does.
if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
# Split v1 and v2 into their leading digit string components d1 and d2,
# and advance v1 and v2 past the leading digit strings.
for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
if (d1 ~ /^0/) {
if (d2 ~ /^0/) {
# Compare two fractions.
while (d1 ~ /^0/ && d2 ~ /^0/) {
d1 = substr(d1, 2); len1--
d2 = substr(d2, 2); len2--
}
if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
# The two components differ in length, and the common prefix
# contains only leading zeros. Consider the longer to be less.
d1 = -len1
d2 = -len2
} else {
# Otherwise, compare as strings.
d1 = "x" d1
d2 = "x" d2
}
} else {
# A fraction is less than an integer.
exit 1
}
} else {
if (d2 ~ /^0/) {
# An integer is greater than a fraction.
exit 2
} else {
# Compare two integers.
d1 += 0
d2 += 0
}
}
} else {
# The normal case, without worrying about digits.
d1 = substr(v1, 1, 1); v1 = substr(v1, 2)
d2 = substr(v2, 1, 1); v2 = substr(v2, 2)
}
if (d1 < d2) exit 1
if (d1 > d2) exit 2
}
# Beware Solaris /usr/xgp4/bin/awk (at least through Solaris 10),
# which mishandles some comparisons of empty strings to integers.
if (length(v2)) exit 1
if (length(v1)) exit 2
}
'
test -n "$DJDIR" || exec 7<&0 </dev/null
exec 6>&1
...
...
@@ -31006,7 +31066,7 @@ $as_echo_n "checking for thread local storage (TLS) class... " >&6; }
if ${ac_cv_tls+:} false; then :
$as_echo_n "(cached) " >&6
else
for ax_tls_keyword in __thread '__declspec(thread)' none; do
for ax_tls_keyword in
thread_local _Thread_local
__thread '__declspec(thread)' none; do
case $ax_tls_keyword in #(
none) :
ac_cv_tls=none ; break ;; #(
...
...
@@ -31014,14 +31074,10 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
static void
foo(void) {
static $ax_tls_keyword int bar;
exit(1);
}
int
main ()
{
static $ax_tls_keyword int bar;
;
return 0;
...
...
@@ -31033,7 +31089,8 @@ else
ac_cv_tls=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;;
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
esac
done
...
...
@@ -31048,7 +31105,7 @@ cat >>confdefs.h <<_ACEOF
#define TLS $ac_cv_tls
_ACEOF
:
else
ac_cv_tls=`$CC -qversion 2>&1 | sed -n '/^IBM XL C/{
n
...
...
@@ -31058,11 +31115,92 @@ b
: print
p
}'`
if test x"$ac_cv_tls" = x; then :
if test x"$ac_cv_tls" = x; then :
ac_cv_tls=`$CC -V | sed -n '/^pgcc /{
s/^pgcc \(0-90-9.*\).*/\1/
p
}'`
# pgcc 18.1 and newer support TLS if switched to C11 mode
as_arg_v1=$ac_cv_tls
as_arg_v2=18.9
awk "$as_awk_strverscmp" v1="$as_arg_v1" v2="$as_arg_v2" /dev/null
case $? in #(
1) :
ac_cv_tls=none ;; #(
0) :
ac_cv_tls=none ;; #(
2) :
saved_CFLAGS=$CFLAGS
case " $CFLAGS " in #(
-c11 ) :
;; #(
*) :
CFLAGS="$CFLAGS -c11" ;;
esac
if test x"$CFLAGS" = x"$saved_CFLAGS"; then :
ac_cv_tls=none
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: retrying with -c11 added to CFLAGS" >&5
$as_echo "$as_me: retrying with -c11 added to CFLAGS" >&6;}
{ ac_cv_tls=; unset ac_cv_tls;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread local storage (TLS) class" >&5
$as_echo_n "checking for thread local storage (TLS) class... " >&6; }
if ${ac_cv_tls+:} false; then :
$as_echo_n "(cached) " >&6
else
for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do
case $ax_tls_keyword in #(
none) :
ac_cv_tls=none ; break ;; #(
*) :
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
int
main ()
{
static $ax_tls_keyword int bar;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_tls=$ax_tls_keyword ; break
else
ac_cv_tls=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
esac
done
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_tls" >&5
$as_echo "$ac_cv_tls" >&6; }
if test "$ac_cv_tls" != "none"; then :
cat >>confdefs.h <<_ACEOF
#define TLS $ac_cv_tls
_ACEOF
:
else
CFLAGS=$saved_CFLAGS
fi
fi ;; #(
*) :
;;
esac
elif test "$ac_cv_tls" -gt 7; then :
saved_CFLAGS=$CFLAGS
CFLAGS=`echo "$CFLAGS" | sed -n '/.*-qtls\(=[^ ]*\)\{0,1\}/{
# unless the user already set the -qtls option, add it and retry test
saved_CFLAGS=$CFLAGS
CFLAGS=`echo "$CFLAGS" | sed -n '/.*-qtls\(=[^ ]*\)\{0,1\}/{
p
q
}
...
...
@@ -31070,19 +31208,19 @@ s/$/ -qtls=initial-exec/
p
q
'`
if test x"$CFLAGS" = x"$saved_CFLAGS"; then :
if test x"$CFLAGS" = x"$saved_CFLAGS"; then :
ac_cv_tls=none
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: retrying with -qtls=initial-exec added to CFLAGS" >&5
$as_echo "$as_me: retrying with -qtls=initial-exec added to CFLAGS" >&6;}
{ ac_cv_tls=; unset ac_cv_tls;}
{ ac_cv_tls=; unset ac_cv_tls;}
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread local storage (TLS) class" >&5
$as_echo_n "checking for thread local storage (TLS) class... " >&6; }
if ${ac_cv_tls+:} false; then :
$as_echo_n "(cached) " >&6
else
for ax_tls_keyword in __thread '__declspec(thread)' none; do
for ax_tls_keyword in
thread_local _Thread_local
__thread '__declspec(thread)' none; do
case $ax_tls_keyword in #(
none) :
ac_cv_tls=none ; break ;; #(
...
...
@@ -31090,14 +31228,10 @@ else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
static void
foo(void) {
static $ax_tls_keyword int bar;
exit(1);
}
int
main ()
{
static $ax_tls_keyword int bar;
;
return 0;
...
...
@@ -31109,7 +31243,8 @@ else
ac_cv_tls=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;;
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
esac
done
...
...
@@ -31124,7 +31259,7 @@ cat >>confdefs.h <<_ACEOF
#define TLS $ac_cv_tls
_ACEOF
:
else
CFLAGS=$saved_CFLAGS
fi
This diff is collapsed.
Click to expand it.
m4/acx_tls_xlc_retry.m4
+
23
−
12
View file @
989bf54c
...
...
@@ -35,6 +35,15 @@ dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dnl
dnl _ACX_TLS_NEWFLAG run AX_TLS with compiler option
m4_define([_ACX_TLS_RETRY],
[saved_CFLAGS=$CFLAGS
$2
AS_IF([test x"$CFLAGS" = x"$saved_CFLAGS"],
[ac_cv_tls=none],
[AC_MSG_NOTICE([retrying with $1 added to CFLAGS])
AS_UNSET([ac_cv_tls])
AX_TLS(,[CFLAGS=$saved_CFLAGS])])])
dnl
dnl ACX_TLS_XLC_RETRY([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl
...
...
@@ -50,24 +59,26 @@ b
: print
p
}'`
AS_IF([test x"$ac_cv_tls" = x],
[ac_cv_tls=none],
[test "$ac_cv_tls" -gt 7],
[saved_CFLAGS=$CFLAGS
CFLAGS=`echo "$CFLAGS" | sed -n '/.*-qtls\(=@<:@^ @:>@*\)\{0,1\}/{
AS_IF([test x"$ac_cv_tls" = x],
[ac_cv_tls=`$CC -V | sed -n '/^pgcc /{
s/^pgcc \([0-9][0-9.]*\).*/\1/
p
}'`
# pgcc 18.1 and newer support TLS if switched to C11 mode
AS_VERSION_COMPARE([$ac_cv_tls],[18.9],
[ac_cv_tls=none],[ac_cv_tls=none],
[_ACX_TLS_RETRY([-c11],
[AS_CASE([" $CFLAGS "],[ -c11 ],,[CFLAGS="$CFLAGS -c11"])])])],
[test "$ac_cv_tls" -gt 7],
[# unless the user already set the -qtls option, add it and retry test
_ACX_TLS_RETRY([-qtls=initial-exec],[CFLAGS=`echo "$CFLAGS" | sed -n '/.*-qtls\(=@<:@^ @:>@*\)\{0,1\}/{
p
q
}
s/$/ -qtls=initial-exec/
p
q
'`
dnl unless the user already set the -qtls option, add it and retry test
AS_IF([test x"$CFLAGS" = x"$saved_CFLAGS"],
[ac_cv_tls=none],
[AC_MSG_NOTICE([retrying with -qtls=initial-exec added to CFLAGS])
AS_UNSET([ac_cv_tls])
AX_TLS(,[CFLAGS=$saved_CFLAGS])])
'`])
],[ac_cv_tls=none])])
m4_ifnblank([$1$2],
[AS_IF([test "$ac_cv_tls" != "none"],
...
...
This diff is collapsed.
Click to expand it.
m4/ax_tls.m4
+
20
−
23
View file @
989bf54c
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_tls.html
# http
s
://www.gnu.org/software/autoconf-archive/ax_tls.html
# ===========================================================================
#
# SYNOPSIS
...
...
@@ -9,9 +9,9 @@
# DESCRIPTION
#
# Provides a test for the compiler support of thread local storage (TLS)
# extensions. Defines TLS if it is found. Currently knows about
GCC/ICC
# and MSVC. I think SunPro uses the same as GCC, and Borland
apparently
# supports either.
# extensions. Defines TLS if it is found. Currently knows about
C++11,
#
GCC/ICC,
and MSVC. I think SunPro uses the same as GCC, and Borland
#
apparently
supports either.
#
# LICENSE
#
...
...
@@ -29,7 +29,7 @@
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
# with this program. If not, see <http
s
://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
...
...
@@ -44,31 +44,28 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
#serial 1
1
#serial 1
5
AC_DEFUN([AX_TLS], [
AC_MSG_CHECKING([for thread local storage (TLS) class])
AC_CACHE_VAL([ac_cv_tls],
[for ax_tls_keyword in __thread '__declspec(thread)' none; do
[for ax_tls_keyword in
thread_local _Thread_local
__thread '__declspec(thread)' none; do
AS_CASE([$ax_tls_keyword],
[none], [ac_cv_tls=none ; break],
[AC_TRY_COMPILE(
[#include <stdlib.h>
static void
foo(void) {
static ] $ax_tls_keyword [ int bar;
exit(1);
}],
[],
[ac_cv_tls=$ax_tls_keyword ; break],
ac_cv_tls=none
)])
done
])
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[#include <stdlib.h>],
[static $ax_tls_keyword int bar;]
)],
[ac_cv_tls=$ax_tls_keyword ; break],
[ac_cv_tls=none]
)]
)
done ]
)
AC_MSG_RESULT([$ac_cv_tls])
AS_IF([test "$ac_cv_tls" != "none"],
[AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class define it to that here])
m4_ifnblank([$1],[$1])],
[m4_ifnblank([$2],[$2])])
[AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class
,
define it to that here])
m4_ifnblank([$1],[$1]
,[[:]]
)],
[m4_ifnblank([$2],[$2]
,[[:]]
)])
])
This diff is collapsed.
Click to expand it.
src/config.h.in
+
1
−
1
View file @
989bf54c
...
...
@@ -274,7 +274,7 @@
/* System type */
#undef SYSTEM_TYPE
/* If the compiler supports a TLS storage class define it to that here */
/* If the compiler supports a TLS storage class
,
define it to that here */
#undef TLS
/* User name */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment