1dnl Process this file with autoconf to produce a configure script. 2 3AC_PREREQ(2.57) 4AC_INIT(infiniband-diags, 1.5.0, general@lists.openfabrics.org) 5AC_CONFIG_AUX_DIR(config) 6AM_CONFIG_HEADER(config.h) 7AM_INIT_AUTOMAKE 8 9AC_SUBST(RELEASE, ${RELEASE:-unknown}) 10AC_SUBST(TARBALL, ${TARBALL:-${PACKAGE}-${VERSION}.tar.gz}) 11 12AC_ARG_ENABLE(libcheck, [ --disable-libcheck do not test for presence of ib libraries], 13[ if test x$enableval = xno ; then 14 disable_libcheck=yes 15 fi 16]) 17 18dnl support debug mode 19AC_ARG_ENABLE(debug, 20[ --enable-debug Turn on debug mode], 21[case "${enableval}" in 22 yes) debug=true ;; 23 no) debug=false ;; 24 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; 25esac],[debug=false]) 26AM_CONDITIONAL(DEBUG, test x$debug = xtrue) 27 28dnl Checks for programs 29AC_PROG_CC 30AC_PROG_LIBTOOL 31 32if test "$disable_libcheck" != "yes" 33then 34dnl Checks for libraries 35AC_CHECK_LIB(ibcommon, sys_read_string, [], 36 AC_MSG_ERROR([sys_read_string() not found. diags require libibcommon.])) 37AC_CHECK_LIB(ibumad, umad_init, [], 38 AC_MSG_ERROR([umad_init() not found. diags require libibumad.])) 39AC_CHECK_LIB(ibmad, mad_dump_int, [], 40 AC_MSG_ERROR([mad_dump_int() not found. diags require libibmad.])) 41AC_CHECK_LIB(ibmad, port_performance_ext_query, [], 42 AC_MSG_ERROR([port_performance_ext_query() not found. diags require more recent libibmad.])) 43AC_CHECK_LIB(osmcomp, cl_thread_init, [], 44 AC_MSG_ERROR([cl_thread_init() not found. diags require libosmcomp.])) 45AC_CHECK_LIB(osmvendor, osmv_query_sa, [], 46 AC_MSG_ERROR([osmv_query_sa() not found. diags require libosmvendor.]), [-lopensm]) 47AC_CHECK_LIB(opensm, osm_log_init_v2, [], 48 AC_MSG_ERROR([osm_log_init_v2() not found. diags require libopensm.])) 49fi 50 51dnl Checks for header files. 52AC_HEADER_STDC 53AC_CHECK_HEADERS([stdlib.h string.h unistd.h fcntl.h inttypes.h netinet/in.h sys/ioctl.h syslog.h]) 54if test "$disable_libcheck" != "yes" 55then 56AC_CHECK_HEADER(infiniband/common.h, [], 57 AC_MSG_ERROR([<infiniband/common.h> not found. diags require libibcommon.]) 58) 59AC_CHECK_HEADER(infiniband/umad.h, [], 60 AC_MSG_ERROR([<infiniband/umad.h> not found. diags require libibumad.]) 61) 62AC_CHECK_HEADER(infiniband/mad.h, [], 63 AC_MSG_ERROR([<infiniband/mad.h> not found. diags require libibmad.]) 64) 65fi 66 67dnl Checks for library functions 68AC_FUNC_ERROR_AT_LINE 69AC_FUNC_VPRINTF 70AC_CHECK_FUNCS([strchr strrchr strtol strtoul memset]) 71 72dnl Checks for typedefs, structures, and compiler characteristics. 73AC_C_CONST 74 75dnl Check if we should include test utilities 76AC_MSG_CHECKING(for --enable-test-utils) 77AC_ARG_ENABLE(test-utils, 78[ --enable-test-utils build additional test utilities], 79[case "${enableval}" in 80 yes) tutils=yes ;; 81 no) tutils=no ;; 82 *) AC_MSG_ERROR(bad value ${enableval} for --enable-test-utils) ;; 83esac],[tutils=no]) 84AM_CONDITIONAL(ENABLE_TEST_UTILS, test x$tutils = xyes) 85AC_MSG_RESULT(${tutils=no}) 86 87dnl Check for perl and perl install location 88AC_MSG_CHECKING(for --with-perl-path ) 89AC_ARG_WITH(perl-path, 90 AC_HELP_STRING([--with-perl-path=path], 91 [define perl location]), 92 [ case "$withval" in 93 no) 94 ;; 95 *) 96 withperlpath=yes 97 PERL=$withval 98 ;; 99 esac ] 100) 101AC_MSG_RESULT(${withperlpath=no}) 102AC_SUBST(PERL) 103 104if test $withperlpath = "no" 105then 106 AC_PATH_PROG([PERL], [perl]) 107fi 108AC_SUBST(PERL) 109 110AC_MSG_CHECKING(for --with-perl-installdir ) 111AC_ARG_WITH(perl-installdir, 112 AC_HELP_STRING([--with-perl-installdir=path], 113 [define perl install path]), 114 [ case "$withval" in 115 no) 116 ;; 117 *) 118 withperlinstalldir=yes 119 PERL_INSTALLDIR=$withval 120 ;; 121 esac ] 122) 123AC_MSG_RESULT(${withperlinstalldir=no}) 124AC_SUBST(PERL_INSTALLDIR) 125 126if test $withperlinstalldir = "no" 127then 128 PERL_INSTALLDIR=`$PERL -e 'use Config; $T=$Config{installsitearch}; print $T;'` 129fi 130AC_SUBST(PERL_INSTALLDIR) 131 132AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script, 133 if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then 134 ac_cv_version_script=yes 135 else 136 ac_cv_version_script=no 137 fi) 138 139AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes") 140 141dnl Make appropriate substitution for IB script path 142dnl Must expand nested unquoting 143IBSCRIPTPATH_TMP1="`eval echo ${sbindir}`" 144IBSCRIPTPATH_TMP2="`echo $IBSCRIPTPATH_TMP1 | sed 's/^NONE/$ac_default_prefix/'`" 145IBSCRIPTPATH="`eval echo $IBSCRIPTPATH_TMP2`" 146AC_SUBST(IBSCRIPTPATH) 147 148AC_CONFIG_FILES([\ 149 Makefile \ 150 infiniband-diags.spec \ 151 include/ibdiag_version.h \ 152 scripts/ibcheckerrors \ 153 scripts/ibcheckerrs \ 154 scripts/ibchecknet \ 155 scripts/ibchecknode \ 156 scripts/ibcheckport \ 157 scripts/ibcheckportstate \ 158 scripts/ibcheckportwidth \ 159 scripts/ibcheckstate \ 160 scripts/ibcheckwidth \ 161 scripts/ibclearcounters \ 162 scripts/ibclearerrors \ 163 scripts/ibdatacounts \ 164 scripts/ibdatacounters \ 165 scripts/ibhosts \ 166 scripts/ibnodes \ 167 scripts/ibswitches \ 168 scripts/ibrouters 169]) 170AC_OUTPUT 171