-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure.ac
94 lines (78 loc) · 2.76 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
#
# NFB framework configure script
#
# Copyright (C) 2018 CESNET
# Author(s):
# Martin Spinler <spinler@cesnet.cz>
# ----[ SECTION: Autoconf setup ]---- #
AC_PREREQ([2.63])
AC_INIT([nfb-framework], m4_esyscmd([cut -f1 ./VERSION | tr -d '\n']))
RELEASE=$(grep 'RELEASE *=' Makefile | cut -d= -f2 | xargs)
AC_SUBST(RELEASE)
# ----[ SECTION: Settings ]---- #
check_drivers=yes
AC_ARG_ENABLE([drivers],
[AS_HELP_STRING([--disable-drivers], [Disable checking for driver-related features])],
[check_drivers=$enableval],
[check_drivers=yes]
)
# ----[ SECTION: Check installed stuff ]---- #
AC_PROG_CC
AC_CHECK_LIB([fdt], [fdt_check_header], [], [AC_MSG_FAILURE([libfdt not available])])
AC_CHECK_LIB([numa], [numa_available], [], [AC_MSG_FAILURE([libnuma not available])])
AC_CHECK_LIB([ncurses], [initscr], [], [AC_MSG_FAILURE([libncurses not available])])
AC_CHECK_LIB([archive], [archive_read_open_filename], [], [AC_MSG_FAILURE([libarchive not available])])
# We should check standard headers here, but they really are present usually,
# plus the compilation will fail and complain, plus we cannot do anything but
# fail the ./configure here anyway.
# The same goes for types and functions
# ----[ SECTION: Configure paths to required headers ]---- #
AC_ARG_WITH([driver-headers],
[AC_HELP_STRING([--with-driver-headers=PATH], [Set path to nfb driver headers])],
[ # --with-driver-headers was specified
DRIVER_CFLAGS="-I$withval"
]
)
AC_SUBST(DRIVER_CFLAGS)
AC_ARG_WITH([libnfb],
[AC_HELP_STRING([--with-libnfb=PATH], [Set path to libnfb])],
[ # --with-libnfb was specified
LIBNFB_CFLAGS="-I$withval/include"
LIBNFB_LDFLAGS="-L$withval"
]
)
AC_SUBST(LIBNFB_CFLAGS)
AC_SUBST(LIBNFB_LDFLAGS)
AC_ARG_WITH([kernel],
AS_HELP_STRING([--with-kernel=DIR],[use kernel build directory DIR]),
[ # --with-kernel was specified
test "$withval" == "yes" && AC_MSG_ERROR([no path specified in --with-kernel]);
KDIR="$withval"
],
[
KDIR="/lib/modules/$(uname -r)/build"
]
)
AC_SUBST(KDIR)
if test "x${check_drivers}" == "xyes"; then
test -d "$KDIR" ||
AC_MSG_ERROR([kernel build directory $KDIR does not exist])
test -f "$KDIR/include/linux/types.h" ||
AC_MSG_ERROR([cannot find include/linux/types.h in $KDIR, use proper kernel build directory])
fi
# ----[ SECTION: Enable optional features ]---- #
NFB_DEBUG=no
AC_ARG_WITH([debug],
[AC_HELP_STRING([--with-debug], [Enable debugging messages])],
[
NFB_DEBUG=yes
]
)
AC_SUBST(NFB_DEBUG)
# ----[ SECTION: Fix variables for x86_64 ]---- #
libdir='${prefix}/lib64'
# ----[ SECTION: Generate output ]---- #
AC_CONFIG_FILES(drivers/dkms.conf drivers/Makefile utils/nfb-framework.pc utils/netcope-common.pc)
AC_CONFIG_SUBDIRS([drivers])
AC_OUTPUT