Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / ming.m4
blobc66dd19e64b8a8883a532fb0c398cec8bb4ddd80
1 dnl
2 dnl  Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl  2011 Free Software Foundation, Inc.
4 dnl
5 dnl  This program is free software; you can redistribute it and/or modify
6 dnl  it under the terms of the GNU General Public License as published by
7 dnl  the Free Software Foundation; either version 3 of the License, or
8 dnl  (at your option) any later version.
9 dnl
10 dnl  This program is distributed in the hope that it will be useful,
11 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl  GNU General Public License for more details.
14 dnl  You should have received a copy of the GNU General Public License
15 dnl  along with this program; if not, write to the Free Software
16 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 dnl
19 # Configure paths for Ming
20 # Author: Sandro Santilli <strk@keybit.net>
22 # This macro uses ming-config, which was
23 # not available as of Ming 0.3beta1
26 # Use: 
27 #       AC_PATH_MING
29 # Provides:
30 #       MING_VERSION      - Ming version string (example: "0.4.1" or "0.4.0.beta2")
31 #       MING_VERSION_CODE - a 8digits number encoding Major, Minor, Patch and Beta numbers.
32 #                           examples: 00040002 (0.4.0.beta2) 00040100 (0.4.1)
33 #       MING_CFLAGS
34 #       MING_LIBS
35 #       MAKESWF
38 AC_DEFUN([AC_PATH_MING], [
39   MING_CFLAGS=""
40   MING_LIBS=""
42   AC_ARG_WITH(ming,[  --with-ming=[<ming-config>]    Path to the ming-config command], [
43     case "${withval}" in
44       yes|no) ;;
45       *) MING_CONFIG=${withval} ;;
46     esac
47   ], MING_CONFIG="")
49   if test x"$MING_CONFIG" = "x"; then
50     AC_PATH_PROG(MING_CONFIG, ming-config, ,[${pathlist}])
51   fi
53   if test x"$MING_CONFIG" != "x"; then
54     MING_VERSION=`$MING_CONFIG --version`
55     major=`echo $MING_VERSION | cut -d '.' -f 1`
56     minor=`echo $MING_VERSION | cut -d '.' -f 2`
57     micro=`echo $MING_VERSION | cut -d '.' -f 3`
58     beta=`echo $MING_VERSION | sed -ne 's/.*beta\([[0-9]]*\).*/\1/p'`
59     dnl This is a little screwy. The previous Ming release was tagged beta5,
60     dnl but the newer one is tagged rc1. This makes it look like rc1 is older the
61     dnl beta 5 release, as it only looks at the last integer. So we fudge the
62     dnl numbers so tc1 comes after beta 5. ie.. this looks like beta 6.
63     if test -z $beta; then
64       beta=`echo $MING_VERSION | sed -ne 's/.*rc\([[0-9]]*\).*/\1/p'`
65       if test x"$beta" != x; then
66         beta=`eval expr $beta + 5`
67       fi
68     fi
69     MING_VERSION_CODE=`printf %2.2d%2.2d%2.2d%2.2d $major $minor $micro $beta`
70     MING_CFLAGS=`$MING_CONFIG --cflags`
71     MING_LIBS=`$MING_CONFIG --libs`
72     MING_PATH=`$MING_CONFIG --bindir`
73     AC_PATH_PROG([MAKESWF], [makeswf], , [$MING_PATH:$PATH])
74   fi
76   dnl if MING_LIBS is empty, no MING_CONFIG found.
77   if test x"${MING_LIBS}" = x; then
78     AC_ARG_WITH(ming_incl, AC_HELP_STRING([--with-ming-incl], [Directory where Ming header is]), with_ming_incl=${withval})
79     AC_CACHE_VAL(ac_cv_path_ming_incl, [
80       if test x"${with_ming_incl}" != x ; then
81         if test -f ${with_ming_incl}/ming.h ; then
82           ac_cv_path_ming_incl="-I`(cd ${with_ming_incl}; pwd)`"
83         else
84           AC_MSG_ERROR([${with_ming_incl} directory doesn't contain minglib.h])
85         fi
86       fi
87     ])
89     dnl if they didn't successfully force it, see if it's not in /usr/include.
90     if test x"${ac_cv_path_ming_incl}" = x; then
91       for i in $incllist; do
92               if test -f $i/ming.h; then
93           if test x"$i" != x"/usr/include"; then
94             ac_cv_path_ming_incl="-I$i"
95             break
96           else
97                   ac_cv_path_ming_incl=""
98                   break
99                 fi
100         fi
101       done
102     fi
104     dnl if it's not somewhere weird, make sure we can #include it already.
105     if test x"${ac_cv_path_ming_incl}" = x; then
106       AC_CHECK_HEADERS(ming.h, [ac_cv_path_ming_incl=""])
107     fi
109     AC_MSG_CHECKING([for Ming header])
110     AC_MSG_RESULT(${ac_cv_path_ming_incl})
112     dnl Look for the library
113     AC_ARG_WITH(ming_lib, AC_HELP_STRING([--with-ming-lib], [directory where ming library is]), with_ming_lib=${withval})
114     AC_CACHE_VAL(ac_cv_path_ming_lib, [
115       if test x"${with_ming_lib}" != x ; then
116         if test -f ${with_ming_lib}/libming.a -o -f ${with_ming_lib}/libming.${shlibext}; then
117                 ac_cv_path_ming_lib="`(cd ${with_ming_lib}; pwd)`"
118         else
119           AC_MSG_ERROR([${with_ming_lib} directory doesn't contain libming.])
120         fi
121       fi
122     ])
124     dnl look for the library, but don't add -L if it's in a standard place
125     for i in $libslist; do
126       if test -f $i/libming.a -o -f $i/libming.${shlibext}; then
127         if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
128           ac_cv_path_ming_lib="-L$i -lming"
129           break
130         else
131                 ac_cv_path_ming_lib="-lming"
132           break
133         fi
134       fi
135     done
136     if test x"${ac_cv_path_ming_lib}" = x; then
137       AC_CHECK_LIB(ming, ming_init_io, [ac_cv_path_ming_lib=""])
138     fi
139     AC_MSG_CHECKING([for libming library])
140     AC_MSG_RESULT(${ac_cv_path_ming_lib})
142     if test x"${ac_cv_path_ming_incl}" != x ; then
143       MING_CFLAGS="${ac_cv_path_ming_incl}"
144       AC_MSG_RESULT(${ac_cv_path_ming_incl})
145     else
146       MING_CFLAGS=""
147     fi
149     if test x"${ac_cv_path_ming_lib}" != x ; then
150       MING_LIBS="${ac_cv_path_ming_lib}"
151       AC_MSG_RESULT(${ac_cv_path_ming_lib})
152     else
153       MING_LIBS=""
154     fi
155   fi
157   AC_SUBST(MING_VERSION_CODE)
158   AC_SUBST(MING_VERSION)
159   AC_SUBST(MING_CFLAGS)
160   AC_SUBST(MING_LIBS)
161   AC_SUBST(MAKESWF)
164 # Local Variables:
165 # c-basic-offset: 2
166 # tab-width: 2
167 # indent-tabs-mode: nil
168 # End: