1219820Sjeffdnl Process this file with autoconf to produce a configure script.
2219820Sjeff
3219820SjeffAC_PREREQ(2.57)
4219820SjeffAC_INIT(libibumad, 1.3.0, general@lists.openfabrics.org)
5219820SjeffAC_CONFIG_SRCDIR([src/umad.c])
6219820SjeffAC_CONFIG_AUX_DIR(config)
7219820SjeffAM_CONFIG_HEADER(config.h)
8219820SjeffAM_INIT_AUTOMAKE
9219820Sjeff
10219820SjeffAC_SUBST(RELEASE, ${RELEASE:-unknown})
11219820SjeffAC_SUBST(TARBALL, ${TARBALL:-${PACKAGE}-${VERSION}.tar.gz})
12219820Sjeff
13219820Sjeffdnl the library version info is available in the file: libibumad.ver
14219820Sjeffibumad_api_version=`grep LIBVERSION $srcdir/libibumad.ver | sed 's/LIBVERSION=//'`
15219820Sjeffif test -z $ibumad_api_version; then
16219820Sjeff    ibumad_api_version=1:0:0
17219820Sjefffi
18219820SjeffAC_SUBST(ibumad_api_version)
19219820Sjeff
20219820SjeffAC_ARG_ENABLE(libcheck, [  --disable-libcheck      do not test for presence of ib libraries],
21219820Sjeff[       if test x$enableval = xno ; then
22219820Sjeff                disable_libcheck=yes
23219820Sjeff        fi
24219820Sjeff])
25219820Sjeff
26219820SjeffAC_ARG_WITH([valgrind],
27219820Sjeff    AC_HELP_STRING([--with-valgrind],
28219820Sjeff        [Enable Valgrind annotations (small runtime overhead, default NO)]))
29219820Sjeffif test x$with_valgrind = x || test x$with_valgrind = xno; then
30219820Sjeff    want_valgrind=no
31219820Sjeff    AC_DEFINE([NVALGRIND], 1, [Define to 1 to disable Valgrind annotations.])
32219820Sjeffelse
33219820Sjeff    want_valgrind=yes
34219820Sjeff    if test -d $with_valgrind; then
35219820Sjeff        CPPFLAGS="$CPPFLAGS -I$with_valgrind/include"
36219820Sjeff    fi
37219820Sjefffi
38219820Sjeff
39219820Sjeffdnl Checks for programs
40219820SjeffAC_PROG_CC
41219820SjeffAC_PROG_CPP
42219820SjeffAC_PROG_INSTALL
43219820SjeffAC_PROG_LN_S
44219820SjeffAC_PROG_MAKE_SET
45219820SjeffAM_PROG_LIBTOOL
46219820Sjeff
47219820Sjeffif test "$disable_libcheck" != "yes"
48219820Sjeffthen
49219820Sjeffdnl Checks for libraries
50219820SjeffAC_CHECK_LIB(ibcommon, sys_read_string, [],
51219820Sjeff	AC_MSG_ERROR([sys_read_string() not found. libibumad requires libibcommon.]))
52219820Sjefffi
53219820Sjeff
54219820Sjeffdnl Checks for header files.
55219820SjeffAC_HEADER_DIRENT
56219820SjeffAC_HEADER_STDC
57219820SjeffAC_CHECK_HEADERS([fcntl.h netinet/in.h stdlib.h string.h sys/ioctl.h unistd.h])
58219820Sjeffif test "$disable_libcheck" != "yes"
59219820Sjeffthen
60219820SjeffAC_CHECK_HEADER(infiniband/common.h, [],
61219820Sjeff	AC_MSG_ERROR([<infiniband/common.h> not found. libibumad requires libibcommon.])
62219820Sjeff)
63219820Sjefffi
64219820Sjeff
65219820Sjeffdnl Checks for library functions
66219820SjeffAC_PROG_GCC_TRADITIONAL
67219820SjeffAC_FUNC_MALLOC
68219820SjeffAC_CHECK_FUNCS([memset])
69219820Sjeff
70219820Sjeffdnl Checks for typedefs, structures, and compiler characteristics.
71219820SjeffAC_C_INLINE
72219820Sjeff
73219820SjeffAC_CHECK_HEADER(valgrind/memcheck.h,
74219820Sjeff    [AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
75219820Sjeff        [Define to 1 if you have the <valgrind/memcheck.h> header file.])],
76219820Sjeff    [if test $want_valgrind = yes; then
77219820Sjeff        AC_MSG_ERROR([Valgrind memcheck support requested, but <valgrind/memcheck.h> not found.])
78219820Sjeff    fi])
79219820Sjeff
80219820SjeffAC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
81219820Sjeff    if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
82219820Sjeff        ac_cv_version_script=yes
83219820Sjeff    else
84219820Sjeff        ac_cv_version_script=no
85219820Sjeff    fi)
86219820Sjeff
87219820SjeffAM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
88219820Sjeff
89219820SjeffAC_CONFIG_FILES([Makefile libibumad.spec])
90219820SjeffAC_OUTPUT
91