xref: /openbmc/ipmitool/configure.ac (revision deb9a4ed)
1dnl
2dnl autoconf for ipmitool
3dnl
4AC_INIT([src/ipmitool.c])
5AC_CANONICAL_SYSTEM
6AM_INIT_AUTOMAKE([ipmitool], [1.8.14-cvs])
7AM_CONFIG_HEADER(config.h)
8AC_CONFIG_SRCDIR([src/ipmitool.c])
9AC_PREREQ(2.50)
10AC_SUBST(ac_configure_args)
11
12dnl check for requirements
13AC_PROG_CC
14AC_PROG_INSTALL
15AC_PROG_LN_S
16AC_PROG_MAKE_SET
17AC_CHECK_PROG([RPMBUILD], [rpmbuild], [rpmbuild], [rpm])
18AC_CHECK_PROG([SED], [sed], [sed])
19
20AC_HEADER_STDC
21AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h paths.h])
22AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h sys/socket.h])
23AC_CHECK_HEADERS([sys/byteorder.h byteswap.h])
24
25AC_C_CONST
26AC_C_INLINE
27AC_C_BIGENDIAN
28
29AC_FUNC_MALLOC
30AC_FUNC_SELECT_ARGTYPES
31AC_FUNC_STRTOD
32AC_CHECK_FUNCS([alarm gethostbyname getaddrinfo getifaddrs socket select])
33AC_CHECK_FUNCS([memmove memset strchr strdup strerror])
34AC_CHECK_FUNCS([getpassphrase])
35
36CFLAGS="$CFLAGS -fno-strict-aliasing -Wreturn-type"
37
38AM_PROG_LIBTOOL
39LIBTOOL="$LIBTOOL --silent"
40
41AC_SEARCH_LIBS([gethostbyname], [nsl])
42AC_SEARCH_LIBS([getaddrinfo], [nsl])
43AC_SEARCH_LIBS([getifaddrs], [nsl])
44AC_SEARCH_LIBS([socket], [socket], [],
45	[AC_CHECK_LIB([nsl], [socket],
46		[LIBS="$LIBS -lsocket -lnsl"], [], [-lsocket])])
47
48if test "x$prefix" = "xNONE"; then
49	prefix="$ac_default_prefix"
50fi
51
52if test "x$exec_prefix" = "xNONE"; then
53	exec_prefix="$prefix"
54fi
55
56dnl
57dnl set default option values
58dnl
59
60xenable_intf_bmc=no
61xenable_intf_imb=yes
62xenable_intf_open=yes
63xenable_intf_lipmi=yes
64#xenable_intf_serial=yes
65xenable_intf_dummy=no
66xenable_all_options=yes
67xenable_ipmishell=yes
68
69dnl set some things so we build with GNU tools on Solaris
70case "$host_os" in
71solaris*)
72	MAKE=gmake
73	STRIP=gstrip
74	LD=gld
75	AR=gar
76	# openssl libs are in /usr/sfw/lib on solaris 10
77	LIBS="$LIBS -R/usr/sfw/lib"
78	# disable the linux-specific interfaces
79	xenable_intf_bmc=yes
80	xenable_intf_imb=no
81	xenable_intf_open=no
82	xenable_intf_lipmi=no
83	xenable_ipmishell=no
84	xenable_all_options=no
85	;;
86*cygwin*)
87	# disable the linux and solaris-specific interfaces
88	xenable_intf_imb=no
89	xenable_intf_open=no
90	xenable_intf_lipmi=no
91	xenable_intf_bmc=no
92	;;
93*darwin*|aix*)
94	# disable the linux and solaris-specific interfaces
95	xenable_intf_imb=no
96	xenable_intf_open=no
97	xenable_intf_lipmi=no
98	xenable_intf_bmc=no
99	xenable_ipmishell=no
100	;;
101*freebsd*)
102	xenable_intf_imb=no
103	xenable_intf_lipmi=no
104	xenable_intf_bmc=no
105	;;
106*netbsd*)
107	xenable_intf_imb=no
108	xenable_intf_lipmi=no
109	xenable_intf_bmc=no
110	xenable_intf_open=no
111	;;
112gnu*)
113	# disable the linux and solaris-specific interfaces on Hurd
114	xenable_intf_imb=no
115	xenable_intf_open=no
116	;;
117esac
118
119AC_SUBST(ARCH, $host_cpu)
120AC_SUBST(OS, $host_os)
121AC_SUBST(PSTAMP, $host)
122AC_SUBST(BASEDIR, $prefix)
123
124dnl allow solaris builds to include all options
125AC_ARG_ENABLE([solaris-opt],
126	[AC_HELP_STRING([--enable-solaris-opt],
127			[enable all options for Solaris [default=no]])],
128	[xenable_solaris_opt=$enableval],
129	[xenable_solaris_opt=no])
130if test "x$xenable_all_options" = "xyes" || test "x$xenable_solaris_opt" = "xyes"; then
131	AC_DEFINE(ENABLE_ALL_OPTIONS, [1], [Define to 1 to enable all command line options.])
132fi
133
134dnl check for OpenSSL functionality
135AC_ARG_ENABLE([internal-md5],
136	[AC_HELP_STRING([--enable-internal-md5],
137			[enable internal MD5 library [default=no]])],
138	[xenable_internal_md5=$enableval],
139	[xenable_internal_md5=no])
140
141AC_CHECK_LIB([crypto], [EVP_aes_128_cbc],
142	[if test "x$xenable_internal_md5" != "xyes"; then
143	    have_crypto=yes; LIBS="$LIBS -lcrypto"
144	fi],
145	[have_crypto=no], [-lcrypto])
146
147AC_CHECK_LIB([crypto], [MD5_Init],
148	[if test "x$xenable_internal_md5" != "xyes"; then
149	    if test "x$have_crypto" != "xyes"; then
150	        LIBS="$LIBS -lcrypto"
151	        have_md5=yes
152	    fi
153	    AC_DEFINE(HAVE_CRYPTO_MD5, [1], [Define to 1 if libcrypto supports MD5.])
154	fi],
155	[], [-lcrypto])
156
157AC_CHECK_LIB([crypto], [MD2_Init],
158	[if test "x$xenable_internal_md5" != "xyes"; then
159	    if test "x$have_crypto" != "xyes" && test "x$have_md5" != "xyes"; then
160	        LIBS="$LIBS -lcrypto"
161	        have_md2=yes
162	    fi
163	    AC_DEFINE(HAVE_CRYPTO_MD2, [1], [Define to 1 if libcrypto supports MD2.])
164	fi],
165	[], [-lcrypto])
166
167dnl enable IPMIv1.5 LAN interface
168AC_ARG_ENABLE([intf-lan],
169	[AC_HELP_STRING([--enable-intf-lan],
170			[enable IPMIv1.5 LAN interface [default=yes]])],
171	[xenable_intf_lan=$enableval],
172	[xenable_intf_lan=yes])
173if test "x$xenable_intf_lan" = "xstatic" || test "x$xenable_intf_lan" = "xplugin"; then
174	xenable_intf_lan=yes
175fi
176if test "x$xenable_intf_lan" = "xyes"; then
177	AC_DEFINE(IPMI_INTF_LAN, [1], [Define to 1 to enable LAN IPMIv1.5 interface.])
178	AC_SUBST(INTF_LAN, [lan])
179	AC_SUBST(INTF_LAN_LIB, [libintf_lan.la])
180	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lan/libintf_lan.la"
181fi
182
183dnl enable IPMIv2.0 RMCP+ LAN interface
184AC_ARG_ENABLE([intf-lanplus],
185	[AC_HELP_STRING([--enable-intf-lanplus],
186			[enable IPMIv2.0 RMCP+ LAN interface [default=auto]])],
187	[xenable_intf_lanplus=$enableval],
188	[xenable_intf_lanplus=$have_crypto])
189if test "x$xenable_intf_lanplus" = "xstatic" || test "x$xenable_intf_lanplus" = "xplugin"; then
190	xenable_intf_lanplus=yes
191fi
192if test "x$xenable_intf_lanplus" != "xno" && test "x$have_crypto" != "xyes"; then
193	echo "** The lanplus interface requires an SSL library with EVP_aes_128_cbc defined."
194	xenable_intf_lanplus=no
195fi
196if test "x$xenable_intf_lanplus" = "xyes"; then
197	AC_DEFINE(IPMI_INTF_LANPLUS, [1], [Define to 1 to enable LAN+ IPMIv2 interface.])
198	AC_SUBST(INTF_LANPLUS, [lanplus])
199	AC_SUBST(INTF_LANPLUS_LIB, [libintf_lanplus.la])
200	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lanplus/libintf_lanplus.la"
201else
202	xenable_intf_lanplus=no
203fi
204
205ORIG_CPPFLAGS=$CPPFLAGS
206
207dnl enable serial interface
208AC_ARG_ENABLE([intf-serial],
209	[AC_HELP_STRING([--enable-intf-serial],
210			[enable direct Serial Basic/Terminal mode interface [default=yes]])],
211	[xenable_intf_serial=$enableval], [xenable_intf_serial=yes])
212if test "x$enable_intf_serial" = "xstatic" || test "x$enable_intf_serial" = "xplugin"; then
213   xenable_intf_serial=yes
214fi
215if test "x$xenable_intf_serial" = "xyes"; then
216    AC_DEFINE(IPMI_INTF_SERIAL, [1], [Define to 1 to enable serial interface.])
217    AC_SUBST(INTF_SERIAL, [serial])
218    AC_SUBST(INTF_SERIAL_LIB, [libintf_serial.la])
219    IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB serial/libintf_serial.la"
220else
221	xenable_intf_serial=no
222fi
223
224dnl look for OpenIPMI header files
225AC_ARG_WITH([kerneldir],
226	[AC_HELP_STRING([--with-kerneldir=DIR],
227			[set kernel include path to DIR])],
228	[if test "x$with_kerneldir" = "xyes"; then
229	    with_kerneldir="/lib/modules/`uname -r`/build"
230	fi
231	CFLAGS="$CFLAGS -I ${with_kerneldir}/include"
232	AC_SUBST(CFLAGS)
233	CPPFLAGS="$CPPFLAGS -I ${with_kerneldir}/include"
234	AC_SUBST(CPPFLAGS)
235	if test -s ${with_kerneldir}/include/linux/version.h ; then
236	    kernelver=`grep UTS_RELEASE ${with_kerneldir}/include/linux/version.h | \
237	        sed 's/^\#define UTS_RELEASE \"\(2\.[0-9]\)\..*/\1/'`
238	    if test "x$kernelver" = "x2.6"; then
239	        CPPFLAGS="$CPPFLAGS -D__user="
240	        AC_SUBST(CPPFLAGS)
241	    fi
242	fi])
243
244AH_TEMPLATE([HAVE_LINUX_COMPILER_H], [])
245AC_MSG_CHECKING([for linux/compiler.h])
246
247m4_version_prereq([2.68],
248	[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <linux/compiler.h>]])],
249		[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
250			[Define to 1 if you have the <linux/compiler.h> header file.])
251		AC_MSG_RESULT([yes])],
252		[AC_MSG_RESULT([no])])],
253	[AC_PREPROC_IFELSE([#include <linux/compiler.h>],
254		[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
255		[Define to 1 if you have the <linux/compiler.h> header file.])
256		AC_MSG_RESULT([yes])],
257		[AC_MSG_RESULT([no])])])
258
259CPPFLAGS=$ORIG_CPPFLAGS
260AC_SUBST(CPPFLAGS)
261
262AC_CHECK_HEADER([sys/ioccom.h],
263	[AC_DEFINE(HAVE_SYS_IOCCOM_H, [1],
264	[Define to 1 if you have the <sys/ioccom.h> header file.])])
265
266AC_CHECK_HEADER([linux/ipmi.h],
267	[AC_DEFINE(HAVE_OPENIPMI_H, [1],
268	[Define to 1 if you have the <linux/ipmi.h> header file.])],
269	[AC_CHECK_HEADER([sys/ipmi.h],
270		[AC_DEFINE(HAVE_FREEBSD_IPMI_H, [1],
271		[Define to 1 if you have the <sys/ipmi.h> header file.])],
272		[echo "** Unable to find OpenIPMI header files.  Using internal version."])])
273
274dnl look for FreeIPMI files
275AC_CHECK_LIB(freeipmi, ipmi_open_inband, [have_free=yes], [have_free=no])
276if test "x$have_free" != "xyes"; then
277	AC_CHECK_LIB(freeipmi, ipmi_ctx_open_inband, [have_free=yes], [have_free=no])
278fi
279AC_ARG_ENABLE([intf-free],
280	[AC_HELP_STRING([--enable-intf-free],
281		[enable FreeIPMI IPMI interface [default=auto]])],
282	[xenable_intf_free=$enableval],
283	[xenable_intf_free=$have_free])
284if test "x$xenable_intf_free" = "xstatic" || test "x$xenable_intf_free" = "xplugin"; then
285	xenable_intf_free=yes
286fi
287if test "x$xenable_intf_free" != "xno" && test "x$have_free" != "xyes"; then
288	echo "** Unable to build FreeIPMI interface support!"
289	xenable_intf_free=no
290fi
291if test "x$xenable_intf_free" = "xyes"; then
292dnl Determine if you got the right FreeIPMI version
293    AC_MSG_CHECKING([for libfreeipmi version 0.3.0])
294    AC_TRY_COMPILE([
295#include <sys/types.h>	/* For size_t */
296#include <stdio.h>	/* For NULL */
297#include <freeipmi/freeipmi.h>
298#include <freeipmi/udm/ipmi-udm.h>
299    ], [
300    ipmi_device_t dev;
301    dev = ipmi_open_inband(IPMI_DEVICE_KCS,
302                           0,
303                           0,
304                           0,
305                           NULL,
306                           0);
307    ], ac_free_version_0_3_0=yes, ac_free_version_0_3_0=no)
308    AC_MSG_RESULT($ac_free_version_0_3_0)
309    AC_MSG_CHECKING([for libfreeipmi version 0.4.0])
310    AC_TRY_COMPILE([
311#include <sys/types.h>	/* For size_t */
312#include <stdio.h>	/* For NULL */
313#include <freeipmi/freeipmi.h>
314#include <freeipmi/udm/ipmi-udm.h>
315    ], [
316    ipmi_device_t dev = NULL;
317    int rv;
318    dev = ipmi_device_create();
319    rv = ipmi_open_inband(dev,
320                          IPMI_DEVICE_KCS,
321                          0,
322                          0,
323                          0,
324                          NULL,
325                          0);
326    ], ac_free_version_0_4_0=yes, ac_free_version_0_4_0=no)
327    AC_MSG_RESULT($ac_free_version_0_4_0)
328    AC_MSG_CHECKING([for libfreeipmi version 0.5.0])
329    AC_TRY_COMPILE([
330#include <sys/types.h>	/* For size_t */
331#include <stdio.h>	/* For NULL */
332#include <freeipmi/freeipmi.h>
333#include <freeipmi/udm/ipmi-udm.h>
334    ], [
335    ipmi_device_t dev = NULL;
336    int rv;
337    dev = ipmi_device_create();
338    rv = ipmi_open_inband(dev,
339                          IPMI_DEVICE_KCS,
340                          0,
341                          0,
342                          0,
343                          NULL,
344                          0,
345                          0);
346    ], ac_free_version_0_5_0=yes, ac_free_version_0_5_0=no)
347    AC_MSG_RESULT($ac_free_version_0_5_0)
348
349    AC_MSG_CHECKING([for libfreeipmi version 0.6.0])
350    AC_TRY_COMPILE([
351#include <stdio.h>	/* For NULL */
352#include <freeipmi/freeipmi.h>
353    ], [
354    ipmi_ctx_t ctx = NULL;
355    int rv;
356    ctx = ipmi_ctx_create();
357    rv = ipmi_ctx_open_inband(ctx,
358                              IPMI_DEVICE_KCS,
359                              0,
360                              0,
361                              0,
362                              NULL,
363                              0,
364                              0);
365    ], ac_free_version_0_6_0=yes, ac_free_version_0_6_0=no)
366    AC_MSG_RESULT($ac_free_version_0_6_0)
367
368    if test "x$ac_free_version_0_3_0" = "xyes" \
369       || test "x$ac_free_version_0_4_0" = "xyes" \
370       || test "x$ac_free_version_0_5_0" = "xyes" \
371       || test "x$ac_free_version_0_6_0" = "xyes"; then
372       AC_DEFINE(IPMI_INTF_FREE, [1], [Define to 1 to enable FreeIPMI interface.])
373       AC_SUBST(INTF_FREE, [free])
374       AC_SUBST(INTF_FREE_LIB, [libintf_free.la])
375       IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB free/libintf_free.la"
376       if test "x$ac_free_version_0_3_0" = "xyes"; then
377          AC_DEFINE(IPMI_INTF_FREE_0_3_0, [1], [Define to 1 for FreeIPMI 0.3.0.])
378       fi
379       if test "x$ac_free_version_0_4_0" = "xyes"; then
380          AC_DEFINE(IPMI_INTF_FREE_0_4_0, [1], [Define to 1 for FreeIPMI 0.4.0.])
381       fi
382       if test "x$ac_free_version_0_5_0" = "xyes"; then
383          AC_DEFINE(IPMI_INTF_FREE_0_5_0, [1], [Define to 1 for FreeIPMI 0.5.0.])
384       fi
385       if test "x$ac_free_version_0_6_0" = "xyes"; then
386          AC_DEFINE(IPMI_INTF_FREE_0_6_0, [1], [Define to 1 for FreeIPMI 0.6.0.])
387       fi
388    else
389       xenable_intf_free=no
390    fi
391
392    AC_CHECK_LIB(freeipmi,
393      ipmi_cmd_raw_ipmb,
394      AC_DEFINE(IPMI_INTF_FREE_BRIDGING, [1],
395        [Define to 1 to enable FreeIPMI Bridging Support.]))
396fi
397
398dnl look for termios header file
399AC_CHECK_HEADER([termios.h],
400	[AC_DEFINE(HAVE_TERMIOS_H, [1], [Define to 1 if you have <termios.h>.])],
401	[AC_CHECK_HEADER([sys/termios.h],
402		[AC_DEFINE(HAVE_SYS_TERMIOS_H, [1], [Define to 1 if you have <sys/termios.h>.])],
403		[echo "** Unable to find termios header file."])])
404
405dnl set RPM distro tag for use in RPM name
406AC_ARG_WITH([rpm-distro],
407	[AC_HELP_STRING([--with-rpm-distro=DISTRO],
408			[set Linux distribution tag for use in RPM version string])],
409	[AC_SUBST(DISTRO, $with_rpm_distro)])
410
411dnl set RPM release tag
412AC_ARG_WITH([rpm-release],
413	[AC_HELP_STRING([--with-rpm-release=RELEASE],
414			[set release number for RPM release field])],
415	[], [with_rpm_release=1])
416AC_SUBST(RPM_RELEASE, $with_rpm_release)
417
418dnl enable Linux OpenIPMI interface
419AC_ARG_ENABLE([intf-open],
420	[AC_HELP_STRING([--enable-intf-open],
421			[enable Linux OpenIPMI interface [default=auto]])],
422	[xenable_intf_open=$enableval],
423	[])
424if test "x$xenable_intf_open" = "xstatic" || test "x$xenable_intf_open" = "xplugin"; then
425	xenable_intf_open=yes
426fi
427if test "x$xenable_intf_open" = "xyes"; then
428	AC_DEFINE(IPMI_INTF_OPEN, [1], [Define to 1 to enable Linux OpenIPMI interface.])
429	AC_SUBST(INTF_OPEN, [open])
430	AC_SUBST(INTF_OPEN_LIB, [libintf_open.la])
431	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB open/libintf_open.la"
432
433	dnl Check for dual bridge support in OpenIPMI
434	AC_MSG_CHECKING([for OpenIPMI dual bridge support])
435	have_openipmi_dual_bridge=no
436	ORIG_CPPFLAGS="$CPPFLAGS"
437	CPPFLAGS="$CPPFLAGS -Isrc/plugins/open -DENABLE_INTF_OPEN_DUAL_BRIDGE"
438	AC_TRY_COMPILE([
439			#if defined(HAVE_OPENIPMI_H)
440			# if defined(HAVE_LINUX_COMPILER_H)
441			#  include <linux/compiler.h>
442			# endif
443			# include <linux/ipmi.h>
444			#elif defined(HAVE_FREEBSD_IPMI_H)
445			# include <sys/ipmi.h>
446			#else
447			# include "open.h"
448			#endif
449		], [
450			struct ipmi_ipmb_addr a;
451			a.transit_slave_addr = 0;
452		], [have_openipmi_dual_bridge=yes])
453	if test x"$have_openipmi_dual_bridge" = x"yes"; then
454		AC_DEFINE(ENABLE_INTF_OPEN_DUAL_BRIDGE, [1],
455			[Define to 1 to enable OpenIPMI interface dual bridge support])
456	fi
457	CPPFLAGS="$ORIG_CPPFLAGS"
458	AC_MSG_RESULT([$have_openipmi_dual_bridge])
459fi
460
461dnl enable Intel IMB interface
462AC_ARG_ENABLE([intf-imb],
463	[AC_HELP_STRING([--enable-intf-imb],
464			[enable Intel IMB driver interface [default=auto]])],
465	[xenable_intf_imb=$enableval],
466	[])
467if test "x$xenable_intf_imb" = "xstatic" || test "x$xenable_intf_imb" = "xplugin"; then
468	xenable_intf_imb=yes
469fi
470if test "x$xenable_intf_imb" = "xyes"; then
471	AC_DEFINE(IPMI_INTF_IMB, [1], [Define to 1 to enable Intel IMB interface.])
472	AC_SUBST(INTF_IMB, [imb])
473	AC_SUBST(INTF_IMB_LIB, [libintf_imb.la])
474	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB imb/libintf_imb.la"
475fi
476
477dnl enable Solaris LIPMI interface
478AC_CHECK_HEADER([sys/lipmi/lipmi_intf.h], [have_lipmi=yes], [have_lipmi=no])
479AC_ARG_ENABLE([intf-lipmi],
480	[AC_HELP_STRING([--enable-intf-lipmi],
481			[enable Solaris 9 x86 IPMI interface [default=no]])],
482	[xenable_intf_lipmi=$enableval],
483	[])
484if test "x$xenable_intf_lipmi" = "xstatic" || test "x$xenable_intf_lipmi" = "xplugin"; then
485	xenable_intf_lipmi=yes
486fi
487if test "x$xenable_intf_lipmi" != "xno" && test "x$have_lipmi" != "xyes"; then
488	echo "** Unable to build Solaris 9 x86 IPMI interface support!"
489	xenable_intf_lipmi=no
490fi
491if test "x$xenable_intf_lipmi" = "xyes"; then
492	AC_DEFINE(IPMI_INTF_LIPMI, [1], [Define to 1 to enable Solaris 9 LIPMI interface.])
493	AC_SUBST(INTF_LIPMI, [lipmi])
494	AC_SUBST(INTF_LIPMI_LIB, [libintf_lipmi.la])
495	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lipmi/libintf_lipmi.la"
496fi
497
498dnl enable Solaris BMC interface
499AC_ARG_ENABLE([intf-bmc],
500	[AC_HELP_STRING([--enable-intf-bmc],
501			[enable Solaris 10 x86 IPMI interface [default=auto]])],
502	[xenable_intf_bmc=$enableval],
503	[xenable_intf_bmc=no])
504if test "x$xenable_intf_bmc" = "xstatic" || test "x$xenable_intf_bmc" = "xplugin"; then
505	xenable_intf_bmc=yes
506fi
507if test "x$xenable_intf_bmc" = "xyes"; then
508	AC_DEFINE(IPMI_INTF_BMC, [1], [Define to 1 to enable Solaris 10 BMC interface.])
509	AC_SUBST(INTF_BMC, [bmc])
510	AC_SUBST(INTF_BMC_LIB, [libintf_bmc.la])
511	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
512fi
513
514dnl enable Dummy interface for testing
515AC_ARG_ENABLE([intf-dummy],
516	[AC_HELP_STRING([--enable-intf-dummy],
517			[enable Dummy(test) interface [default=no]])],
518	[xenable_intf_dummy=$enableval], [xenable_intf_dummy=no])
519if test "x$xenable_intf_dummy" = "xyes"; then
520	AC_DEFINE(IPMI_INTF_DUMMY, [1], [Define to 1 to enable Dummy interface.])
521	AC_SUBST(INTF_DUMMY, [dummy])
522	AC_SUBST(INTF_DUMMY_LIB, [libintf_dummy.la])
523	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB dummy/libintf_dummy.la"
524fi
525
526AC_SUBST(IPMITOOL_INTF_LIB)
527
528if test "x$xenable_ipmishell" = "xyes"; then
529	AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
530	AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
531	AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
532	if test "x$have_curses" != "xyes" || test "x$have_readline" != "xyes"; then
533		xenable_ipmishell=no
534	fi
535fi
536
537dnl check for readline library to enable ipmi shell
538AC_ARG_ENABLE([ipmishell],
539	[AC_HELP_STRING([--enable-ipmishell],
540			[enable IPMI shell interface [default=auto]])],
541	[xenable_ipmishell=$enableval],
542	[])
543if test "x$xenable_ipmishell" = "xyes"; then
544	AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
545	AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
546	AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
547	if test "x$have_curses" != "xyes"; then
548		AC_MSG_ERROR([** Unable to find curses required by ipmishell.])
549	fi
550	if test "x$have_readline" != "xyes"; then
551		AC_MSG_ERROR([** Unable to find readline required by ipmishell.])
552	fi
553	AC_DEFINE(HAVE_READLINE, [1], [Define to 1 if readline present.])
554fi
555
556dnl Enable -Wall -Werror
557AC_ARG_ENABLE([buildcheck],
558	[AC_HELP_STRING([--enable-buildcheck],
559			[enable -Wall -Werror for build testing [default=no]])],
560	[xenable_buildcheck=$enableval],
561	[xenable_buildcheck=no])
562if test "x$xenable_buildcheck" != "xno"; then
563	CFLAGS="$CFLAGS -Wall -Werror -Wpointer-arith -Wstrict-prototypes"
564fi
565AC_SUBST(CFLAGS)
566
567dnl Enable extra file security paranoia
568AC_ARG_ENABLE([file-security],
569	[AC_HELP_STRING([--enable-file-security],
570			[enable extra security checks on files opened for read [default=no]])],
571	[xenable_file_security=$enableval],
572	[xenable_file_security=no])
573if test "x$xenable_file_security" != "xno"; then
574	AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for extra file security.])
575fi
576
577
578AC_TRY_COMPILE([],[
579	#include <stdio.h>
580
581	struct packstruct {
582		unsigned char t0       :5;
583		unsigned char t1       :5;
584		unsigned char t2       :5;
585		unsigned char t3       :5;
586		unsigned char t4       :4;
587	} __attribute__ ((packed));
588
589	int
590	main(int argc, char ** argv)
591	{
592	if(sizeof(struct packstruct) != 3)
593	return(1);
594	else
595	return(0);
596	}
597	],
598	[],
599	[AC_DEFINE(HAVE_PRAGMA_PACK,[1],
600		[Define to 1 if you need to use #pragma pack instead of __attribute__ ((packed))])]
601)
602
603
604dnl Generate files for build
605AC_CONFIG_FILES([Makefile
606		doc/Makefile
607		contrib/Makefile
608		control/Makefile
609		control/pkginfo
610		control/prototype
611		control/rpmmacros
612		control/ipmitool.spec
613		lib/Makefile
614		include/Makefile
615		include/ipmitool/Makefile
616		src/Makefile
617		src/plugins/Makefile
618		src/plugins/lan/Makefile
619		src/plugins/lanplus/Makefile
620		src/plugins/open/Makefile
621		src/plugins/free/Makefile
622		src/plugins/imb/Makefile
623		src/plugins/bmc/Makefile
624		src/plugins/lipmi/Makefile
625		src/plugins/serial/Makefile
626		src/plugins/dummy/Makefile])
627
628AC_OUTPUT
629
630AC_MSG_RESULT([])
631AC_MSG_RESULT([ipmitool $VERSION])
632AC_MSG_RESULT([])
633AC_MSG_RESULT([Interfaces])
634AC_MSG_RESULT([  lan     : $xenable_intf_lan])
635AC_MSG_RESULT([  lanplus : $xenable_intf_lanplus])
636AC_MSG_RESULT([  open    : $xenable_intf_open])
637AC_MSG_RESULT([  free    : $xenable_intf_free])
638AC_MSG_RESULT([  imb     : $xenable_intf_imb])
639AC_MSG_RESULT([  bmc     : $xenable_intf_bmc])
640AC_MSG_RESULT([  lipmi   : $xenable_intf_lipmi])
641AC_MSG_RESULT([  serial  : $xenable_intf_serial])
642AC_MSG_RESULT([  dummy   : $xenable_intf_dummy])
643AC_MSG_RESULT([])
644AC_MSG_RESULT([Extra tools])
645AC_MSG_RESULT([  ipmievd   : yes])
646AC_MSG_RESULT([  ipmishell : $xenable_ipmishell])
647AC_MSG_RESULT([])
648
649