diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2004-04-03 06:04:35 +0000 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2004-04-03 06:04:35 +0000 | 
| commit | 1d3715db11f573060cb02a2b7b7c44f06607d337 (patch) | |
| tree | 53e9b7eca91253c4c19e2cba3679d3c6084000a7 | |
| parent | b215047988241418ccbcaa41c07366ea637678c7 (diff) | |
Update BlueZ library configuration
| -rw-r--r-- | acinclude.m4 | 117 | ||||
| -rw-r--r-- | configure.in | 46 | ||||
| -rw-r--r-- | hcid/Makefile.am | 4 | ||||
| -rw-r--r-- | hcid/main.c | 4 | ||||
| -rw-r--r-- | rfcomm/Makefile.am | 4 | ||||
| -rw-r--r-- | rfcomm/main.c | 4 | ||||
| -rw-r--r-- | sdpd/Makefile.am | 4 | ||||
| -rw-r--r-- | sdpd/main.c | 8 | ||||
| -rw-r--r-- | sdpd/sdpd.h | 9 | ||||
| -rw-r--r-- | test/Makefile.am | 4 | ||||
| -rw-r--r-- | tools/Makefile.am | 4 | ||||
| -rw-r--r-- | tools/ciptool.c | 4 | ||||
| -rw-r--r-- | tools/hciattach.c | 4 | ||||
| -rw-r--r-- | tools/hciconfig.c | 4 | ||||
| -rw-r--r-- | tools/hcitool.c | 4 | ||||
| -rw-r--r-- | tools/sdptool.c | 6 | 
16 files changed, 97 insertions, 133 deletions
| diff --git a/acinclude.m4 b/acinclude.m4 index a2fa7784..ea030ae2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,101 +1,36 @@ -dnl Test file -AC_DEFUN([AC_TEST_FILE], -[ -    if test -f $1; then -	ifelse([$2], , :,[$2]) -    else -	ifelse([$3], , :,[$3]) -    fi -]) +dnl +dnl  $Id$ +dnl -dnl Test dir -AC_DEFUN([AC_TEST_DIR], -[ -    if test -d $1; then -	ifelse([$2], , :,[$2]) -    else -	ifelse([$3], , :,[$3]) -    fi -]) +AC_DEFUN(AC_PATH_BLUEZ, [ +	BLUEZ_INCLUDES="" +	BLUEZ_LDFLAGS="" +	BLUEZ_LIBS="" -dnl Test files -AC_DEFUN([AC_TEST_FILES], -[ -    ac_file_found=yes -    for f in $1; do -	if test ! -f $2/$f; then -    	   ac_file_found=no -	   break; -	fi -    done +	ac_save_CFLAGS=$CFLAGS +	test -n "$bluez_includes" && CFLAGS="$CFLAGS -I$bluez_includes" -    if test "$ac_file_found" = "yes" ; then -	ifelse([$3], , :,[$3]) -    else -	ifelse([$4], , :,[$4]) -    fi -]) +	ac_save_LDFLAGS=$LDFLAGS +	test -n "$bluez_libraries" && LDFLAGS="$LDFLAGS -L$bluez_libraries" -dnl Search for headers, add path to CPPFLAGS if found  -AC_DEFUN([AC_SEARCH_HEADERS],  -[ -    AC_MSG_CHECKING("for $1")  -    ac_hdr_found=no -    for p in $2; do -	test -d $p || continue; -	p=`cd $p && pwd` -	AC_TEST_FILES($1, $p,  -	    [  -     	       ac_hdr_found=yes -	       break -	    ] -	) -    done  -    if test "$ac_hdr_found" = "yes" ; then -	CPPFLAGS="$CPPFLAGS -I$p" -        AC_MSG_RESULT( [($p) yes] )  -	ifelse([$3], , :,[$3]) -    else -        AC_MSG_RESULT("no")  -	ifelse([$4], , :,[$4]) -    fi -]) +	AC_CHECK_HEADER(bluetooth/bluetooth.h,, +		AC_MSG_ERROR(Bluetooth header files not found)) -dnl Search for library, add path to LIBS if found  -AC_DEFUN([AC_SEARCH_LIB],  -[ -    AC_MSG_CHECKING("for lib$1") +	AC_CHECK_LIB(bluetooth, hci_open_dev, +		BLUEZ_LIBS="$BLUEZ_LIBS -lbluetooth", +		AC_MSG_ERROR(Bluetooth library not found)) -    ac_save_LDFLAGS=$LDFLAGS +	AC_CHECK_LIB(sdp, sdp_connect, +		BLUEZ_LIBS="$BLUEZ_LIBS -lsdp") -    ac_lib_found=no -    for p in $3; do -	test -d $p || continue; -	p=`cd $p && pwd` +	CFLAGS=$ac_save_CFLAGS +	test -n "$bluez_includes" && BLUEZ_INCLUDES="-I$bluez_includes" -	# Check for libtool library -	if test -f $p/lib$1.la; then -		path=$p/.libs -	else -		path=$p -	fi -	 -	LDFLAGS="-L$path -l$1" -	AC_TRY_LINK_FUNC($2, -	    [  -	       LIBS="$LIBS -L$p -l$1" -     	       ac_lib_found=yes -	       break -	    ] -	) -    done  -    if test "$ac_lib_found" = "yes" ; then -        AC_MSG_RESULT( [($p) yes] )  -	ifelse([$4], , :,[$4]) -    else -        AC_MSG_RESULT("no")  -	ifelse([$5], , :,[$5]) -    fi +	LDFLAGS=$ac_save_LDFLAGS +	test -n "$bluez_libraries" && BLUEZ_LDFLAGS="-L$bluez_libraries" +	test -n "$bluez_libraries" && BLUEZ_LIBS="-L$bluez_libraries $BLUEZ_LIBS" -    LDFLAGS=$ac_save_LDFLAGS +	AC_SUBST(BLUEZ_INCLUDES) +	AC_SUBST(BLUEZ_LDFLAGS) +	AC_SUBST(BLUEZ_LIBS)  ]) diff --git a/configure.in b/configure.in index 3115ee0e..0c26d6a3 100644 --- a/configure.in +++ b/configure.in @@ -33,52 +33,18 @@ 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, [  --with-bluez=DIR        BlueZ library is installed in DIR], [ +	bluez_includes=$withval/include +	bluez_libraries=$withval/lib +]) -AC_ARG_WITH(bluez-includes, -	--with-bluez-includes=DIR BlueZ header files, -	BLUEZ_INCDIR="$withval", -	BLUEZ_INCDIR='../libs/include /usr/include' -) +AC_PATH_BLUEZ -AC_ARG_ENABLE(dbus, -	--enable-dbus		  use D-BUS, +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) diff --git a/hcid/Makefile.am b/hcid/Makefile.am index 0a5a5448..f356b9b6 100644 --- a/hcid/Makefile.am +++ b/hcid/Makefile.am @@ -13,6 +13,10 @@ endif  hcid_SOURCES = main.c security.c hcid.h lib.c lib.h parser.h parser.y lexer.l kword.h kword.c glib-ectomy.h glib-ectomy.c $(dbus_hcid_sources)  hcid_CONFIG  = hcid.conf +LDFLAGS = @BLUEZ_LIBS@ + +INCLUDES = @BLUEZ_INCLUDES@ +  man_MANS = hcid.8 hcid.conf.5  YFLAGS   = -d diff --git a/hcid/main.c b/hcid/main.c index 2d1d5686..72453958 100644 --- a/hcid/main.c +++ b/hcid/main.c @@ -25,6 +25,10 @@   * $Id$   */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdio.h>  #include <stdlib.h>  #include <unistd.h> diff --git a/rfcomm/Makefile.am b/rfcomm/Makefile.am index f525fc4f..980b0900 100644 --- a/rfcomm/Makefile.am +++ b/rfcomm/Makefile.am @@ -9,6 +9,10 @@ bin_PROGRAMS = rfcomm  rfcomm_SOURCES = main.c parser.h parser.y lexer.l kword.h kword.c  rfcomm_CONFIG  = rfcomm.conf +LDFLAGS = @BLUEZ_LIBS@ + +INCLUDES = @BLUEZ_INCLUDES@ +  man_MANS = rfcomm.1  YFLAGS = -d diff --git a/rfcomm/main.c b/rfcomm/main.c index 68396b5e..52701d40 100644 --- a/rfcomm/main.c +++ b/rfcomm/main.c @@ -21,6 +21,10 @@   *   */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdio.h>  #include <stdlib.h>  #include <unistd.h> diff --git a/sdpd/Makefile.am b/sdpd/Makefile.am index 81c248ce..97f9b9e1 100644 --- a/sdpd/Makefile.am +++ b/sdpd/Makefile.am @@ -6,6 +6,10 @@ sbin_PROGRAMS = sdpd  sdpd_SOURCES = main.c request.c service.c cstate.c servicedb.c sdpd.h +LDFLAGS = @BLUEZ_LIBS@ + +INCLUDES = @BLUEZ_INCLUDES@ +  man_MANS = sdpd.8  EXTRA_DIST = $(man_MANS) diff --git a/sdpd/main.c b/sdpd/main.c index fea283f2..132539d5 100644 --- a/sdpd/main.c +++ b/sdpd/main.c @@ -34,23 +34,29 @@  /*   * $Id$   */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdlib.h>  #include <unistd.h>  #include <stdio.h>  #include <errno.h>  #include <signal.h> +#include <syslog.h>  #include <getopt.h>  #include <sys/un.h>  #include <sys/select.h>  #include <sys/stat.h>  #include <sys/ioctl.h>  #include <sys/socket.h> +#include <netinet/in.h>  #include <bluetooth/bluetooth.h>  #include <bluetooth/l2cap.h>  #include <bluetooth/sdp.h>  #include <bluetooth/sdp_lib.h> -#include <bluetooth/sdp_internal.h>  #include "sdpd.h" diff --git a/sdpd/sdpd.h b/sdpd/sdpd.h index 1f0d7e47..37c685e2 100644 --- a/sdpd/sdpd.h +++ b/sdpd/sdpd.h @@ -30,6 +30,15 @@  #ifndef SDPD_H  #define SDPD_H +#define SDPINF(fmt, arg...) syslog(LOG_INFO, fmt "\n", ## arg) +#define SDPERR(fmt, arg...) syslog(LOG_ERR, "%s: " fmt "\n", __func__ , ## arg) + +#ifdef SDP_DEBUG +#define SDPDBG(fmt, arg...) syslog(LOG_DEBUG, "%s: " fmt "\n", __func__ , ## arg) +#else +#define SDPDBG(fmt...) +#endif +  typedef struct request {  	bdaddr_t bdaddr;  	int      local; diff --git a/test/Makefile.am b/test/Makefile.am index ec6b7779..79386603 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,4 +4,8 @@  noinst_PROGRAMS	= l2test scotest rctest attest hstest +LDFLAGS = @BLUEZ_LIBS@ + +INCLUDES = @BLUEZ_INCLUDES@ +  EXTRA_DIST = hsplay hsmicro diff --git a/tools/Makefile.am b/tools/Makefile.am index ca7369a2..354f841c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -8,6 +8,10 @@ bin_PROGRAMS = hcitool l2ping sdptool ciptool  hciconfig_SOURCES = hciconfig.c csr.h csr.c +LDFLAGS = @BLUEZ_LIBS@ + +INCLUDES = @BLUEZ_INCLUDES@ +  man_MANS = hciattach.8 hciconfig.8 hcitool.1 l2ping.1 sdptool.1 ciptool.1  noinst_PROGRAMS	= ppporc diff --git a/tools/ciptool.c b/tools/ciptool.c index d9aa0085..bec3fc2b 100644 --- a/tools/ciptool.c +++ b/tools/ciptool.c @@ -21,6 +21,10 @@   *   */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdio.h>  #include <errno.h>  #include <stdlib.h> diff --git a/tools/hciattach.c b/tools/hciattach.c index 799e338d..926e3fab 100644 --- a/tools/hciattach.c +++ b/tools/hciattach.c @@ -24,6 +24,10 @@   * $Id$   */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdio.h>  #include <stdlib.h>  #include <unistd.h> diff --git a/tools/hciconfig.c b/tools/hciconfig.c index 39804e45..6ab7f190 100644 --- a/tools/hciconfig.c +++ b/tools/hciconfig.c @@ -25,6 +25,10 @@   * $Id$   */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdio.h>  #include <stdlib.h>  #include <unistd.h> diff --git a/tools/hcitool.c b/tools/hcitool.c index 8fd7b83d..667212fe 100644 --- a/tools/hcitool.c +++ b/tools/hcitool.c @@ -25,6 +25,10 @@   * $Id$   */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdio.h>  #include <stdlib.h>  #include <unistd.h> diff --git a/tools/sdptool.c b/tools/sdptool.c index abb8b439..87646cab 100644 --- a/tools/sdptool.c +++ b/tools/sdptool.c @@ -28,14 +28,18 @@   * $Id$   */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +  #include <stdlib.h>  #include <stdio.h>  #include <getopt.h>  #include <errno.h> +#include <netinet/in.h>  #include <bluetooth/sdp.h>  #include <bluetooth/sdp_lib.h> -#include <bluetooth/sdp_internal.h>  #define for_each_opt(opt, long, short) while ((opt=getopt_long(argc, argv, short ? short:"+", long, 0)) != -1) | 
