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