[Home]

Summary:ASTERISK-08272: [patch] fix check for curl-config and removed reduntant code
Reporter:Paul Belanger (pabelanger)Labels:
Date Opened:2006-12-04 09:42:49.000-0600Date Closed:2006-12-05 14:45:26.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) fix_curl-config_error.patch
Description:Here's a fix for the configure.sh that checks for curl-config.  The problem is around check the version numbers, which are in hex.  Bash doesn't seem to like this, so I've taken the values, converted them to decimal and the problem goes away.

Also, removed coded specific to the SunOS, as it was the exact same code we executed if it was NOT a SunOS too.

****** ADDITIONAL INFORMATION ******

we may need to add a check for 'dc' into the configure script, or if there is a better way to do this feel free to comment.
Comments:By: Paul Belanger (pabelanger) 2006-12-04 09:43:50.000-0600

Sorry guys, I put it into the wrong category.  Haven't had my morning coffee yet.

PB

By: Jason Parker (jparker) 2006-12-04 14:38:11.000-0600

What exactly is the problem here?  Do you get errors with this call?

The SunOS method and "other" method are different.  One uses [, the other uses [[

By: Paul Belanger (pabelanger) 2006-12-04 14:50:30.000-0600

Here is the error using the svn head.

checking for curl-config... /usr/local/bin/curl-config
[[: not found
checking for mandatory modules: ... ok

OSARCH: FreeBSD 6.1

replaceing [[ for [ in the if statement allowed me to see:
[: 0x070f05: bad number

so, I changed the value to decimal, problem solved.

By: Jason Parker (jparker) 2006-12-05 12:06:14.000-0600

Does simply quoting the values help?

By: Paul Belanger (pabelanger) 2006-12-05 12:10:53.000-0600

Same error, here is my test.sh:
---
#!/bin/sh

if [ "0x`curl-config --vernum`" -ge "0x70907" ]; then
  echo "something"
fi
---

From what I read the -ge express only works on binary values (http://www.museum.state.il.us/ismdepts/library/linuxguides/abs-guide/comparison-ops.html).

PB

By: Jason Parker (jparker) 2006-12-05 12:20:25.000-0600

You need to use [[ and ]] (at least on Linux)

By: Paul Belanger (pabelanger) 2006-12-05 12:57:45.000-0600

qwell: FreeBSD doesn't like the [[ in the expression:
[[: not found
But your right about the [[ on linux, no problems with the test.sh after I changed it.

So we are back to the original problem, [[ in the expression on FreeBSD does not work.

By: Jason Parker (jparker) 2006-12-05 13:00:17.000-0600

Confirmed that this doesn't work as expected (both in FreeBSD /bin/sh and Linux /bin/dash).  I'm trying to come up with a portable solution.

By: Jason Parker (jparker) 2006-12-05 13:24:24.000-0600

I propose the following...

if [ $(printf "%d" 0x$(curl-config --vernum)) -ge $(printf "%d" 0x070907) ]; then
   echo "blah";
fi


As far as I can tell, the printf commandline utility is part of the POSIX spec.

By: Paul Belanger (pabelanger) 2006-12-05 13:40:08.000-0600

Seems to work here.

By: Jason Parker (jparker) 2006-12-05 14:45:25.000-0600

Fixed in svn 1.4 and trunk, revisions 48279 and 48280.  configure scripts will be regenerated very shortly.