root/trunk/acinclude.m4

Revision 195, 7.5 KB (checked in by zany, 15 months ago)

adding copy of iconv.m4

Line 
1AC_DEFUN([AC_PATH_WIN32], [
2        case $host in
3        *-*-mingw32*)
4                EXTRA_LIBS="$EXTRA_LIBS -lws2_32"
5                ;;
6        esac
7        AC_SUBST(EXTRA_LIBS)
8])
9
10
11dnl
12dnl Option to enable or disable IrDA support
13dnl
14dnl this is stupid and won't work at all.
15dnl Waring: the AC_TRY_COMPILE won't work with -Werror
16dnl
17
18AC_DEFUN([IRDA_CHECK],[
19AC_ARG_ENABLE([irda],
20              [AC_HELP_STRING([--disable-irda],
21                              [Disables irda support @<:@default=auto@:>@])],
22              [ac_irda_enabled=$enableval], [ac_irda_enabled=yes])
23
24if test "$ac_irda_enabled" = yes; then
25        AC_CACHE_CHECK([for IrDA support], am_cv_irda_found,[
26                AC_TRY_COMPILE([#include <sys/socket.h>
27                                #include "src/irda.h"],
28                                [struct irda_device_list l;],
29                                am_cv_irda_found=yes,
30                                am_cv_irda_found=no)])
31        if test $am_cv_irda_found = yes; then
32                AC_DEFINE([HAVE_IRDA], [1], [Define if system supports IrDA and it's enabled])
33        fi
34fi
35])
36
37
38dnl
39dnl Option to enable or disable Bluetooth support
40dnl Waring: the AC_TRY_COMPILE won't work with -Werror
41dnl
42
43AC_DEFUN([AC_PATH_WINBT], [
44        AC_CACHE_VAL(winbt_found,[
45                AC_CHECK_HEADERS(ws2bth.h, winbt_found=yes, winbt_found=no, [
46                                #include <winsock2.h>
47                ])
48        ])
49        AC_MSG_CHECKING([for Windows Bluetooth support])
50        AC_MSG_RESULT([$winbt_found])
51])
52
53AC_DEFUN([AC_PATH_NETBSDBT], [
54        AC_CACHE_CHECK([for NetBSD Bluetooth support], netbsdbt_found, [
55                AC_TRY_COMPILE([
56                                #include <bluetooth.h>
57                        ], [
58                                struct sockaddr_bt *bt;
59                        ], netbsdbt_found=yes, netbsdbt_found=no)
60        ])
61])
62
63AC_DEFUN([AC_PATH_FREEBSDBT], [
64        AC_CACHE_CHECK([for FreeBSD Bluetooth support], freebsdbt_found, [
65                AC_TRY_COMPILE([
66                                #include <bluetooth.h>
67                        ], [
68                                struct sockaddr_rfcomm *rfcomm;
69                        ], freebsdbt_found=yes, freebsdbt_found=no)
70        ])
71        if test "${freebsdbt_found}" = "yes"; then
72                BLUETOOTH_LIBS=-lbluetooth
73        fi
74])
75
76AC_DEFUN([AC_PATH_BLUEZ], [
77        PKG_CHECK_MODULES(BLUETOOTH, bluez, bluez_found=yes, AC_MSG_RESULT(no))
78])
79
80AC_DEFUN([AC_PATH_BLUETOOTH], [
81        case $host in
82        *-*-linux*)
83                AC_PATH_BLUEZ
84                ;;
85        *-*-freebsd*)
86                AC_PATH_FREEBSDBT
87                ;;
88        *-*-netbsd*)
89                AC_PATH_NETBSDBT
90                ;;
91        *-*-mingw32*)
92                AC_PATH_WINBT
93                ;;
94        esac
95        AC_SUBST(BLUETOOTH_CFLAGS)
96        AC_SUBST(BLUETOOTH_LIBS)
97])
98
99AC_DEFUN([BLUETOOTH_CHECK],[ 
100AC_ARG_ENABLE([bluetooth],
101              [AC_HELP_STRING([--disable-bluetooth],
102                              [Disables bluetooth support @<:@default=auto@:>@])],
103              [ac_bluetooth_enabled=$enableval], [ac_bluetooth_enabled=yes])
104
105if test "$ac_bluetooth_enabled" = yes; then
106        AC_PATH_BLUETOOTH
107        if test "${netbsdbt_found}" = "yes" -o "${freebsdbt_found}" = "yes" -o "${bluez_found}" = "yes" -o "${winbt_found}" = "yes"; then
108                AC_DEFINE([HAVE_BLUETOOTH], [1], [Define if system supports Bluetooth and it's enabled])
109        fi
110fi
111])
112
113
114dnl
115dnl Check for Bluetooth SDP library
116dnl Waring: the AC_TRY_COMPILE won't work with -Werror
117dnl
118
119AC_DEFUN([SDPLIB_CHECK],[
120        AC_MSG_CHECKING(for Bluetooth SDP support)
121
122        AC_TRY_COMPILE( [
123                                #include <bluetooth/sdp.h>
124                        ],[
125                                sdp_list_t sdplist;
126                        ],
127                                am_cv_sdplib_found=yes,
128                                am_cv_sdplib_found=no
129                        )
130
131        if test $am_cv_sdplib_found = yes; then
132                AC_DEFINE(HAVE_SDPLIB,1,[Define if system supports Bluetooth SDP])
133
134        fi
135
136        AC_MSG_RESULT($am_cv_sdplib_found)
137])
138
139
140dnl
141dnl Check for USB library
142dnl Waring: the AC_TRY_COMPILE won't work with -Werror
143dnl
144
145AC_DEFUN([USB_CHECK],[
146        AC_MSG_CHECKING(for USB support)
147
148        AC_TRY_COMPILE( [
149                                #include <openobex/obex.h>
150                                #include <openobex/obex_const.h>
151                        ],[
152                                obex_usb_intf_t usb_intf;
153                        ],
154                                am_cv_usb_found=yes,
155                                am_cv_usb_found=no
156                        )
157
158        if test $am_cv_usb_found = yes; then
159                AC_DEFINE(HAVE_USB,1,[Define if system supports USB])
160        fi
161
162        AC_MSG_RESULT($am_cv_usb_found)
163])
164
165dnl
166dnl From autoconf-archive, should be in macros dir
167dnl
168AC_DEFUN([AC_PROG_SWIG],[
169        AC_PATH_PROG([SWIG],[swig])
170        if test -z "$SWIG" ; then
171                AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
172                SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
173        elif test -n "$1" ; then
174                AC_MSG_CHECKING([for SWIG version])
175                [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
176                AC_MSG_RESULT([$swig_version])
177                if test -n "$swig_version" ; then
178                        # Calculate the required version number components
179                        [required=$1]
180                        [required_major=`echo $required | sed 's/[^0-9].*//'`]
181                        if test -z "$required_major" ; then
182                                [required_major=0]
183                        fi
184                        [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
185                        [required_minor=`echo $required | sed 's/[^0-9].*//'`]
186                        if test -z "$required_minor" ; then
187                                [required_minor=0]
188                        fi
189                        [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
190                        [required_patch=`echo $required | sed 's/[^0-9].*//'`]
191                        if test -z "$required_patch" ; then
192                                [required_patch=0]
193                        fi
194                        # Calculate the available version number components
195                        [available=$swig_version]
196                        [available_major=`echo $available | sed 's/[^0-9].*//'`]
197                        if test -z "$available_major" ; then
198                                [available_major=0]
199                        fi
200                        [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
201                        [available_minor=`echo $available | sed 's/[^0-9].*//'`]
202                        if test -z "$available_minor" ; then
203                                [available_minor=0]
204                        fi
205                        [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
206                        [available_patch=`echo $available | sed 's/[^0-9].*//'`]
207                        if test -z "$available_patch" ; then
208                                [available_patch=0]
209                        fi
210                        if test $available_major -ne $required_major \
211                                -o $available_minor -ne $required_minor \
212                                -o $available_patch -lt $required_patch ; then
213                                AC_MSG_WARN([SWIG version >= $1 is required.  You have $swig_version.  You should look at http://www.swig.org])
214                                SWIG='echo "Error: SWIG version >= $1 is required.  You have '"$swig_version"'.  You should look at http://www.swig.org" ; false'
215                        else
216                                AC_MSG_NOTICE([SWIG executable is '$SWIG'])
217                                SWIG_LIB=`$SWIG -swiglib`
218                                AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
219                        fi
220                else
221                        AC_MSG_WARN([cannot determine SWIG version])
222                        SWIG='echo "Error: Cannot determine SWIG version.  You should look at http://www.swig.org" ; false'
223                fi
224        fi
225        AC_SUBST([SWIG_LIB])
226])
227
228# SWIG_ENABLE_CXX()
229#
230# Enable SWIG C++ support.  This affects all invocations of $(SWIG).
231AC_DEFUN([SWIG_ENABLE_CXX],[
232        AC_REQUIRE([AC_PROG_SWIG])
233        AC_REQUIRE([AC_PROG_CXX])
234        SWIG="$SWIG -c++"
235])
236
Note: See TracBrowser for help on using the browser.