[x264-devel] Set libm in the configure script if the OS has libm

Brad Smith git at videolan.org
Thu Nov 8 00:55:02 CET 2012


x264 | branch: master | Brad Smith <brad at comstyle.com> | Mon Sep 10 17:52:04 2012 -0700| [b22f22fdb1f6d61ccc7b0c867b530322ea681133] | committer: Jason Garrett-Glaser

Set libm in the configure script if the OS has libm
Prerequisite for another configure patch after this.
Idea copied from libpthread.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=b22f22fdb1f6d61ccc7b0c867b530322ea681133
---

 configure |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index 01da01e..a9b5a83 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"



More information about the x264-devel mailing list