view m4/perl.m4 @ 17627:4d899884c95c

m4: fix gl_TIMER_TIME() detection of threads on uClibc The timer_time.m4 gl_TIMER_TIME function determines which libraries need to be linked to get access to the timer function, generally -lrt for Linux systems. On platforms where threads are used, librt typically uses thread functions from libpthread. However, the test to determine whether the platform has thread or not is incorrect: it assumes that if the C library is uClibc, then threads are not available. This is actually not true: uClibc has configurable thread support, and when thread support is available, librt calls libpthread functions. This is important when static linking is used, because otherwise only -lrt is used at link time, which fails because librt calls undefined thread functions. Both -lrt and -lpthread must be passed. This problem is fixed by making the uClibc thread detection a bit smarter, thanks to the usage of the __HAS_NO_THREADS__ macro defined in <bits/uClibc_config.h>, which itself is included by <features.h>. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Eric Blake <eblake@redhat.com>
author Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
date Sat, 22 Feb 2014 00:41:38 +0100
parents 344018b6e5d7
children
line wrap: on
line source

# serial 9

dnl From Jim Meyering.
dnl Find a new-enough version of Perl.

# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2014 Free Software Foundation,
# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

AC_DEFUN([gl_PERL],
[
  dnl FIXME: don't hard-code 5.005
  AC_MSG_CHECKING([for perl5.005 or newer])
  if test "${PERL+set}" = set; then
    # 'PERL' is set in the user's environment.
    candidate_perl_names="$PERL"
    perl_specified=yes
  else
    candidate_perl_names='perl perl5'
    perl_specified=no
  fi

  found=no
  AC_SUBST([PERL])
  PERL="$am_missing_run perl"
  for perl in $candidate_perl_names; do
    # Run test in a subshell; some versions of sh will print an error if
    # an executable is not found, even if stderr is redirected.
    if ( $perl -e 'require 5.005; use File::Compare' ) > /dev/null 2>&1; then
      PERL=$perl
      found=yes
      break
    fi
  done

  AC_MSG_RESULT([$found])
  test $found = no && AC_MSG_WARN([
WARNING: You don't seem to have perl5.005 or newer installed, or you lack
         a usable version of the Perl File::Compare module.  As a result,
         you may be unable to run a few tests or to regenerate certain
         files if you modify the sources from which they are derived.
] )
])