Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01051a9

Browse files
committed
Use AS_IF rather than plain shell "if" in pthread-check.
Autoconf generates additional code for the first AC_CHECK_HEADERS call inthe script. If the first call is within an if-block, the additional code isput inside the if-block too, even though it is needed by subsequentAC_CHECK_HEADERS checks and should always be executed. When I moved thepthread-related checks earlier in the script, the pthread.h test insidethe block became the very first AC_CHECK_HEADERS call in the script,triggering that problem.To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,and makes sure the additional code is always executed. To be completelysafe from this issue (and others), we should always be using AS_IF insteadof plain if, but that seems like excessive caution given that this is thefirst time we have trouble like this. Plain if-then is more readable thanAS_IF.This should fix compilation with --disable-thread-safety, and hopefully thebuildfarm failure on forgmouth, related to mingw standard headers, too.I backpatched the previous fixes to 9.5, but it's starting to look likethese changes are too fiddly to backpatch, so commit this to master only,and revert all the pthread-related configure changes in 9.5.
1 parentbfb4cf1 commit01051a9

File tree

2 files changed

+149
-138
lines changed

2 files changed

+149
-138
lines changed

‎configure

Lines changed: 140 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -7626,7 +7626,142 @@ fi
76267626
# other libraries can pull in the pthread functions as a side-effect. We
76277627
# want to use the -pthread or similar flags directly, and not rely on
76287628
# the side-effects of linking with some other library.
7629-
iftest"$enable_thread_safety" = yes -a"$PORTNAME"!="win32";then
7629+
#
7630+
# note: We have to use AS_IF here rather than plain if. The AC_CHECK_HEADER
7631+
# invocation below is the first one in the script, and autoconf generates
7632+
# additional code for that, which must not be inside the if-block. AS_IF
7633+
# knows how to do that.
7634+
{$as_echo"$as_me:${as_lineno-$LINENO}: checking for ANSI C header files">&5
7635+
$as_echo_n"checking for ANSI C header files...">&6; }
7636+
if${ac_cv_header_stdc+:}false;then:
7637+
$as_echo_n"(cached)">&6
7638+
else
7639+
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
7640+
/* end confdefs.h. */
7641+
#include <stdlib.h>
7642+
#include <stdarg.h>
7643+
#include <string.h>
7644+
#include <float.h>
7645+
7646+
int
7647+
main ()
7648+
{
7649+
7650+
;
7651+
return 0;
7652+
}
7653+
_ACEOF
7654+
if ac_fn_c_try_compile"$LINENO";then:
7655+
ac_cv_header_stdc=yes
7656+
else
7657+
ac_cv_header_stdc=no
7658+
fi
7659+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
7660+
7661+
iftest$ac_cv_header_stdc = yes;then
7662+
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
7663+
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
7664+
/* end confdefs.h. */
7665+
#include <string.h>
7666+
7667+
_ACEOF
7668+
if (eval"$ac_cpp conftest.$ac_ext")2>&5|
7669+
$EGREP"memchr">/dev/null2>&1;then:
7670+
7671+
else
7672+
ac_cv_header_stdc=no
7673+
fi
7674+
rm -f conftest*
7675+
7676+
fi
7677+
7678+
iftest$ac_cv_header_stdc = yes;then
7679+
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
7680+
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
7681+
/* end confdefs.h. */
7682+
#include <stdlib.h>
7683+
7684+
_ACEOF
7685+
if (eval"$ac_cpp conftest.$ac_ext")2>&5|
7686+
$EGREP"free">/dev/null2>&1;then:
7687+
7688+
else
7689+
ac_cv_header_stdc=no
7690+
fi
7691+
rm -f conftest*
7692+
7693+
fi
7694+
7695+
iftest$ac_cv_header_stdc = yes;then
7696+
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
7697+
iftest"$cross_compiling" = yes;then:
7698+
:
7699+
else
7700+
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
7701+
/* end confdefs.h. */
7702+
#include <ctype.h>
7703+
#include <stdlib.h>
7704+
#if ((' ' & 0x0FF) == 0x020)
7705+
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
7706+
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
7707+
#else
7708+
# define ISLOWER(c)\
7709+
(('a' <= (c) && (c) <= 'i')\
7710+
|| ('j' <= (c) && (c) <= 'r')\
7711+
|| ('s' <= (c) && (c) <= 'z'))
7712+
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
7713+
#endif
7714+
7715+
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
7716+
int
7717+
main ()
7718+
{
7719+
int i;
7720+
for (i = 0; i < 256; i++)
7721+
if (XOR (islower (i), ISLOWER (i))
7722+
|| toupper (i) != TOUPPER (i))
7723+
return 2;
7724+
return 0;
7725+
}
7726+
_ACEOF
7727+
if ac_fn_c_try_run"$LINENO";then:
7728+
7729+
else
7730+
ac_cv_header_stdc=no
7731+
fi
7732+
rm -f core*.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
7733+
conftest.$ac_objext conftest.beam conftest.$ac_ext
7734+
fi
7735+
7736+
fi
7737+
fi
7738+
{$as_echo"$as_me:${as_lineno-$LINENO}: result:$ac_cv_header_stdc">&5
7739+
$as_echo"$ac_cv_header_stdc">&6; }
7740+
iftest$ac_cv_header_stdc = yes;then
7741+
7742+
$as_echo"#define STDC_HEADERS 1">>confdefs.h
7743+
7744+
fi
7745+
7746+
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
7747+
forac_headerin sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
7748+
inttypes.h stdint.h unistd.h
7749+
do:
7750+
as_ac_Header=`$as_echo"ac_cv_header_$ac_header"|$as_tr_sh`
7751+
ac_fn_c_check_header_compile"$LINENO""$ac_header""$as_ac_Header""$ac_includes_default
7752+
"
7753+
ifevaltest\"x\$"$as_ac_Header"\" = x"yes";then:
7754+
cat>>confdefs.h<<_ACEOF
7755+
#define`$as_echo"HAVE_$ac_header"|$as_tr_cpp` 1
7756+
_ACEOF
7757+
7758+
fi
7759+
7760+
done
7761+
7762+
7763+
iftest"$enable_thread_safety" = yes -a"$PORTNAME"!="win32";then:
7764+
# then
76307765

76317766

76327767
ac_ext=c
@@ -8081,136 +8216,6 @@ _LIBS="$LIBS"
80818216
CFLAGS="$CFLAGS$PTHREAD_CFLAGS"
80828217
LIBS="$LIBS$PTHREAD_LIBS"
80838218

8084-
iftest"$PORTNAME"!="win32";then
8085-
{$as_echo"$as_me:${as_lineno-$LINENO}: checking for ANSI C header files">&5
8086-
$as_echo_n"checking for ANSI C header files...">&6; }
8087-
if${ac_cv_header_stdc+:}false;then:
8088-
$as_echo_n"(cached)">&6
8089-
else
8090-
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
8091-
/* end confdefs.h. */
8092-
#include <stdlib.h>
8093-
#include <stdarg.h>
8094-
#include <string.h>
8095-
#include <float.h>
8096-
8097-
int
8098-
main ()
8099-
{
8100-
8101-
;
8102-
return 0;
8103-
}
8104-
_ACEOF
8105-
if ac_fn_c_try_compile"$LINENO";then:
8106-
ac_cv_header_stdc=yes
8107-
else
8108-
ac_cv_header_stdc=no
8109-
fi
8110-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
8111-
8112-
iftest$ac_cv_header_stdc = yes;then
8113-
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
8114-
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
8115-
/* end confdefs.h. */
8116-
#include <string.h>
8117-
8118-
_ACEOF
8119-
if (eval"$ac_cpp conftest.$ac_ext")2>&5|
8120-
$EGREP"memchr">/dev/null2>&1;then:
8121-
8122-
else
8123-
ac_cv_header_stdc=no
8124-
fi
8125-
rm -f conftest*
8126-
8127-
fi
8128-
8129-
iftest$ac_cv_header_stdc = yes;then
8130-
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
8131-
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
8132-
/* end confdefs.h. */
8133-
#include <stdlib.h>
8134-
8135-
_ACEOF
8136-
if (eval"$ac_cpp conftest.$ac_ext")2>&5|
8137-
$EGREP"free">/dev/null2>&1;then:
8138-
8139-
else
8140-
ac_cv_header_stdc=no
8141-
fi
8142-
rm -f conftest*
8143-
8144-
fi
8145-
8146-
iftest$ac_cv_header_stdc = yes;then
8147-
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
8148-
iftest"$cross_compiling" = yes;then:
8149-
:
8150-
else
8151-
cat confdefs.h -<<_ACEOF >conftest.$ac_ext
8152-
/* end confdefs.h. */
8153-
#include <ctype.h>
8154-
#include <stdlib.h>
8155-
#if ((' ' & 0x0FF) == 0x020)
8156-
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
8157-
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
8158-
#else
8159-
# define ISLOWER(c)\
8160-
(('a' <= (c) && (c) <= 'i')\
8161-
|| ('j' <= (c) && (c) <= 'r')\
8162-
|| ('s' <= (c) && (c) <= 'z'))
8163-
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
8164-
#endif
8165-
8166-
#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
8167-
int
8168-
main ()
8169-
{
8170-
int i;
8171-
for (i = 0; i < 256; i++)
8172-
if (XOR (islower (i), ISLOWER (i))
8173-
|| toupper (i) != TOUPPER (i))
8174-
return 2;
8175-
return 0;
8176-
}
8177-
_ACEOF
8178-
if ac_fn_c_try_run"$LINENO";then:
8179-
8180-
else
8181-
ac_cv_header_stdc=no
8182-
fi
8183-
rm -f core*.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
8184-
conftest.$ac_objext conftest.beam conftest.$ac_ext
8185-
fi
8186-
8187-
fi
8188-
fi
8189-
{$as_echo"$as_me:${as_lineno-$LINENO}: result:$ac_cv_header_stdc">&5
8190-
$as_echo"$ac_cv_header_stdc">&6; }
8191-
iftest$ac_cv_header_stdc = yes;then
8192-
8193-
$as_echo"#define STDC_HEADERS 1">>confdefs.h
8194-
8195-
fi
8196-
8197-
# On IRIX 5.3, sys/types and inttypes.h are conflicting.
8198-
forac_headerin sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
8199-
inttypes.h stdint.h unistd.h
8200-
do:
8201-
as_ac_Header=`$as_echo"ac_cv_header_$ac_header"|$as_tr_sh`
8202-
ac_fn_c_check_header_compile"$LINENO""$ac_header""$as_ac_Header""$ac_includes_default
8203-
"
8204-
ifevaltest\"x\$"$as_ac_Header"\" = x"yes";then:
8205-
cat>>confdefs.h<<_ACEOF
8206-
#define`$as_echo"HAVE_$ac_header"|$as_tr_cpp` 1
8207-
_ACEOF
8208-
8209-
fi
8210-
8211-
done
8212-
8213-
82148219
ac_fn_c_check_header_mongrel"$LINENO""pthread.h""ac_cv_header_pthread_h""$ac_includes_default"
82158220
iftest"x$ac_cv_header_pthread_h" = xyes;then:
82168221

@@ -8220,7 +8225,6 @@ pthread.h not found; use --disable-thread-safety to disable thread safety" "$LI
82208225
fi
82218226

82228227

8223-
fi
82248228

82258229
forac_funcin strerror_r getpwuid_r gethostbyname_r
82268230
do:
@@ -8276,11 +8280,14 @@ fi
82768280
CFLAGS="$_CFLAGS"
82778281
LIBS="$_LIBS"
82788282

8283+
82798284
else
8285+
# else
82808286
# do not use values from template file
82818287
PTHREAD_CFLAGS=
82828288
PTHREAD_LIBS=
8283-
fi
8289+
8290+
fi# fi
82848291

82858292

82868293

‎configure.in

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,13 @@ fi
961961
# other libraries can pull in the pthread functions as a side-effect. We
962962
# want to use the -pthread or similar flags directly, and not rely on
963963
# the side-effects of linking with some other library.
964-
if test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"; then
964+
#
965+
# note: We have to use AS_IF here rather than plain if. The AC_CHECK_HEADER
966+
# invocation below is the first one in the script, and autoconf generates
967+
# additional code for that, which must not be inside the if-block. AS_IF
968+
# knows how to do that.
969+
AS_IF([test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"],
970+
[ # then
965971
AX_PTHREAD# set thread flags
966972

967973
# Some platforms use these, so just define them. They can't hurt if they
@@ -975,10 +981,8 @@ _LIBS="$LIBS"
975981
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
976982
LIBS="$LIBS $PTHREAD_LIBS"
977983

978-
if test "$PORTNAME" != "win32"; then
979984
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([
980985
pthread.h not found; use --disable-thread-safety to disable thread safety])])
981-
fi
982986

983987
AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
984988

@@ -988,11 +992,11 @@ PGAC_FUNC_STRERROR_R_INT
988992
CFLAGS="$_CFLAGS"
989993
LIBS="$_LIBS"
990994

991-
else
995+
], [ #else
992996
# do not use values from template file
993997
PTHREAD_CFLAGS=
994998
PTHREAD_LIBS=
995-
fi
999+
]) #fi
9961000

9971001
AC_SUBST(PTHREAD_CFLAGS)
9981002
AC_SUBST(PTHREAD_LIBS)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp