Home | History | Annotate | Download | only in bluez
      1 AC_DEFUN([AM_PATH_BLUEZ], [
      2 	if (test "${prefix}" = "NONE"); then
      3 		bluez_prefix=${ac_default_prefix}
      4 	else
      5 		bluez_prefix=${prefix}
      6 	fi
      7 
      8 	AC_ARG_WITH(bluez, AC_HELP_STRING([--with-bluez=DIR], [BlueZ library is installed in DIR]), [
      9 		if (test "${withval}" != "yes"); then
     10 			bluez_prefix=${withval}
     11 		fi
     12 	])
     13 
     14 	ac_save_CPPFLAGS=$CPPFLAGS
     15 	ac_save_LDFLAGS=$LDFLAGS
     16 
     17 	BLUEZ_CFLAGS=""
     18 	test -d "${bluez_prefix}/include" && BLUEZ_CFLAGS="$BLUEZ_CFLAGS -I${bluez_prefix}/include"
     19 
     20 	CPPFLAGS="$CPPFLAGS $BLUEZ_CFLAGS"
     21 	AC_CHECK_HEADER(bluetooth/bluetooth.h,, AC_MSG_ERROR(Bluetooth header files not found))
     22 
     23 	BLUEZ_LIBS=""
     24 	if (test "${ac_default_prefix}" = "${bluez_prefix}"); then
     25 		test -d "${libdir}" && BLUEZ_LIBS="$BLUEZ_LIBS -L${libdir}"
     26 	else
     27 		test -d "${bluez_prefix}/lib64" && BLUEZ_LIBS="$BLUEZ_LIBS -L${bluez_prefix}/lib64"
     28 		test -d "${bluez_prefix}/lib" && BLUEZ_LIBS="$BLUEZ_LIBS -L${bluez_prefix}/lib"
     29 	fi
     30 
     31 	LDFLAGS="$LDFLAGS $BLUEZ_LIBS"
     32 	AC_CHECK_LIB(bluetooth, hci_open_dev, BLUEZ_LIBS="$BLUEZ_LIBS -lbluetooth", AC_MSG_ERROR(Bluetooth library not found))
     33 	AC_CHECK_LIB(bluetooth, sdp_connect,, AC_CHECK_LIB(sdp, sdp_connect, BLUEZ_LIBS="$BLUEZ_LIBS -lsdp"))
     34 
     35 	CPPFLAGS=$ac_save_CPPFLAGS
     36 	LDFLAGS=$ac_save_LDFLAGS
     37 
     38 	AC_SUBST(BLUEZ_CFLAGS)
     39 	AC_SUBST(BLUEZ_LIBS)
     40 ])
     41