| 1 |
# Process this file with autoconf to produce a configure script. |
| 2 |
|
| 3 |
AC_INIT(main.c) |
| 4 |
AM_INIT_AUTOMAKE(btscanner, 2.0) |
| 5 |
AC_CONFIG_HEADERS([config.h]) |
| 6 |
|
| 7 |
# Checks for programs. |
| 8 |
AC_PROG_CC |
| 9 |
AC_PATH_PROGS(PERL, perl perl5.004 perl5.003 perl5.002 perl5.001 perl5) |
| 10 |
AC_ISC_POSIX |
| 11 |
|
| 12 |
# Checks for libraries. |
| 13 |
AC_HAVE_LIBRARY(ncurses,,[AC_MSG_ERROR([ncurses not found])]) |
| 14 |
AC_HAVE_LIBRARY(menu,,[AC_MSG_ERROR([ncurses menu library not found])]) |
| 15 |
AC_HAVE_LIBRARY(form,,[AC_MSG_ERROR([ncurses form library not found])]) |
| 16 |
AC_HAVE_LIBRARY(bluetooth,,[AC_MSG_ERROR([Bluetooth not found])]) |
| 17 |
AC_HAVE_LIBRARY(pthread,,[AC_MSG_ERROR([pthreads not found])]) |
| 18 |
|
| 19 |
# Checks for header files. |
| 20 |
AC_HEADER_STDC |
| 21 |
AC_CHECK_HEADERS([netinet/in.h stdlib.h string.h sys/ioctl.h \ |
| 22 |
sys/socket.h unistd.h fcntl.h stdarg.h syslog.h]) |
| 23 |
AC_CHECK_HEADERS([bluetooth/bluetooth.h],, |
| 24 |
[AC_MSG_ERROR([Bluetooth headers MIA])]) |
| 25 |
AC_CHECK_HEADERS([bluetooth/sdp.h],, |
| 26 |
[AC_MSG_ERROR([SDP headers MIA])]) |
| 27 |
|
| 28 |
# Checks for typedefs, structures, and compiler characteristics. |
| 29 |
AC_C_CONST |
| 30 |
AC_TYPE_SIZE_T |
| 31 |
|
| 32 |
# Checks for library functions. |
| 33 |
AC_PROG_GCC_TRADITIONAL |
| 34 |
AC_FUNC_MALLOC |
| 35 |
AC_TYPE_SIGNAL |
| 36 |
AC_CHECK_FUNCS([memset strerror]) |
| 37 |
|
| 38 |
# set the optimisation/debug levels in CFLAGS |
| 39 |
#CFLAGS="-g -ggdb" |
| 40 |
|
| 41 |
# config for libxml2 check |
| 42 |
AC_ARG_WITH(xml2cfgpath, |
| 43 |
[ --with-libxml2=dir Base directory where libxml2 is installed], |
| 44 |
[ xml2cfgpath="${withval}/bin" ]) |
| 45 |
# check for libxml2 |
| 46 |
if test -z "$xml2cfgpath" |
| 47 |
then |
| 48 |
AC_PATH_PROG(xml2cfg,xml2-config,"no") |
| 49 |
else |
| 50 |
AC_PATH_PROG(xml2cfg,xml2-config,"no", $xml2cfgpath) |
| 51 |
fi |
| 52 |
if test "$xml2cfg" = "no" |
| 53 |
then |
| 54 |
AC_MSG_ERROR([libxml2 not found or installed]) |
| 55 |
else |
| 56 |
CFLAGS="$CFLAGS `$xml2cfg --cflags`" |
| 57 |
CPPFLAGS="$CPPFLAGS `$xml2cfg --cflags`" |
| 58 |
LDFLAGS="$LDFLAGS `$xml2cfg --libs`" |
| 59 |
fi |
| 60 |
# check for libxml2 heads/libs |
| 61 |
AC_CHECK_HEADERS([libxml/parser.h libxml/tree.h],, |
| 62 |
[AC_MSG_ERROR([libxml2 headers MIA])]) |
| 63 |
AC_HAVE_LIBRARY(xml2,,[AC_MSG_ERROR([libxml2 not found])]) |
| 64 |
|
| 65 |
# CFLAGS |
| 66 |
CFLAGS="$CFLAGS -Wall -pthread -Wshadow -Wbad-function-cast \ |
| 67 |
-Wformat -Wimplicit-function-dec -Wparentheses -Wsign-compare \ |
| 68 |
-Wstrict-prototypes -Wtrigraphs -Wundef -Wuninitialized \ |
| 69 |
-W -Wunused -Wformat-security -Wmissing-braces -Wbad-function-cast \ |
| 70 |
-Wcast-qual -falign-functions -falign-labels -falign-loops\ |
| 71 |
-pedantic -fstrict-aliasing -D_GNU_SOURCE -std=c99" |
| 72 |
# -fstack-check -fbounds-check" |
| 73 |
|
| 74 |
# cfg |
| 75 |
AC_MSG_CHECKING(the location of the config file) |
| 76 |
AC_ARG_WITH(cfgfile, |
| 77 |
[ --with-cfg=file location of the config file], |
| 78 |
[ cfgfile="${withval}" ], |
| 79 |
[ cfgfile="$sysconfdir/btscanner.xml" ]) |
| 80 |
AC_MSG_RESULT($cfgfile) |
| 81 |
# cfg DTD |
| 82 |
AC_MSG_CHECKING(the location of the config DTD) |
| 83 |
AC_ARG_WITH(cfgdtd, |
| 84 |
[ --with-dtd=file location of the config dtd], |
| 85 |
[ cfgdtd="${withval}" ], |
| 86 |
[ cfgdtd="file://$sysconfdir/btscanner.dtd" ]) |
| 87 |
AC_MSG_RESULT($cfgdtd) |
| 88 |
|
| 89 |
CFLAGS="$CFLAGS -DCFG_FILE=\\\"$cfgfile\\\" -DCFG_DTD=\\\"$cfgdtd\\\"" |
| 90 |
|
| 91 |
# output |
| 92 |
AC_CONFIG_FILES([Makefile]) |
| 93 |
AC_OUTPUT |