diff mbox

Fix warning in libgfortran configure script

Message ID 53500619.2090006@arm.com
State New
Headers show

Commit Message

Kyrylo Tkachov April 17, 2014, 4:49 p.m. UTC
Hi all,

While configuring libgfortran I'm getting this message:
"libgfortran/configure: line 25938: test: =: unary operator expected"
The script doesn't fail and continues afterwards, but I don't think it's 
supposed to give that warning.
This patch makes it go away and makes it more consistent with other similar uses 
(a few lines below $ac_cv_lib_rt_clock_gettime is quoted when used in a test 
structure). configure.ac is updated and configure is regenerated with autoconf 2.64

Ok for trunk?

Make sure libgfortran builds for arm-none-eabi.

libgfortran/
2014-04-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     * configure.ac: Quote usage of ac_cv_func_clock_gettime in if test.
     * configure: Regenerate.

Comments

Richard Earnshaw April 23, 2014, 9:22 a.m. UTC | #1
On 17/04/14 17:49, Kyrill Tkachov wrote:
> Hi all,
> 
> While configuring libgfortran I'm getting this message:
> "libgfortran/configure: line 25938: test: =: unary operator expected"
> The script doesn't fail and continues afterwards, but I don't think it's 
> supposed to give that warning.
> This patch makes it go away and makes it more consistent with other similar uses 
> (a few lines below $ac_cv_lib_rt_clock_gettime is quoted when used in a test 
> structure). configure.ac is updated and configure is regenerated with autoconf 2.64
> 
> Ok for trunk?
> 
> Make sure libgfortran builds for arm-none-eabi.
> 
> libgfortran/
> 2014-04-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
> 
>      * configure.ac: Quote usage of ac_cv_func_clock_gettime in if test.
>      * configure: Regenerate.
> 

This looks fairly safe to me.  My only question might be "why isn't the
variable set to one of 'yes' or 'no'?"

OK unless the fortran maintainers chime in within 24 hours.

R.

> 
> libgfortran-configure.patch
> 
> 
> diff --git a/libgfortran/configure b/libgfortran/configure
> index 23f57c7..d3ced74 100755
> --- a/libgfortran/configure
> +++ b/libgfortran/configure
> @@ -25935,7 +25935,7 @@ fi
>  # test is copied from libgomp, and modified to not link in -lrt as
>  # libgfortran calls clock_gettime via a weak reference if it's found
>  # in librt.
> -if test $ac_cv_func_clock_gettime = no; then
> +if test "$ac_cv_func_clock_gettime" = no; then
>    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
>  $as_echo_n "checking for clock_gettime in -lrt... " >&6; }
>  if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then :
> diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
> index de2d65e..24dbf2b 100644
> --- a/libgfortran/configure.ac
> +++ b/libgfortran/configure.ac
> @@ -510,7 +510,7 @@ AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENA
>  # test is copied from libgomp, and modified to not link in -lrt as
>  # libgfortran calls clock_gettime via a weak reference if it's found
>  # in librt.
> -if test $ac_cv_func_clock_gettime = no; then
> +if test "$ac_cv_func_clock_gettime" = no; then
>    AC_CHECK_LIB(rt, clock_gettime,
>      [AC_DEFINE(HAVE_CLOCK_GETTIME_LIBRT, 1,
>                 [Define to 1 if you have the `clock_gettime' function in librt.])])
>
Marcus Shawcroft April 23, 2014, 1:28 p.m. UTC | #2
On 23 April 2014 10:22, Richard Earnshaw <rearnsha@arm.com> wrote:

>> libgfortran/
>> 2014-04-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
>>
>>      * configure.ac: Quote usage of ac_cv_func_clock_gettime in if test.
>>      * configure: Regenerate.
>>
>
> This looks fairly safe to me.  My only question might be "why isn't the
> variable set to one of 'yes' or 'no'?"

This is due to the newlib library detection kludgery further up the
file.  Rather than using autoconf to probe the interface, we detect
newlib, bypass the AC_CHECK_FUNC_ONCE() macro and hardwire the
interface.  This has the effect of leaving various ac_cv_func_*
variables undefined....

Cheers
/Marcus
diff mbox

Patch

diff --git a/libgfortran/configure b/libgfortran/configure
index 23f57c7..d3ced74 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -25935,7 +25935,7 @@  fi
 # test is copied from libgomp, and modified to not link in -lrt as
 # libgfortran calls clock_gettime via a weak reference if it's found
 # in librt.
-if test $ac_cv_func_clock_gettime = no; then
+if test "$ac_cv_func_clock_gettime" = no; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
 $as_echo_n "checking for clock_gettime in -lrt... " >&6; }
 if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then :
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index de2d65e..24dbf2b 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -510,7 +510,7 @@  AC_CHECK_LIB([m],[feenableexcept],[have_feenableexcept=yes AC_DEFINE([HAVE_FEENA
 # test is copied from libgomp, and modified to not link in -lrt as
 # libgfortran calls clock_gettime via a weak reference if it's found
 # in librt.
-if test $ac_cv_func_clock_gettime = no; then
+if test "$ac_cv_func_clock_gettime" = no; then
   AC_CHECK_LIB(rt, clock_gettime,
     [AC_DEFINE(HAVE_CLOCK_GETTIME_LIBRT, 1,
                [Define to 1 if you have the `clock_gettime' function in librt.])])