1dnl
2dnl Autoconf script for bottlerocket
3dnl
4
5dnl make sure we have our files around.
6
7AC_INIT(br_cmd.h)
8AC_CONFIG_HEADER(config.h)
9AC_PROG_CC
10AC_PROG_CPP
11AC_PROG_INSTALL
12
13dnl Define the function that peeks for getopt_long
14
15AC_DEFUN(BR_CHECK_GETOPT_LONG,
16[
17AC_EGREP_HEADER(getopt_long, getopt.h, AC_DEFINE(HAVE_GETOPT_LONG))
18])
19
20AC_DEFUN(BR_CHECK_ISSETUGID,
21[
22AC_EGREP_HEADER(issetugid, unistd.h, AC_DEFINE(HAVE_ISSETUGID))
23])
24
25dnl
26dnl Check for some headers
27dnl
28AC_CHECK_HEADERS(features.h errno.h sys/termios.h termios.h)
29
30
31dnl
32dnl Some other custom arguments
33dnl
34AC_ARG_ENABLE(debug, [  --enable-debug          Enable debugging code], AC_DEFINE(DEBUG))
35
36dnl
37dnl And find the port to use.
38dnl
39AC_DEFUN(BR_FIND_PORT,
40[AC_ARG_WITH(x10port, [  --with-x10port=PATH     Specify the serial port for the x10 module],
41[
42case "$withval" in
43	*) X10PORT="$withval" ;;
44esac],
45[
46X10PORT="auto"
47])
48
49if test "$X10PORT" = "auto"
50then
51  echo "guessing x10 port"
52  for port in /dev/ttyS0 /dev/cua0 /dev/cuaa0 /dev/tty00 /dev/ttya
53  do
54    if test -c $port
55    then
56      X10PORT=$port;
57      break
58    fi
59  done
60fi
61echo "using $X10PORT for x10 port"
62])
63
64dnl Check for important programs, like the C compiler.
65
66BR_FIND_PORT
67BR_CHECK_GETOPT_LONG
68BR_CHECK_ISSETUGID
69AC_SUBST(X10PORT)
70AC_OUTPUT(Makefile)
71