1 dnl Version: MPL 1.1 / GPLv3+ / LGPLv3+
3 dnl The contents of this file are subject to the Mozilla Public License Version
4 dnl 1.1 (the "License"); you may not use this file except in compliance with
5 dnl the License or as specified alternatively below. You may obtain a copy of
6 dnl the License at http://www.mozilla.org/MPL/
8 dnl Software distributed under the License is distributed on an "AS IS" basis,
9 dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10 dnl for the specific language governing rights and limitations under the
13 dnl Major Contributor(s):
14 dnl Copyright (C) 2012 Red Hat, Inc., David Tardon <dtardon@redhat.com>
15 dnl (initial developer)
17 dnl All Rights Reserved.
19 dnl For minor contributions see the git repository.
21 dnl Alternatively, the contents of this file may be used under the terms of
22 dnl either the GNU General Public License Version 3 or later (the "GPLv3+"), or
23 dnl the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
24 dnl in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
25 dnl instead of those above.
27 # libo_MINGW_CHECK_DLL(variable-infix,dll-name-stem,[action-if-found],[action-if-not-found])
29 # Checks for presence of dll dll-name-stem . Sets variable
30 # MINGW_variable-infix_DLL if found, issues an error otherwise.
32 # It recognizes these dll patterns (x, y match any character, but they
33 # are supposed to be numerals):
41 # libo_MINGW_CHECK_DLL([EXPAT], [libexpat])
42 # might result in MINGW_EXPAT_DLL=libexpat-1.dll being set.
45 # ------------------------------------------------------------------------------------------
46 AC_DEFUN([libo_MINGW_CHECK_DLL],
47 [AC_ARG_VAR([MINGW_][$1][_DLL],[output variable containing the found dll name])dnl
49 if test -n "$WITH_MINGW"; then
50 dnl TODO move this to configure: there is no need to call $CC more than once
51 _libo_mingw_dlldir=`$CC -print-sysroot`/mingw/bin
53 AC_MSG_CHECKING([for $2 dll])
55 dnl try one- or two-numbered version
56 _libo_mingw_try_dll([$2][-?.dll])
57 if test "$_libo_mingw_dllname" = ""; then
58 _libo_mingw_try_dll([$2][-??.dll])
60 dnl maybe the version contains a dot (e.g., libdb)
61 if test "$_libo_mingw_dllname" = ""; then
62 _libo_mingw_try_dll([$2][-?.?.dll])
64 dnl maybe the version contains a dash (e.g., libpixman)
65 if test "$_libo_mingw_dllname" = ""; then
66 _libo_mingw_try_dll([$2][-?-?.dll])
68 dnl maybe it is not versioned
69 if test "$_libo_mingw_dllname" = ""; then
70 _libo_mingw_try_dll([$2][.dll])
73 if test "$_libo_mingw_dllname" = ""; then
75 m4_default([$4],[AC_MSG_ERROR([no dll found for $2])])
77 AC_MSG_RESULT([$_libo_mingw_dllname])
78 [MINGW_][$1][_DLL]="$_libo_mingw_dllname"
82 ]) # libo_MINGW_CHECK_DLL
84 # libo_MINGW_TRY_DLL(variable-infix,dll-name-stem)
86 # Checks for presence of dll dll-name-stem . Sets variable
87 # MINGW_variable-infix_DLL if found, does nothing otherwise.
89 # See libo_MINGW_CHECK_DLL for further info.
92 # ------------------------------------------------
93 AC_DEFUN([libo_MINGW_TRY_DLL],
94 [dnl shortcut: do not test for already found dlls
95 if test -z "$[MINGW_][$1][_DLL]"; then
96 libo_MINGW_CHECK_DLL([$1],[$2],[[]],[[]])
98 ]) # libo_MINGW_TRY_DLL
100 # _libo_mingw_try_dll(dll-name,dll-dir)
101 m4_define([_libo_mingw_try_dll],
102 [_libo_mingw_trying_dll=`ls "[$_libo_mingw_dlldir]"/[$1] 2>/dev/null`
103 if test -f "$_libo_mingw_trying_dll"; then
104 _libo_mingw_dllname=`basename "$_libo_mingw_trying_dll"`
106 ]) # _libo_mingw_try_dll
108 dnl vim:set shiftwidth=4 softtabstop=4 expandtab: