1dnl Process this file with autoconf to produce a configure script.
2
3AC_PREREQ(2.57)
4AC_INIT(libibverbs, 1.1.4, general@lists.openfabrics.org)
5AC_CONFIG_SRCDIR([src/ibverbs.h])
6AC_CONFIG_AUX_DIR(config)
7AC_CONFIG_HEADER(config.h)
8AM_INIT_AUTOMAKE(libibverbs, 1.1.4)
9m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
10
11dnl Checks for programs
12AC_PROG_CC
13AC_GNU_SOURCE
14AC_PROG_LN_S
15
16AC_PROG_LIBTOOL
17LT_INIT
18
19AC_ARG_WITH([valgrind],
20    AC_HELP_STRING([--with-valgrind],
21        [Enable Valgrind annotations (small runtime overhead, default NO)]))
22if test x$with_valgrind = x || test x$with_valgrind = xno; then
23    want_valgrind=no
24    AC_DEFINE([NVALGRIND], 1, [Define to 1 to disable Valgrind annotations.])
25else
26    want_valgrind=yes
27    if test -d $with_valgrind; then
28        CPPFLAGS="$CPPFLAGS -I$with_valgrind/include"
29    fi
30fi
31
32dnl Checks for programs
33AC_PROG_CC
34AC_PROG_LN_S
35
36dnl Checks for libraries
37AC_CHECK_LIB(dl, dlsym, [],
38    AC_MSG_ERROR([dlsym() not found.  libibverbs requires libdl.]))
39AC_CHECK_LIB(pthread, pthread_mutex_init, [],
40    AC_MSG_ERROR([pthread_mutex_init() not found.  libibverbs requires libpthread.]))
41
42dnl Checks for header files.
43AC_HEADER_STDC
44AC_CHECK_HEADER(valgrind/memcheck.h,
45    [AC_DEFINE(HAVE_VALGRIND_MEMCHECK_H, 1,
46        [Define to 1 if you have the <valgrind/memcheck.h> header file.])],
47    [if test $want_valgrind = yes; then
48        AC_MSG_ERROR([Valgrind memcheck support requested, but <valgrind/memcheck.h> not found.])
49    fi])
50
51dnl Checks for typedefs, structures, and compiler characteristics.
52AC_C_CONST
53
54AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
55    [if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
56	ac_cv_version_script=yes
57    else
58	ac_cv_version_script=no
59    fi])
60
61if test $ac_cv_version_script = yes; then
62    LIBIBVERBS_VERSION_SCRIPT='-Wl,--version-script=$(srcdir)/src/libibverbs.map'
63else
64    LIBIBVERBS_VERSION_SCRIPT=
65fi
66AC_SUBST(LIBIBVERBS_VERSION_SCRIPT)
67
68AC_CACHE_CHECK(for .symver assembler support, ac_cv_asm_symver_support,
69    [AC_TRY_COMPILE(, [asm("symbol:\n.symver symbol, api@ABI\n");],
70        ac_cv_asm_symver_support=yes,
71        ac_cv_asm_symver_support=no)])
72if test $ac_cv_asm_symver_support = yes; then
73    AC_DEFINE([HAVE_SYMVER_SUPPORT], 1, [assembler has .symver support])
74fi
75
76AC_CONFIG_FILES([Makefile libibverbs.spec])
77AC_OUTPUT
78