* Moved detection of monotonic clock support to the configure script, which also checks, whether or not it actually works (bugreport:1003, related r11912 and r11983).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14767 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
153
configure
vendored
153
configure
vendored
@@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.in Revision: 14708 .
|
||||
# From configure.in Revision: 14767 .
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59.
|
||||
#
|
||||
@@ -4884,16 +4884,15 @@ fi
|
||||
|
||||
|
||||
#
|
||||
# clock_gettime (rt on Debian)
|
||||
# clock_gettime (optional, rt on Debian)
|
||||
#
|
||||
|
||||
echo "$as_me:$LINENO: checking for clock_gettime in -lrt" >&5
|
||||
echo $ECHO_N "checking for clock_gettime in -lrt... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then
|
||||
echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
|
||||
echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6
|
||||
if test "${ac_cv_search_clock_gettime+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lrt $LIBS"
|
||||
ac_func_search_save_LIBS=$LIBS
|
||||
ac_cv_search_clock_gettime=no
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
@@ -4938,30 +4937,148 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_rt_clock_gettime=yes
|
||||
ac_cv_search_clock_gettime="none required"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_rt_clock_gettime=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_rt_clock_gettime" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_rt_clock_gettime" >&6
|
||||
if test $ac_cv_lib_rt_clock_gettime = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_LIBRT 1
|
||||
if test "$ac_cv_search_clock_gettime" = no; then
|
||||
for ac_lib in rt; do
|
||||
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
LIBS="-lrt $LIBS"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char clock_gettime ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
clock_gettime ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_search_clock_gettime="-l$ac_lib"
|
||||
break
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
done
|
||||
fi
|
||||
LIBS=$ac_func_search_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5
|
||||
echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6
|
||||
if test "$ac_cv_search_clock_gettime" != no; then
|
||||
test "$ac_cv_search_clock_gettime" = "none required" || LIBS="$ac_cv_search_clock_gettime $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#
|
||||
# CLOCK_MONOTONIC clock for clock_gettime
|
||||
# Normally defines _POSIX_TIMERS > 0 and _POSIX_MONOTONIC_CLOCK (for posix
|
||||
# compliant systems) and __FreeBSD_cc_version >= 500005 (for FreeBSD
|
||||
# >= 5.1.0, which does not have the posix defines (ref. r11983)) would be
|
||||
# checked but some systems define them even when they do not support it
|
||||
# (ref. bugreport:1003).
|
||||
#
|
||||
if test "$ac_cv_search_clock_gettime" != "no" ; then
|
||||
echo "$as_me:$LINENO: checking whether CLOCK_MONOTONIC is supported and works" >&5
|
||||
echo $ECHO_N "checking whether CLOCK_MONOTONIC is supported and works... $ECHO_C" >&6
|
||||
if test "$cross_compiling" = yes; then
|
||||
|
||||
echo "$as_me:$LINENO: result: guessing no" >&5
|
||||
echo "${ECHO_T}guessing no" >&6
|
||||
|
||||
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
struct timespec tval;
|
||||
return clock_gettime(CLOCK_MONOTONIC, &tval);
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
rm -f conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
CFLAGS="$CFLAGS -DHAVE_MONOTONIC_CLOCK"
|
||||
|
||||
else
|
||||
echo "$as_me: program exited with status $ac_status" >&5
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
( exit $ac_status )
|
||||
|
||||
# either it failed to compile (CLOCK_MONOTONIC undefined)
|
||||
# or clock_gettime has returned a non-zero value
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
|
||||
fi
|
||||
rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# MySQL library (optional)
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user