summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: 60fb7e10a7ecd8cddd793746c1a928421d001a3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
dnl
dnl  $Id$
dnl
dnl Process this file with autoconf to produce a configure script.
dnl

AC_PREREQ(2.50)
AC_INIT()

AM_INIT_AUTOMAKE(bluez-utils, 2.6)

AM_MAINTAINER_MODE

AC_PREFIX_DEFAULT(/usr)

if test "$prefix" = "NONE"; then
	dnl no prefix and no sysconfdir, so default to /etc
	if test "$sysconfdir" = '${prefix}/etc'; then
		AC_SUBST([sysconfdir], ['/etc'])
	fi

	dnl no prefix and no mandir, so use ${prefix}/share/man as default
	if test "$mandir" = '${prefix}/man'; then
		AC_SUBST([mandir], ['${prefix}/share/man'])
	fi
fi

CFLAGS="-Wall -g -O2"

AC_LANG_C

AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_YACC
AM_PROG_LEX

AC_ARG_WITH(bluez-libs,
	--with-bluez-libs=DIR     BlueZ libraries,
	BLUEZ_LIBDIR="$withval",
	BLUEZ_LIBDIR='../libs/src /usr/lib'
)

AC_ARG_WITH(bluez-includes,
	--with-bluez-includes=DIR BlueZ header files,
	BLUEZ_INCDIR="$withval",
	BLUEZ_INCDIR='../libs/include /usr/include'
)

AC_ARG_ENABLE(dbus,
	--enable-dbus		  use D-BUS,
	BLUEZ_DBUS="$enableval",
	BLUEZ_DBUS="no"
)

AC_SEARCH_HEADERS(bluetooth/bluetooth.h, $BLUEZ_INCDIR,,
	AC_MSG_ERROR(Bluetooth headers not found.
		Please compile and install bluez-libs package.)
)

AC_SEARCH_LIB(bluetooth, hci_open_dev, $BLUEZ_LIBDIR,,
	AC_MSG_ERROR(Bluetooth library not found.
		Please compile and install bluez-libs package.)
)

AC_SUBST(DISTRO)
AC_SUBST(PCMCIA)

DISTRO=unknown

if test "$cross_compiling" != yes; then
	AC_TEST_FILE(/etc/redhat-release,   DISTRO=redhat)
	AC_TEST_FILE(/etc/mandrake-release, DISTRO=redhat)
	AC_TEST_FILE(/etc/debian_version,   DISTRO=debian)
fi

AC_ARG_ENABLE(pcmcia,
    --enable-pcmcia           Always install PCMCIA support files,
    [PCMCIA=pcmcia],
    [ if test "$cross_compiling" != yes; then
           AC_TEST_DIR(/etc/pcmcia, PCMCIA=pcmcia, PCMCIA=)
    fi ])

if test x"$BLUEZ_DBUS" == "xyes"; then
	PKG_CHECK_MODULES(DBUS, dbus-1, have_dbus=yes, have_dbus=no)

	CFLAGS="$CFLAGS $DBUS_CFLAGS -DENABLE_DBUS"
	LIBS="$LIBS $DBUS_LIBS"
fi

AM_CONDITIONAL(ENABLE_DBUS, test x$BLUEZ_DBUS = xyes)

AC_OUTPUT(Makefile hcid/Makefile tools/Makefile rfcomm/Makefile sdpd/Makefile test/Makefile scripts/Makefile pcmcia/Makefile)