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