Skip to content

Commit f2ce76a

Browse files
committed
patch 9.0.0023: on Solaris timer_create() exists but does not work
Problem: On Solaris timer_create() exists but does not work. Solution: Adjust the configure check to run the test program. (closes #10647)
1 parent 95afae6 commit f2ce76a

3 files changed

Lines changed: 37 additions & 13 deletions

File tree

src/auto/configure

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13041,7 +13041,13 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1304113041
$as_echo_n "checking for timer_create... " >&6; }
1304213042
save_LIBS="$LIBS"
1304313043
LIBS="$LIBS -lrt"
13044-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
13044+
if test "$cross_compiling" = yes; then :
13045+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
13046+
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
13047+
as_fn_error $? "cannot run test program while cross compiling
13048+
See \`config.log' for more details" "$LINENO" 5; }
13049+
else
13050+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1304513051
/* end confdefs.h. */
1304613052
1304713053
#include<signal.h>
@@ -13058,18 +13064,25 @@ main ()
1305813064
1305913065
action.sigev_notify = SIGEV_THREAD;
1306013066
action.sigev_notify_function = set_flag;
13061-
timer_create(CLOCK_REALTIME, &action, &timer_id);
13067+
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
13068+
exit(1); // cannot create a monotonic timer
1306213069
1306313070
;
1306413071
return 0;
1306513072
}
1306613073
_ACEOF
13067-
if ac_fn_c_try_link "$LINENO"; then :
13074+
if ac_fn_c_try_run "$LINENO"; then :
1306813075
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes; with -lrt" >&5
1306913076
$as_echo "yes; with -lrt" >&6; }; $as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
1307013077

1307113078
else
1307213079
LIBS="$save_LIBS"
13080+
if test "$cross_compiling" = yes; then :
13081+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
13082+
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
13083+
as_fn_error $? "cannot run test program while cross compiling
13084+
See \`config.log' for more details" "$LINENO" 5; }
13085+
else
1307313086
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
1307413087
/* end confdefs.h. */
1307513088
@@ -13087,25 +13100,30 @@ main ()
1308713100
1308813101
action.sigev_notify = SIGEV_THREAD;
1308913102
action.sigev_notify_function = set_flag;
13090-
timer_create(CLOCK_REALTIME, &action, &timer_id);
13103+
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
13104+
exit(1); // cannot create a monotonic timer
1309113105
1309213106
;
1309313107
return 0;
1309413108
}
1309513109
_ACEOF
13096-
if ac_fn_c_try_link "$LINENO"; then :
13110+
if ac_fn_c_try_run "$LINENO"; then :
1309713111
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1309813112
$as_echo "yes" >&6; }; $as_echo "#define HAVE_TIMER_CREATE 1" >>confdefs.h
1309913113

1310013114
else
1310113115
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1310213116
$as_echo "no" >&6; }
1310313117
fi
13104-
rm -f core conftest.err conftest.$ac_objext \
13105-
conftest$ac_exeext conftest.$ac_ext
13118+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
13119+
conftest.$ac_objext conftest.beam conftest.$ac_ext
1310613120
fi
13107-
rm -f core conftest.err conftest.$ac_objext \
13108-
conftest$ac_exeext conftest.$ac_ext
13121+
13122+
fi
13123+
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
13124+
conftest.$ac_objext conftest.beam conftest.$ac_ext
13125+
fi
13126+
1310913127

1311013128
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat() ignores a trailing slash" >&5
1311113129
$as_echo_n "checking whether stat() ignores a trailing slash... " >&6; }

src/configure.ac

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,10 +3805,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
38053805
AC_MSG_RESULT(no))
38063806

38073807
dnl Check for timer_create. It probably requires the 'rt' library.
3808+
dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually
3809+
dnl works, on Solaris timer_create() exists but fails at runtime.
38083810
AC_MSG_CHECKING([for timer_create])
38093811
save_LIBS="$LIBS"
38103812
LIBS="$LIBS -lrt"
3811-
AC_LINK_IFELSE([AC_LANG_PROGRAM([
3813+
AC_RUN_IFELSE([AC_LANG_PROGRAM([
38123814
#include<signal.h>
38133815
#include<time.h>
38143816
static void set_flag(union sigval sv) {}
@@ -3819,11 +3821,12 @@ static void set_flag(union sigval sv) {}
38193821
38203822
action.sigev_notify = SIGEV_THREAD;
38213823
action.sigev_notify_function = set_flag;
3822-
timer_create(CLOCK_REALTIME, &action, &timer_id);
3824+
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3825+
exit(1); // cannot create a monotonic timer
38233826
])],
38243827
AC_MSG_RESULT(yes; with -lrt); AC_DEFINE(HAVE_TIMER_CREATE),
38253828
LIBS="$save_LIBS"
3826-
AC_LINK_IFELSE([AC_LANG_PROGRAM([
3829+
AC_RUN_IFELSE([AC_LANG_PROGRAM([
38273830
#include<signal.h>
38283831
#include<time.h>
38293832
static void set_flag(union sigval sv) {}
@@ -3834,7 +3837,8 @@ static void set_flag(union sigval sv) {}
38343837
38353838
action.sigev_notify = SIGEV_THREAD;
38363839
action.sigev_notify_function = set_flag;
3837-
timer_create(CLOCK_REALTIME, &action, &timer_id);
3840+
if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0)
3841+
exit(1); // cannot create a monotonic timer
38383842
])],
38393843
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIMER_CREATE),
38403844
AC_MSG_RESULT(no)))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static char *(features[]) =
735735

736736
static int included_patches[] =
737737
{ /* Add new patch number below this line */
738+
/**/
739+
23,
738740
/**/
739741
22,
740742
/**/

0 commit comments

Comments
 (0)