ref: 47065fcecfff15c7c22837df86092b67c6382a48
parent: 0943845e34bcc495464d038086a3cf8d5b9e0674
author: Ulrich Klauer <ulrich@chirlu.de>
date: Fri Apr 6 13:19:46 EDT 2012
Add OpenMP linker workaround for older libtools libtool version < 2.4 does not pass on the OpenMP option (-fopenmp or similar) to the linker. This workaround specifies -lgomp directly if the compiler is gcc and deactivates OpenMP otherwise. It is better to upgrade libtool, of course.
--- a/configure.ac
+++ b/configure.ac
@@ -208,6 +208,28 @@
dnl Check for OpenMP
AC_OPENMP
+if test "x$OPENMP_CFLAGS" != "x"; then dnl Old libtool workaround start
+ AC_MSG_CHECKING([for libtool version])
+ lt_version="`grep '^VERSION' $srcdir/ltmain.sh | sed -e 's/VERSION\=//g;s/ .*//g;s/[[-.a-zA-Z\"]]//g'`"
+ if test $lt_version -lt 100; then
+ lt_version=`expr $lt_version \* 10`
+ fi
+ if test $lt_version -lt 240; then
+ if test "$GCC" = "yes"; then
+ AC_MSG_RESULT([$lt_version, needs OpenMP linker workaround])
+ GOMP_LIBS="-lgomp"
+ else
+ AC_MSG_RESULT([$lt_version and not GCC, deactivating OpenMP])
+ OPENMP_CFLAGS=""
+ fi
+ else
+ AC_MSG_RESULT([$lt_version, OK])
+ fi
+fi
+AC_SUBST(GOMP_LIBS) dnl Old libtool workaround end.
+ dnl Only necessary if libtool version < 2.4, as older
+ dnl versions don't pass on "-fopenmp" to the linker.
+ dnl One day, replace with LT_PREREQ([2.4]) above.
CFLAGS="$CFLAGS $OPENMP_CFLAGS"
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,6 +90,8 @@
libsox_la_LIBADD += @MAGIC_LIBS@
endif
+libsox_la_LIBADD += @GOMP_LIBS@
+
libsox_la_CFLAGS = @WARN_CFLAGS@
libsox_la_LDFLAGS = @APP_LDFLAGS@ -version-info @SHLIB_VERSION@