xref: /openbmc/ipmitool/configure.ac (revision 6ca88cb6)
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 -fno-strict-aliasing -Wreturn-type"
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 check for OpenSSL functionality
134AC_ARG_ENABLE([internal-md5],
135	[AC_HELP_STRING([--enable-internal-md5],
136			[enable internal MD5 library [default=no]])],
137	[xenable_internal_md5=$enableval],
138	[xenable_internal_md5=no])
139
140AC_CHECK_LIB([crypto], [EVP_aes_128_cbc],
141	[if test "x$xenable_internal_md5" != "xyes"; then
142	    have_crypto=yes; LIBS="$LIBS -lcrypto"
143	fi],
144	[have_crypto=no], [-lcrypto])
145
146AC_CHECK_LIB([crypto], [MD5_Init],
147	[if test "x$xenable_internal_md5" != "xyes"; then
148	    if test "x$have_crypto" != "xyes"; then
149	        LIBS="$LIBS -lcrypto"
150	        have_md5=yes
151	    fi
152	    AC_DEFINE(HAVE_CRYPTO_MD5, [1], [Define to 1 if libcrypto supports MD5.])
153	fi],
154	[], [-lcrypto])
155
156AC_CHECK_LIB([crypto], [MD2_Init],
157	[if test "x$xenable_internal_md5" != "xyes"; then
158	    if test "x$have_crypto" != "xyes" && test "x$have_md5" != "xyes"; then
159	        LIBS="$LIBS -lcrypto"
160	        have_md2=yes
161	    fi
162	    AC_DEFINE(HAVE_CRYPTO_MD2, [1], [Define to 1 if libcrypto supports MD2.])
163	fi],
164	[], [-lcrypto])
165
166dnl enable IPMIv1.5 LAN interface
167AC_ARG_ENABLE([intf-lan],
168	[AC_HELP_STRING([--enable-intf-lan],
169			[enable IPMIv1.5 LAN interface [default=yes]])],
170	[xenable_intf_lan=$enableval],
171	[xenable_intf_lan=yes])
172if test "x$xenable_intf_lan" = "xstatic" || test "x$xenable_intf_lan" = "xplugin"; then
173	xenable_intf_lan=yes
174fi
175if test "x$xenable_intf_lan" = "xyes"; then
176	AC_DEFINE(IPMI_INTF_LAN, [1], [Define to 1 to enable LAN IPMIv1.5 interface.])
177	AC_SUBST(INTF_LAN, [lan])
178	AC_SUBST(INTF_LAN_LIB, [libintf_lan.la])
179	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lan/libintf_lan.la"
180fi
181
182dnl enable IPMIv2.0 RMCP+ LAN interface
183AC_ARG_ENABLE([intf-lanplus],
184	[AC_HELP_STRING([--enable-intf-lanplus],
185			[enable IPMIv2.0 RMCP+ LAN interface [default=auto]])],
186	[xenable_intf_lanplus=$enableval],
187	[xenable_intf_lanplus=$have_crypto])
188if test "x$xenable_intf_lanplus" = "xstatic" || test "x$xenable_intf_lanplus" = "xplugin"; then
189	xenable_intf_lanplus=yes
190fi
191if test "x$xenable_intf_lanplus" != "xno" && test "x$have_crypto" != "xyes"; then
192	echo "** The lanplus interface requires an SSL library with EVP_aes_128_cbc defined."
193	xenable_intf_lanplus=no
194fi
195if test "x$xenable_intf_lanplus" = "xyes"; then
196	AC_DEFINE(IPMI_INTF_LANPLUS, [1], [Define to 1 to enable LAN+ IPMIv2 interface.])
197	AC_SUBST(INTF_LANPLUS, [lanplus])
198	AC_SUBST(INTF_LANPLUS_LIB, [libintf_lanplus.la])
199	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lanplus/libintf_lanplus.la"
200else
201	xenable_intf_lanplus=no
202fi
203
204ORIG_CPPFLAGS=$CPPFLAGS
205
206dnl enable serial interface
207AC_ARG_ENABLE([intf-serial],
208	[AC_HELP_STRING([--enable-intf-serial],
209			[enable direct Serial Basic/Terminal mode interface [default=yes]])],
210	[xenable_intf_serial=$enableval], [xenable_intf_serial=yes])
211if test "x$enable_intf_serial" = "xstatic" || test "x$enable_intf_serial" = "xplugin"; then
212   xenable_intf_serial=yes
213fi
214if test "x$xenable_intf_serial" = "xyes"; then
215    AC_DEFINE(IPMI_INTF_SERIAL, [1], [Define to 1 to enable serial interface.])
216    AC_SUBST(INTF_SERIAL, [serial])
217    AC_SUBST(INTF_SERIAL_LIB, [libintf_serial.la])
218    IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB serial/libintf_serial.la"
219else
220	xenable_intf_serial=no
221fi
222
223dnl look for OpenIPMI header files
224AC_ARG_WITH([kerneldir],
225	[AC_HELP_STRING([--with-kerneldir=DIR],
226			[set kernel include path to DIR])],
227	[if test "x$with_kerneldir" = "xyes"; then
228	    with_kerneldir="/lib/modules/`uname -r`/build"
229	fi
230	CFLAGS="$CFLAGS -I ${with_kerneldir}/include"
231	AC_SUBST(CFLAGS)
232	CPPFLAGS="$CPPFLAGS -I ${with_kerneldir}/include"
233	AC_SUBST(CPPFLAGS)
234	if test -s ${with_kerneldir}/include/linux/version.h ; then
235	    kernelver=`grep UTS_RELEASE ${with_kerneldir}/include/linux/version.h | \
236	        sed 's/^\#define UTS_RELEASE \"\(2\.[0-9]\)\..*/\1/'`
237	    if test "x$kernelver" = "x2.6"; then
238	        CPPFLAGS="$CPPFLAGS -D__user="
239	        AC_SUBST(CPPFLAGS)
240	    fi
241	fi])
242
243AH_TEMPLATE([HAVE_LINUX_COMPILER_H], [])
244AC_MSG_CHECKING([for linux/compiler.h])
245
246m4_version_prereq([2.68],
247	[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <linux/compiler.h>]])],
248		[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
249			[Define to 1 if you have the <linux/compiler.h> header file.])
250		AC_MSG_RESULT([yes])],
251		[AC_MSG_RESULT([no])])],
252	[AC_PREPROC_IFELSE([#include <linux/compiler.h>],
253		[AC_DEFINE(HAVE_LINUX_COMPILER_H, [1],
254		[Define to 1 if you have the <linux/compiler.h> header file.])
255		AC_MSG_RESULT([yes])],
256		[AC_MSG_RESULT([no])])])
257
258CPPFLAGS=$ORIG_CPPFLAGS
259AC_SUBST(CPPFLAGS)
260
261AC_CHECK_HEADER([sys/ioccom.h],
262	[AC_DEFINE(HAVE_SYS_IOCCOM_H, [1],
263	[Define to 1 if you have the <sys/ioccom.h> header file.])])
264
265AC_CHECK_HEADER([linux/ipmi.h],
266	[AC_DEFINE(HAVE_OPENIPMI_H, [1],
267	[Define to 1 if you have the <linux/ipmi.h> header file.])],
268	[AC_CHECK_HEADER([sys/ipmi.h],
269		[AC_DEFINE(HAVE_FREEBSD_IPMI_H, [1],
270		[Define to 1 if you have the <sys/ipmi.h> header file.])],
271		[echo "** Unable to find OpenIPMI header files.  Using internal version."])])
272
273dnl look for FreeIPMI files
274AC_CHECK_LIB(freeipmi, ipmi_open_inband, [have_free=yes], [have_free=no])
275if test "x$have_free" != "xyes"; then
276	AC_CHECK_LIB(freeipmi, ipmi_ctx_open_inband, [have_free=yes], [have_free=no])
277fi
278AC_ARG_ENABLE([intf-free],
279	[AC_HELP_STRING([--enable-intf-free],
280		[enable FreeIPMI IPMI interface [default=auto]])],
281	[xenable_intf_free=$enableval],
282	[xenable_intf_free=$have_free])
283if test "x$xenable_intf_free" = "xstatic" || test "x$xenable_intf_free" = "xplugin"; then
284	xenable_intf_free=yes
285fi
286if test "x$xenable_intf_free" != "xno" && test "x$have_free" != "xyes"; then
287	echo "** Unable to build FreeIPMI interface support!"
288	xenable_intf_free=no
289fi
290if test "x$xenable_intf_free" = "xyes"; then
291dnl Determine if you got the right FreeIPMI version
292    AC_MSG_CHECKING([for libfreeipmi version 0.3.0])
293    AC_TRY_COMPILE([
294#include <sys/types.h>	/* For size_t */
295#include <stdio.h>	/* For NULL */
296#include <freeipmi/freeipmi.h>
297#include <freeipmi/udm/ipmi-udm.h>
298    ], [
299    ipmi_device_t dev;
300    dev = ipmi_open_inband(IPMI_DEVICE_KCS,
301                           0,
302                           0,
303                           0,
304                           NULL,
305                           0);
306    ], ac_free_version_0_3_0=yes, ac_free_version_0_3_0=no)
307    AC_MSG_RESULT($ac_free_version_0_3_0)
308    AC_MSG_CHECKING([for libfreeipmi version 0.4.0])
309    AC_TRY_COMPILE([
310#include <sys/types.h>	/* For size_t */
311#include <stdio.h>	/* For NULL */
312#include <freeipmi/freeipmi.h>
313#include <freeipmi/udm/ipmi-udm.h>
314    ], [
315    ipmi_device_t dev = NULL;
316    int rv;
317    dev = ipmi_device_create();
318    rv = ipmi_open_inband(dev,
319                          IPMI_DEVICE_KCS,
320                          0,
321                          0,
322                          0,
323                          NULL,
324                          0);
325    ], ac_free_version_0_4_0=yes, ac_free_version_0_4_0=no)
326    AC_MSG_RESULT($ac_free_version_0_4_0)
327    AC_MSG_CHECKING([for libfreeipmi version 0.5.0])
328    AC_TRY_COMPILE([
329#include <sys/types.h>	/* For size_t */
330#include <stdio.h>	/* For NULL */
331#include <freeipmi/freeipmi.h>
332#include <freeipmi/udm/ipmi-udm.h>
333    ], [
334    ipmi_device_t dev = NULL;
335    int rv;
336    dev = ipmi_device_create();
337    rv = ipmi_open_inband(dev,
338                          IPMI_DEVICE_KCS,
339                          0,
340                          0,
341                          0,
342                          NULL,
343                          0,
344                          0);
345    ], ac_free_version_0_5_0=yes, ac_free_version_0_5_0=no)
346    AC_MSG_RESULT($ac_free_version_0_5_0)
347
348    AC_MSG_CHECKING([for libfreeipmi version 0.6.0])
349    AC_TRY_COMPILE([
350#include <stdio.h>	/* For NULL */
351#include <freeipmi/freeipmi.h>
352    ], [
353    ipmi_ctx_t ctx = NULL;
354    int rv;
355    ctx = ipmi_ctx_create();
356    rv = ipmi_ctx_open_inband(ctx,
357                              IPMI_DEVICE_KCS,
358                              0,
359                              0,
360                              0,
361                              NULL,
362                              0,
363                              0);
364    ], ac_free_version_0_6_0=yes, ac_free_version_0_6_0=no)
365    AC_MSG_RESULT($ac_free_version_0_6_0)
366
367    if test "x$ac_free_version_0_3_0" = "xyes" \
368       || test "x$ac_free_version_0_4_0" = "xyes" \
369       || test "x$ac_free_version_0_5_0" = "xyes" \
370       || test "x$ac_free_version_0_6_0" = "xyes"; then
371       AC_DEFINE(IPMI_INTF_FREE, [1], [Define to 1 to enable FreeIPMI interface.])
372       AC_SUBST(INTF_FREE, [free])
373       AC_SUBST(INTF_FREE_LIB, [libintf_free.la])
374       IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB free/libintf_free.la"
375       if test "x$ac_free_version_0_3_0" = "xyes"; then
376          AC_DEFINE(IPMI_INTF_FREE_0_3_0, [1], [Define to 1 for FreeIPMI 0.3.0.])
377       fi
378       if test "x$ac_free_version_0_4_0" = "xyes"; then
379          AC_DEFINE(IPMI_INTF_FREE_0_4_0, [1], [Define to 1 for FreeIPMI 0.4.0.])
380       fi
381       if test "x$ac_free_version_0_5_0" = "xyes"; then
382          AC_DEFINE(IPMI_INTF_FREE_0_5_0, [1], [Define to 1 for FreeIPMI 0.5.0.])
383       fi
384       if test "x$ac_free_version_0_6_0" = "xyes"; then
385          AC_DEFINE(IPMI_INTF_FREE_0_6_0, [1], [Define to 1 for FreeIPMI 0.6.0.])
386       fi
387    else
388       xenable_intf_free=no
389    fi
390
391    AC_CHECK_LIB(freeipmi,
392      ipmi_cmd_raw_ipmb,
393      AC_DEFINE(IPMI_INTF_FREE_BRIDGING, [1],
394        [Define to 1 to enable FreeIPMI Bridging Support.]))
395fi
396
397dnl look for termios header file
398AC_CHECK_HEADER([termios.h],
399	[AC_DEFINE(HAVE_TERMIOS_H, [1], [Define to 1 if you have <termios.h>.])],
400	[AC_CHECK_HEADER([sys/termios.h],
401		[AC_DEFINE(HAVE_SYS_TERMIOS_H, [1], [Define to 1 if you have <sys/termios.h>.])],
402		[echo "** Unable to find termios header file."])])
403
404dnl set RPM distro tag for use in RPM name
405AC_ARG_WITH([rpm-distro],
406	[AC_HELP_STRING([--with-rpm-distro=DISTRO],
407			[set Linux distribution tag for use in RPM version string])],
408	[AC_SUBST(DISTRO, $with_rpm_distro)])
409
410dnl set RPM release tag
411AC_ARG_WITH([rpm-release],
412	[AC_HELP_STRING([--with-rpm-release=RELEASE],
413			[set release number for RPM release field])],
414	[], [with_rpm_release=1])
415AC_SUBST(RPM_RELEASE, $with_rpm_release)
416
417dnl enable Linux OpenIPMI interface
418AC_ARG_ENABLE([intf-open],
419	[AC_HELP_STRING([--enable-intf-open],
420			[enable Linux OpenIPMI interface [default=auto]])],
421	[xenable_intf_open=$enableval],
422	[])
423if test "x$xenable_intf_open" = "xstatic" || test "x$xenable_intf_open" = "xplugin"; then
424	xenable_intf_open=yes
425fi
426if test "x$xenable_intf_open" = "xyes"; then
427	AC_DEFINE(IPMI_INTF_OPEN, [1], [Define to 1 to enable Linux OpenIPMI interface.])
428	AC_SUBST(INTF_OPEN, [open])
429	AC_SUBST(INTF_OPEN_LIB, [libintf_open.la])
430	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB open/libintf_open.la"
431
432	dnl Check for dual bridge support in OpenIPMI
433	AC_MSG_CHECKING([for OpenIPMI dual bridge support])
434	have_openipmi_dual_bridge=no
435	ORIG_CPPFLAGS="$CPPFLAGS"
436	CPPFLAGS="$CPPFLAGS -Isrc/plugins/open -DENABLE_INTF_OPEN_DUAL_BRIDGE"
437	AC_TRY_COMPILE([
438			#if defined(HAVE_OPENIPMI_H)
439			# if defined(HAVE_LINUX_COMPILER_H)
440			#  include <linux/compiler.h>
441			# endif
442			# include <linux/ipmi.h>
443			#elif defined(HAVE_FREEBSD_IPMI_H)
444			# include <sys/ipmi.h>
445			#else
446			# include "open.h"
447			#endif
448		], [
449			struct ipmi_ipmb_addr a;
450			a.transit_slave_addr = 0;
451		], [have_openipmi_dual_bridge=yes])
452	if test x"$have_openipmi_dual_bridge" = x"yes"; then
453		AC_DEFINE(ENABLE_INTF_OPEN_DUAL_BRIDGE, [1],
454			[Define to 1 to enable OpenIPMI interface dual bridge support])
455	fi
456	CPPFLAGS="$ORIG_CPPFLAGS"
457	AC_MSG_RESULT([$have_openipmi_dual_bridge])
458fi
459
460dnl enable Intel IMB interface
461AC_ARG_ENABLE([intf-imb],
462	[AC_HELP_STRING([--enable-intf-imb],
463			[enable Intel IMB driver interface [default=auto]])],
464	[xenable_intf_imb=$enableval],
465	[])
466if test "x$xenable_intf_imb" = "xstatic" || test "x$xenable_intf_imb" = "xplugin"; then
467	xenable_intf_imb=yes
468fi
469if test "x$xenable_intf_imb" = "xyes"; then
470	AC_DEFINE(IPMI_INTF_IMB, [1], [Define to 1 to enable Intel IMB interface.])
471	AC_SUBST(INTF_IMB, [imb])
472	AC_SUBST(INTF_IMB_LIB, [libintf_imb.la])
473	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB imb/libintf_imb.la"
474fi
475
476dnl enable Solaris LIPMI interface
477AC_CHECK_HEADER([sys/lipmi/lipmi_intf.h], [have_lipmi=yes], [have_lipmi=no])
478AC_ARG_ENABLE([intf-lipmi],
479	[AC_HELP_STRING([--enable-intf-lipmi],
480			[enable Solaris 9 x86 IPMI interface [default=no]])],
481	[xenable_intf_lipmi=$enableval],
482	[])
483if test "x$xenable_intf_lipmi" = "xstatic" || test "x$xenable_intf_lipmi" = "xplugin"; then
484	xenable_intf_lipmi=yes
485fi
486if test "x$xenable_intf_lipmi" != "xno" && test "x$have_lipmi" != "xyes"; then
487	echo "** Unable to build Solaris 9 x86 IPMI interface support!"
488	xenable_intf_lipmi=no
489fi
490if test "x$xenable_intf_lipmi" = "xyes"; then
491	AC_DEFINE(IPMI_INTF_LIPMI, [1], [Define to 1 to enable Solaris 9 LIPMI interface.])
492	AC_SUBST(INTF_LIPMI, [lipmi])
493	AC_SUBST(INTF_LIPMI_LIB, [libintf_lipmi.la])
494	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB lipmi/libintf_lipmi.la"
495fi
496
497dnl enable Solaris BMC interface
498AC_ARG_ENABLE([intf-bmc],
499	[AC_HELP_STRING([--enable-intf-bmc],
500			[enable Solaris 10 x86 IPMI interface [default=auto]])],
501	[xenable_intf_bmc=$enableval],
502	[xenable_intf_bmc=no])
503if test "x$xenable_intf_bmc" = "xstatic" || test "x$xenable_intf_bmc" = "xplugin"; then
504	xenable_intf_bmc=yes
505fi
506if test "x$xenable_intf_bmc" = "xyes"; then
507	AC_DEFINE(IPMI_INTF_BMC, [1], [Define to 1 to enable Solaris 10 BMC interface.])
508	AC_SUBST(INTF_BMC, [bmc])
509	AC_SUBST(INTF_BMC_LIB, [libintf_bmc.la])
510	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB bmc/libintf_bmc.la"
511fi
512
513dnl enable Dummy interface for testing
514AC_ARG_ENABLE([intf-dummy],
515	[AC_HELP_STRING([--enable-intf-dummy],
516			[enable Dummy(test) interface [default=no]])],
517	[xenable_intf_dummy=$enableval], [xenable_intf_dummy=no])
518if test "x$xenable_intf_dummy" = "xyes"; then
519	AC_DEFINE(IPMI_INTF_DUMMY, [1], [Define to 1 to enable Dummy interface.])
520	AC_SUBST(INTF_DUMMY, [dummy])
521	AC_SUBST(INTF_DUMMY_LIB, [libintf_dummy.la])
522	IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB dummy/libintf_dummy.la"
523fi
524
525AC_SUBST(IPMITOOL_INTF_LIB)
526
527if test "x$xenable_ipmishell" = "xyes"; then
528	AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
529	AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
530	AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
531	if test "x$have_curses" != "xyes" || test "x$have_readline" != "xyes"; then
532		xenable_ipmishell=no
533	fi
534fi
535
536dnl check for readline library to enable ipmi shell
537AC_ARG_ENABLE([ipmishell],
538	[AC_HELP_STRING([--enable-ipmishell],
539			[enable IPMI shell interface [default=auto]])],
540	[xenable_ipmishell=$enableval],
541	[])
542if test "x$xenable_ipmishell" = "xyes"; then
543	AC_SEARCH_LIBS([tgetent], [tinfo ncurses curses readline termcap])
544	AC_SEARCH_LIBS([initscr], [ncurses curses], [have_curses=yes])
545	AC_SEARCH_LIBS([readline], [readline edit], [have_readline=yes])
546	if test "x$have_curses" != "xyes"; then
547		AC_MSG_ERROR([** Unable to find curses required by ipmishell.])
548	fi
549	if test "x$have_readline" != "xyes"; then
550		AC_MSG_ERROR([** Unable to find readline required by ipmishell.])
551	fi
552	AC_DEFINE(HAVE_READLINE, [1], [Define to 1 if readline present.])
553fi
554
555dnl Enable -Wall -Werror
556AC_ARG_ENABLE([buildcheck],
557	[AC_HELP_STRING([--enable-buildcheck],
558			[enable -Wall -Werror for build testing [default=no]])],
559	[xenable_buildcheck=$enableval],
560	[xenable_buildcheck=no])
561if test "x$xenable_buildcheck" != "xno"; then
562	CFLAGS="$CFLAGS -Wall -Werror -Wpointer-arith -Wstrict-prototypes"
563fi
564AC_SUBST(CFLAGS)
565
566dnl Enable extra file security paranoia
567AC_ARG_ENABLE([file-security],
568	[AC_HELP_STRING([--enable-file-security],
569			[enable extra security checks on files opened for read [default=no]])],
570	[xenable_file_security=$enableval],
571	[xenable_file_security=no])
572if test "x$xenable_file_security" != "xno"; then
573	AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for extra file security.])
574fi
575
576
577AC_TRY_COMPILE([],[
578	#include <stdio.h>
579
580	struct packstruct {
581		unsigned char t0       :5;
582		unsigned char t1       :5;
583		unsigned char t2       :5;
584		unsigned char t3       :5;
585		unsigned char t4       :4;
586	} __attribute__ ((packed));
587
588	int
589	main(int argc, char ** argv)
590	{
591	if(sizeof(struct packstruct) != 3)
592	return(1);
593	else
594	return(0);
595	}
596	],
597	[],
598	[AC_DEFINE(HAVE_PRAGMA_PACK,[1],
599		[Define to 1 if you need to use #pragma pack instead of __attribute__ ((packed))])]
600)
601
602
603dnl Generate files for build
604AC_CONFIG_FILES([Makefile
605		doc/Makefile
606		contrib/Makefile
607		control/Makefile
608		control/pkginfo
609		control/prototype
610		control/rpmmacros
611		control/ipmitool.spec
612		lib/Makefile
613		include/Makefile
614		include/ipmitool/Makefile
615		src/Makefile
616		src/plugins/Makefile
617		src/plugins/lan/Makefile
618		src/plugins/lanplus/Makefile
619		src/plugins/open/Makefile
620		src/plugins/free/Makefile
621		src/plugins/imb/Makefile
622		src/plugins/bmc/Makefile
623		src/plugins/lipmi/Makefile
624		src/plugins/serial/Makefile
625		src/plugins/dummy/Makefile])
626
627AC_OUTPUT
628
629AC_MSG_RESULT([])
630AC_MSG_RESULT([ipmitool $VERSION])
631AC_MSG_RESULT([])
632AC_MSG_RESULT([Interfaces])
633AC_MSG_RESULT([  lan     : $xenable_intf_lan])
634AC_MSG_RESULT([  lanplus : $xenable_intf_lanplus])
635AC_MSG_RESULT([  open    : $xenable_intf_open])
636AC_MSG_RESULT([  free    : $xenable_intf_free])
637AC_MSG_RESULT([  imb     : $xenable_intf_imb])
638AC_MSG_RESULT([  bmc     : $xenable_intf_bmc])
639AC_MSG_RESULT([  lipmi   : $xenable_intf_lipmi])
640AC_MSG_RESULT([  serial  : $xenable_intf_serial])
641AC_MSG_RESULT([  dummy   : $xenable_intf_dummy])
642AC_MSG_RESULT([])
643AC_MSG_RESULT([Extra tools])
644AC_MSG_RESULT([  ipmievd   : yes])
645AC_MSG_RESULT([  ipmishell : $xenable_ipmishell])
646AC_MSG_RESULT([])
647
648