summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2012-02-17 13:10:14 +0100
committerDavid Tardon <dtardon@redhat.com>2012-02-17 15:53:58 +0100
commit12c35f511e7d2ff74113f307212b6b422898b0f2 (patch)
tree0f84872234721c5df89ffdc04709ee9a3b3a559f
parent1a1c6f8f8e7850741d7d8a31c0f62beae7820a37 (diff)
add macro for extracting mingw dll names from libtool files
Hardcoding dll names from SuSE Linux in configure.in is not good, because they might be slightly different on other systems (notably Fedora :-), or the libraries might be compiled with different dependencies.
-rwxr-xr-xautogen.sh6
-rw-r--r--m4/mingw.m461
2 files changed, 66 insertions, 1 deletions
diff --git a/autogen.sh b/autogen.sh
index f423fe19b867..d41ccdd91928 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -125,7 +125,11 @@ sanity_checks ($system) unless($system eq 'Darwin');
my $aclocal_flags = $ENV{ACLOCAL_FLAGS};
-$aclocal_flags = "-I ./m4/mac" if (($aclocal_flags eq "") && ($system eq 'Darwin'));
+if ($aclocal_flags eq "")
+{
+ $aclocal_flags = "-I ./m4";
+ $aclocal_flags .= " -I ./m4/mac" if ($system eq 'Darwin');
+}
$ENV{AUTOMAKE_EXTRA_FLAGS} = '--warnings=no-portability' if (!($system eq 'Darwin'));
diff --git a/m4/mingw.m4 b/m4/mingw.m4
new file mode 100644
index 000000000000..cd0f38fc62b1
--- /dev/null
+++ b/m4/mingw.m4
@@ -0,0 +1,61 @@
+# libo_FIND_MINGW_EXTERNAL_DLLS([library-names],[variable],[?exclude])
+# uses: CC, WITH_MINGW
+# --------------------------------------------------------------------
+AC_DEFUN([libo_FIND_MINGW_EXTERNAL_DLLS],
+[AC_REQUIRE([AC_PROG_SED])dnl
+if test "$WITH_MINGW" = yes -a -n "$CC"; then
+ _libo_mingw_libdir=`$CC -print-sysroot`/mingw/lib
+ for _libo_mingw_lib in $1; do
+ _libo_mingw_lib="$_libo_mingw_libdir/$_libo_mingw_lib.la"
+ _libo_mingw_find_dll([$_libo_mingw_lib],[$3],[_libo_mingw_new_dll])
+ if test -n "$_libo_mingw_new_dll"; then
+ _libo_mingw_new_dlls="$_libo_mingw_new_dll"
+ fi
+
+ _libo_mingw_get_libtool_var([dependency_libs],[$_libo_mingw_lib],[_libo_mingw_dep_libs])
+ for _libo_mingw_dep_lib in $_libo_mingw_dep_libs; do
+ if test "${_libo_mingw_dep_lib%.la}" != "$_libo_mingw_dep_lib"; then
+ _libo_mingw_new_dll=''
+ _libo_mingw_find_dll([$_libo_mingw_dep_lib],[$3],[_libo_mingw_new_dll])
+ if test -n "$_libo_mingw_new_dll"; then
+ _libo_mingw_new_dlls="$_libo_mingw_new_dlls $_libo_mingw_new_dll"
+ fi
+ fi
+ done
+ $2="$_libo_mingw_new_dlls"
+ done
+fi[]dnl
+]) # libo_FIND_MINGW_EXTERNAL_DLLS
+
+# libo_ADD_MINGW_EXTERNAL_DLLS([library-names],[variable])
+# uses: CC, WITH_MINGW
+# --------------------------------------------------------
+AC_DEFUN([libo_ADD_MINGW_EXTERNAL_DLLS],
+[libo_FIND_MINGW_EXTERNAL_DLLS([$1],[_libo_mingw_found_dlls],[$$2])
+if test -n "$_libo_mingw_found_dlls"; then
+ $2="$$2 $_libo_mingw_found_dlls"
+fi[]dnl
+]) # libo_ADD_MINGW_EXTERNAL_DLLS
+
+# _libo_mingw_get_libtool_var([key],[lib],[out-var])
+m4_define([_libo_mingw_get_libtool_var],
+[$3=`$SED -n -e '/^$1=/{' -e "s/.*='//" -e "s/'//" -e p -e '}' $2`[]dnl
+]) # _libo_mingw_get_libtool_var
+
+# _libo_mingw_find_dll([library],[dlls],[out-var])
+m4_define([_libo_mingw_find_dll],
+[if test -f "$1"; then
+ _libo_mingw_get_libtool_var([dlname],[$1],[_libo_mingw_dlname])
+ _libo_mingw_dlname=`basename $_libo_mingw_dlname`
+ _libo_mingw_dll_present=
+ for _libo_mingw_dll in $2; do
+ if test "$_libo_mingw_dlname" = "$_libo_mingw_dll"; then
+ _libo_mingw_dll_present=yes
+ break
+ fi
+ done
+ if test -z "$_libo_mingw_dll_present"; then
+ $3="$_libo_mingw_dlname"
+ fi
+fi[]dnl
+]) # _libo_mingw_find_dll