1219820Sjeffdnl Process this file with autoconf to produce a configure script.
2219820Sjeff
3219820SjeffAC_PREREQ(2.57)
4219820SjeffAC_INIT(libmlx4, 1.0, general@lists.openfabrics.org)
5219820SjeffAC_CONFIG_SRCDIR([src/mlx4.h])
6219820SjeffAC_CONFIG_AUX_DIR(config)
7219820SjeffAM_CONFIG_HEADER(config.h)
8219820SjeffAM_INIT_AUTOMAKE(libmlx4, 1.0)
9219820SjeffAM_PROG_LIBTOOL
10219820Sjeff
11219820SjeffAC_ARG_WITH([valgrind],
12219820Sjeff    AC_HELP_STRING([--with-valgrind],
13219820Sjeff        [Enable Valgrind annotations (small runtime overhead, default NO)]))
14219820Sjeffif test x$with_valgrind = x || test x$with_valgrind = xno; then
15219820Sjeff    want_valgrind=no
16219820Sjeff    AC_DEFINE([NVALGRIND], 1, [Define to 1 to disable Valgrind annotations.])
17219820Sjeffelse
18219820Sjeff    want_valgrind=yes
19219820Sjeff    if test -d $with_valgrind; then
20219820Sjeff        CPPFLAGS="$CPPFLAGS -I$with_valgrind/include"
21219820Sjeff    fi
22219820Sjefffi
23219820Sjeff
24219820Sjeffdnl Checks for programs
25219820SjeffAC_PROG_CC
26219820Sjeff
27219820Sjeffdnl Checks for libraries
28219820SjeffAC_CHECK_LIB(ibverbs, ibv_get_device_list, [],
29219820Sjeff    AC_MSG_ERROR([ibv_get_device_list() not found.  libmlx4 requires libibverbs.]))
30219820Sjeff
31219820Sjeffdnl Checks for header files.
32219820SjeffAC_CHECK_HEADER(infiniband/driver.h, [],
33219820Sjeff    AC_MSG_ERROR([<infiniband/driver.h> not found.  libmlx4 requires libibverbs.]))
34219820SjeffAC_HEADER_STDC
35219820SjeffAC_CHECK_HEADER(valgrind/memcheck.h,
36219820Sjeff    [AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
37219820Sjeff        [Define to 1 if you have the <valgrind/memcheck.h> header file.])],
38219820Sjeff    [if test $want_valgrind = yes; then
39219820Sjeff        AC_MSG_ERROR([Valgrind memcheck support requested, but <valgrind/memcheck.h> not found.])
40219820Sjeff    fi])
41219820Sjeff
42219820Sjeffdnl Checks for typedefs, structures, and compiler characteristics.
43219820SjeffAC_C_CONST
44219820SjeffAC_CHECK_SIZEOF(long)
45219820SjeffAC_CHECK_MEMBER(struct ibv_context.more_ops,
46219820Sjeff    [AC_DEFINE([HAVE_IBV_MORE_OPS], 1, [Define to 1 if more_ops is a member of ibv_context])],,
47219820Sjeff    [#include <infiniband/verbs.h>])
48219820SjeffAC_CHECK_MEMBER(struct ibv_more_ops.create_xrc_srq,
49219820Sjeff    [AC_DEFINE([HAVE_IBV_XRC_OPS], 1, [Define to 1 if have xrc ops])],,
50219820Sjeff    [#include <infiniband/verbs.h>])
51219820Sjeff
52219820Sjeffdnl Checks for library functions
53219820SjeffAC_CHECK_FUNC(ibv_read_sysfs_file, [],
54219820Sjeff    AC_MSG_ERROR([ibv_read_sysfs_file() not found.  libmlx4 requires libibverbs >= 1.0.3.]))
55219820SjeffAC_CHECK_FUNCS(ibv_dontfork_range ibv_dofork_range ibv_register_driver)
56219820Sjeff
57219820Sjeffdnl Now check if for libibverbs 1.0 vs 1.1
58219820Sjeffdummy=if$$
59219820Sjeffcat <<IBV_VERSION > $dummy.c
60219820Sjeff#include <infiniband/driver.h>
61219820SjeffIBV_DEVICE_LIBRARY_EXTENSION
62219820SjeffIBV_VERSION
63219820SjeffIBV_DEVICE_LIBRARY_EXTENSION=`$CC $CPPFLAGS -E $dummy.c 2> /dev/null | tail -1`
64219820Sjeffrm -f $dummy.c
65219820SjeffAM_CONDITIONAL(HAVE_IBV_DEVICE_LIBRARY_EXTENSION,
66219820Sjeff    test $IBV_DEVICE_LIBRARY_EXTENSION != IBV_DEVICE_LIBRARY_EXTENSION)
67219820SjeffAC_SUBST(IBV_DEVICE_LIBRARY_EXTENSION)
68219820Sjeff
69219820SjeffAC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
70219820Sjeff    [if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
71219820Sjeff        ac_cv_version_script=yes
72219820Sjeff    else
73219820Sjeff        ac_cv_version_script=no
74219820Sjeff    fi])
75219820Sjeff
76219820Sjeffif test $ac_cv_version_script = yes; then
77219820Sjeff    MLX4_VERSION_SCRIPT='-Wl,--version-script=$(srcdir)/src/mlx4.map'
78219820Sjeffelse
79219820Sjeff    MLX4_VERSION_SCRIPT=
80219820Sjefffi
81219820SjeffAC_SUBST(MLX4_VERSION_SCRIPT)
82219820Sjeff
83219820SjeffAC_CONFIG_FILES([Makefile libmlx4.spec])
84219820SjeffAC_OUTPUT
85