1dnl
2dnl    Copyright (C) 2005, 2006 Free Software Foundation, Inc.
3dnl
4dnl  This program is free software; you can redistribute it and/or modify
5dnl  it under the terms of the GNU General Public License as published by
6dnl  the Free Software Foundation; either version 2 of the License, or
7dnl  (at your option) any later version.
8dnl
9dnl  This program is distributed in the hope that it will be useful,
10dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
11dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12dnl  GNU General Public License for more details.
13dnl  You should have received a copy of the GNU General Public License
14dnl  along with this program; if not, write to the Free Software
15dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16dnl
17dnl
18
19# Configure paths for Ming
20# Author: Sandro Santilli <strk@keybit.net>
21#
22# This macro uses ming-config, which was
23# not available as of Ming 0.3beta1
24#
25#
26# Use:
27#	AC_PATH_MING
28#
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
36#
37
38AC_DEFUN([AC_PATH_MING],
39[
40	MING_CFLAGS=""
41	MING_LIBS=""
42
43	AC_ARG_WITH(ming,[  --with-ming=[<ming-config>]    Path to the ming-config command],
44		[
45		case "${withval}" in
46			yes|no)
47				;;
48			*) MING_CONFIG=${withval}
49				;;
50		esac
51		], MING_CONFIG="")
52
53	if test x"$MING_CONFIG" = "x"; then
54		AC_PATH_PROG(MING_CONFIG, ming-config)
55	fi
56
57	if test x"$MING_CONFIG" != "x"; then
58		MING_VERSION=`$MING_CONFIG --version`
59		major=`echo $MING_VERSION | \
60			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
61		minor=`echo $MING_VERSION | \
62			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
63		micro=`echo $MING_VERSION | \
64			sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
65		beta=`echo $MING_VERSION | sed -ne 's/.*beta\([[0-9]]*\).*/\1/p'`
66		MING_VERSION_CODE=`printf %2.2d%2.2d%2.2d%2.2d $major $minor $micro $beta`
67		MING_CFLAGS=`$MING_CONFIG --cflags`
68		MING_LIBS=`$MING_CONFIG --libs`
69		MING_PATH=`$MING_CONFIG --bindir`
70		AC_PATH_PROG([MAKESWF], [makeswf], , [$MING_PATH:$PATH])
71	fi
72
73
74	AC_SUBST(MING_VERSION_CODE)
75	AC_SUBST(MING_VERSION)
76	AC_SUBST(MING_CFLAGS)
77	AC_SUBST(MING_LIBS)
78	AC_SUBST(MAKESWF)
79])
80