[x264-devel] Have configure script define libm variable if present

Brad Smith brad at comstyle.com
Sun Aug 26 16:47:08 CEST 2012


On Sat, Aug 25, 2012 at 06:23:35AM -0700, Jason Garrett-Glaser wrote:
> On Sat, Aug 25, 2012 at 6:14 AM, Brad Smith <brad at comstyle.com> wrote:
> > On Tue, Aug 21, 2012 at 12:09:43PM +0300, Georgi Chorbadzhiyski wrote:
> >> On 8/21/12 10:30 AM, Brad Smith wrote:
> >> >Have the configure script set libm if the OS has libm. Idea
> >> >copied from libpthread and just move setting LDFLAGS to below
> >> >the OS case check. I also did this to be able to use $libm in
> >> >another diff I'll send after this.
> >> >
> >> >
> >> >diff --git a/configure b/configure
> >> >index 086b399..5b18b1b 100755
> >> >--- a/configure
> >> >+++ b/configure
> >> >@@ -448,6 +448,7 @@ else
> >> >      fi
> >> >  fi
> >> >
> >> >+libm=""
> >> >  case $host_os in
> >> >      beos*)
> >> >          SYS="BEOS"
> >> >@@ -456,37 +457,37 @@ case $host_os in
> >> >      darwin*)
> >> >          SYS="MACOSX"
> >> >          CFLAGS="$CFLAGS -falign-loops=16"
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          if [ "$pic" = "no" ]; then
> >> >              cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic"
> >> >          fi
> >> >          ;;
> >> >      freebsd*)
> >> >          SYS="FREEBSD"
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          ;;
> >> >      kfreebsd*-gnu)
> >> >          SYS="FREEBSD"
> >> >          define HAVE_MALLOC_H
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          ;;
> >> >      netbsd*)
> >> >          SYS="NETBSD"
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          ;;
> >> >      openbsd*)
> >> >          SYS="OPENBSD"
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          ;;
> >> >      *linux*)
> >> >          SYS="LINUX"
> >> >          define HAVE_MALLOC_H
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          ;;
> >> >      gnu*)
> >> >          SYS="HURD"
> >> >          define HAVE_MALLOC_H
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          ;;
> >> >      cygwin*)
> >> >          EXE=".exe"
> >> >@@ -512,7 +513,7 @@ case $host_os in
> >> >      sunos*|solaris*)
> >> >          SYS="SunOS"
> >> >          define HAVE_MALLOC_H
> >> >-        LDFLAGS="$LDFLAGS -lm"
> >> >+        libm="-lm"
> >> >          if cc_check "" /usr/lib/64/values-xpg6.o; then
> >> >              LDFLAGS="$LDFLAGS /usr/lib/64/values-xpg6.o"
> >> >          else
> >> >@@ -525,6 +526,8 @@ case $host_os in
> >> >          ;;
> >> >  esac
> >> >
> >> >+LDFLAGS="$LDFLAGS $libm"
> >> >+
> >> >  case $host_cpu in
> >> >      i*86)
> >> >          ARCH="X86"
> >> >
> >>
> >> It would be nicer if libm is set by default to -lm and then only
> >> platforms that have named this library differently, would need
> >> to change it?
> >
> > Either way would be fine with me and I can understand the appeal
> > of your suggestion as you can just clear the libm variable for
> > the OS's without a libm. OS's without libm are the exception.
> >
> > Jason, any comments?
> 
> I don't have the experience/expertise to say anything meaningful about
> this kind of configure stuff, so I'll let other people decide.

OK can we just go with my initial patch since it follows as closely to
the original behavior of the code that it was replacing and just filling
in the libm variable as necessary? If anyone wants to change it later
that's fine.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the x264-devel mailing list