2 dnl Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program; if not, write to the Free Software
15 dnl Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 # Configure paths for Ming
19 # Author: Sandro Santilli <strk@keybit.net>
21 # This macro uses ming-config, which was
22 # not available as of Ming 0.3beta1
29 # MING_VERSION - Ming version string (example: "0.4.1" or "0.4.0.beta2")
30 # MING_VERSION_CODE - a 8digits number encoding Major, Minor, Patch and Beta numbers.
31 # examples: 00040002 (0.4.0.beta2) 00040100 (0.4.1)
37 AC_DEFUN([AC_PATH_MING], [
41 AC_ARG_WITH(ming,[ --with-ming=[<ming-config>] Path to the ming-config command], [
44 *) MING_CONFIG=${withval} ;;
48 if test x"$MING_CONFIG" = "x"; then
49 AC_PATH_PROG(MING_CONFIG, ming-config, ,[${pathlist}])
52 if test x"$MING_CONFIG" != "x"; then
53 MING_VERSION=`$MING_CONFIG --version`
54 major=`echo $MING_VERSION | cut -d '.' -f 1`
55 minor=`echo $MING_VERSION | cut -d '.' -f 2`
56 micro=`echo $MING_VERSION | cut -d '.' -f 3`
57 beta=`echo $MING_VERSION | sed -ne 's/.*beta\([[0-9]]*\).*/\1/p'`
58 dnl This is a little screwy. The previous Ming release was tagged beta5,
59 dnl but the newer one is tagged rc1. This makes it look like rc1 is older the
60 dnl beta 5 release, as it only looks at the last integer. So we fudge the
61 dnl numbers so tc1 comes after beta 5. ie.. this looks like beta 6.
62 if test -z $beta; then
63 beta=`echo $MING_VERSION | sed -ne 's/.*rc\([[0-9]]*\).*/\1/p'`
64 if test x"$beta" != x; then
65 beta=`eval expr $beta + 5`
68 MING_VERSION_CODE=`printf %2.2d%2.2d%2.2d%2.2d $major $minor $micro $beta`
69 MING_CFLAGS=`$MING_CONFIG --cflags`
70 MING_LIBS=`$MING_CONFIG --libs`
71 MING_PATH=`$MING_CONFIG --bindir`
72 AC_PATH_PROG([MAKESWF], [makeswf], , [$MING_PATH:$PATH])
75 dnl if MING_LIBS is empty, no MING_CONFIG found.
76 if test x"${MING_LIBS}" = x; then
77 AC_ARG_WITH(ming_incl, AC_HELP_STRING([--with-ming-incl], [Directory where Ming header is]), with_ming_incl=${withval})
78 AC_CACHE_VAL(ac_cv_path_ming_incl, [
79 if test x"${with_ming_incl}" != x ; then
80 if test -f ${with_ming_incl}/ming.h ; then
81 ac_cv_path_ming_incl="-I`(cd ${with_ming_incl}; pwd)`"
83 AC_MSG_ERROR([${with_ming_incl} directory doesn't contain minglib.h])
88 dnl if they didn't successfully force it, see if it's not in /usr/include.
89 if test x"${ac_cv_path_ming_incl}" = x; then
90 for i in $incllist; do
91 if test -f $i/ming.h; then
92 if test x"$i" != x"/usr/include"; then
93 ac_cv_path_ming_incl="-I$i"
96 ac_cv_path_ming_incl=""
103 dnl if it's not somewhere weird, make sure we can #include it already.
104 if test x"${ac_cv_path_ming_incl}" = x; then
105 AC_CHECK_HEADERS(ming.h, [ac_cv_path_ming_incl=""])
108 AC_MSG_CHECKING([for Ming header])
109 AC_MSG_RESULT(${ac_cv_path_ming_incl})
111 dnl Look for the library
112 AC_ARG_WITH(ming_lib, AC_HELP_STRING([--with-ming-lib], [directory where ming library is]), with_ming_lib=${withval})
113 AC_CACHE_VAL(ac_cv_path_ming_lib, [
114 if test x"${with_ming_lib}" != x ; then
115 if test -f ${with_ming_lib}/libming.a -o -f ${with_ming_lib}/libming.${shlibext}; then
116 ac_cv_path_ming_lib="`(cd ${with_ming_lib}; pwd)`"
118 AC_MSG_ERROR([${with_ming_lib} directory doesn't contain libming.])
123 dnl look for the library, but don't add -L if it's in a standard place
124 for i in $libslist; do
125 if test -f $i/libming.a -o -f $i/libming.${shlibext}; then
126 if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
127 ac_cv_path_ming_lib="-L$i -lming"
130 ac_cv_path_ming_lib="-lming"
135 if test x"${ac_cv_path_ming_lib}" = x; then
136 AC_CHECK_LIB(ming, ming_init_io, [ac_cv_path_ming_lib=""])
138 AC_MSG_CHECKING([for libming library])
139 AC_MSG_RESULT(${ac_cv_path_ming_lib})
141 if test x"${ac_cv_path_ming_incl}" != x ; then
142 MING_CFLAGS="${ac_cv_path_ming_incl}"
143 AC_MSG_RESULT(${ac_cv_path_ming_incl})
148 if test x"${ac_cv_path_ming_lib}" != x ; then
149 MING_LIBS="${ac_cv_path_ming_lib}"
150 AC_MSG_RESULT(${ac_cv_path_ming_lib})
156 AC_SUBST(MING_VERSION_CODE)
157 AC_SUBST(MING_VERSION)
158 AC_SUBST(MING_CFLAGS)
166 # indent-tabs-mode: nil