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