Include <algorithm> to have access to std::for_each on stricter platforms
[remote/remote-mci.git] / configure.in
blob5bd746aebf876d9450c2a781fbaff70986b88934
1 # Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.59)
5 AC_INIT([remote-mci],[2.0.git],[remote-testbed@googlegroups.com])
6 AC_CONFIG_AUX_DIR([config])
7 AC_CONFIG_HEADER([config/config.h])
8 AC_CONFIG_SRCDIR([src/remote.h])
10 AM_INIT_AUTOMAKE()
12 #######################################################################
13 ## Helper macros.
14 #######################################################################
16 AC_DEFUN([REMOTE_PARSE_ENABLEVAL],
17 [m4_toupper(CONFIG_$1)=yes;
18 if test "$enable_$1" = "no"; then
19         m4_toupper(CONFIG_$1)=no;
21 AC_SUBST(m4_toupper(CONFIG_$1))
25 #######################################################################
26 ## Configure options.
27 #######################################################################
29 AC_ARG_ENABLE(mch,
30 AS_HELP_STRING([--disable-mch],[disable building of the mote control host module]))
31 REMOTE_PARSE_ENABLEVAL(mch)
33 AC_ARG_ENABLE(mcs,
34 AS_HELP_STRING([--disable-mcs],[disable building of the mote control server module]))
35 REMOTE_PARSE_ENABLEVAL(mcs)
37 #######################################################################
38 ## Checks for programs.
39 #######################################################################
41 AC_PROG_CXX
42 AC_PROG_CC
43 AC_PROG_INSTALL
44 AC_PROG_RANLIB
45 AC_PROG_MAKE_SET
46 AC_CHECK_TOOL(AR, ar, :)
48 # Optional documentation tools
49 AC_CHECK_TOOL(DOXYGEN, doxygen, :)
50 AC_CHECK_TOOL(ASCIIDOC, asciidoc, :)
51 AC_CHECK_TOOL(XMLTO, xmlto, :)
52 AM_CONDITIONAL(CONFIG_HTML, test "x$ASCIIDOC" != "x:")
53 AM_CONDITIONAL(CONFIG_MAN, test "x$ASCIIDOC" != "x:" && test "x$XMLTO" != "x:")
55 #######################################################################
56 ## Checks for libraries.
57 #######################################################################
59 AX_LIB_MYSQL
60 AX_LIB_MYSQLPP
62 #######################################################################
63 ## Checks for header files.
64 #######################################################################
66 AC_HEADER_STDC
67 AC_HEADER_SYS_WAIT
69 AC_CHECK_HEADERS([arpa/inet.h])
70 AC_CHECK_HEADERS([fcntl.h])
71 AC_CHECK_HEADERS([netdb.h])
72 AC_CHECK_HEADERS([netinet/in.h])
73 AC_CHECK_HEADERS([stdlib.h])
74 AC_CHECK_HEADERS([sys/ioctl.h])
75 AC_CHECK_HEADERS([sys/socket.h])
76 AC_CHECK_HEADERS([sys/time.h])
77 AC_CHECK_HEADERS([syslog.h])
78 AC_CHECK_HEADERS([termios.h])
79 AC_CHECK_HEADERS([unistd.h])
81 #######################################################################
82 ## Checks for typedefs, structures, and compiler characteristics.
83 #######################################################################
85 AC_TYPE_INT16_T
86 AC_TYPE_INT32_T
87 AC_TYPE_INT64_T
89 AC_TYPE_UINT8_T
90 AC_TYPE_UINT16_T
91 AC_TYPE_UINT32_T
92 AC_TYPE_UINT64_T
94 AC_TYPE_PID_T
95 AC_TYPE_SSIZE_T
97 AC_C_CONST
98 AC_C_INLINE
100 AC_PROG_GCC_TRADITIONAL
102 AC_HEADER_STDBOOL
103 AC_HEADER_TIME
105 #######################################################################
106 ## Checks for library functions.
107 #######################################################################
109 AC_FUNC_FORK
110 AC_FUNC_VPRINTF
112 AC_CHECK_FUNCS([gethostbyaddr])
113 AC_CHECK_FUNCS([gethostbyname])
114 AC_CHECK_FUNCS([inet_ntoa])
115 AC_CHECK_FUNCS([memset])
116 AC_CHECK_FUNCS([mkfifo])
117 AC_CHECK_FUNCS([select])
118 AC_CHECK_FUNCS([socket])
120 AC_TYPE_SIGNAL
122 #######################################################################
123 ## Check dependencies.
124 #######################################################################
126 AM_CONDITIONAL(CONFIG_MCH, test "x$CONFIG_MCH" = "xyes")
128 if test "x$CONFIG_MCS" = "xyes"; then
129         if test "x$CONFIG_MYSQL" != "xyes" ||
130            test "x$CONFIG_MYSQLPP" != "xyes"; then
131                 if test "x$enable_mcs" = "xyes"; then
132                         AC_MSG_ERROR([MCS dependencies not found on the system])
133                 else
134                         CONFIG_MCS=no
135                 fi
136         fi
138 AM_CONDITIONAL(CONFIG_MCS, test "x$CONFIG_MCS" = "xyes")
140 #######################################################################
141 ## Output files.
142 #######################################################################
144 AC_CONFIG_FILES([
145                  Makefile
146                  doc/Makefile
147                  src/Makefile
148                  src/mch/Makefile
149                  src/mch/notify/Makefile
150                  src/mcs/Makefile
151                  src/protocols/Makefile
152                  src/util/Makefile
154 AC_OUTPUT
156 #######################################################################
157 ## Output build summary.
158 #######################################################################
160 AC_MSG_RESULT([Found dependencies:])
161 AC_MSG_RESULT([  MySQL library ................... $CONFIG_MYSQL])
162 AC_MSG_RESULT([  MySQL++ library ................. $CONFIG_MYSQLPP])
163 AC_MSG_RESULT([Will build:])
164 AC_MSG_RESULT([  Mote control host (MCH) ......... $CONFIG_MCH])
165 AC_MSG_RESULT([  Mote control server (MCS) ....... $CONFIG_MCS])