summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: f2ccce65600e5b72f89a96e6b7b22a5080bc4df8 (plain)
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
95
96
97
98
99
100
101
102
#
# Copyright 2010 Ettus Research LLC
#

##################################################
## Setup Autotools
##################################################
AC_PREREQ(2.60)
AC_INIT
AM_INIT_AUTOMAKE(usrp_uhd, 0)

##################################################
## Setup C++ and Libtool
##################################################
AC_PROG_CXX
LT_INIT

##################################################
## Check Boost
##################################################
AC_DEFUN([UHD_CHECK_BOOST],[$1
    AC_LANG_PUSH([C++])
    AC_COMPILE_IFELSE(AC_LANG_PROGRAM(
        [[@%:@include <boost/static_assert.hpp>]],
        [[
            #ifdef $2
                BOOST_STATIC_ASSERT(true);
            #else
                BOOST_STATIC_ASSERT(false);
            #endif
            return 0;
        ]]
    ), [$3], [$4])
    AC_LANG_POP([C++])
])

UHD_CHECK_BOOST(
    [AX_BOOST_BASE([1.36])], [HAVE_BOOST],
    [], [AC_MSG_ERROR("cannot find boost")]
)
UHD_CHECK_BOOST(
    [AX_BOOST_ASIO], [HAVE_BOOST_ASIO],
    [], [AC_MSG_ERROR("cannot find boost asio")]
)
UHD_CHECK_BOOST(
    [AX_BOOST_THREAD], [HAVE_BOOST_THREAD],
    [], [AC_MSG_ERROR("cannot find boost thread")]
)
UHD_CHECK_BOOST(
    [AX_BOOST_UNIT_TEST_FRAMEWORK], [HAVE_BOOST_UNIT_TEST_FRAMEWORK],
    [HAVE_UNIT_TEST=true], [HAVE_UNIT_TEST=false]
)
AM_CONDITIONAL([HAVE_UNIT_TEST], [$HAVE_UNIT_TEST])

##################################################
## Check Headers
##################################################
AC_DEFUN([UHD_CHECK_HEADER],[
    AC_CHECK_HEADER([$1], [], [AC_MSG_ERROR("cannot find header $1")])
])

UHD_CHECK_HEADER([arpa/inet.h])
UHD_CHECK_HEADER([netinet/ether.h])

##################################################
## Check Flags
##################################################
AC_DEFUN([UHD_OPTIONAL_CXXFLAG],[
    AX_CXX_CHECK_FLAG([$1], [], [], [CXXFLAGS="${CXXFLAGS} $1"])
])

UHD_OPTIONAL_CXXFLAG([-Wall])
UHD_OPTIONAL_CXXFLAG([-Wextra])
UHD_OPTIONAL_CXXFLAG([-Werror])
UHD_OPTIONAL_CXXFLAG([-pedantic])
UHD_OPTIONAL_CXXFLAG([-ansi])

##################################################
## Check Programs
##################################################
AC_PATH_PROG(SED, sed)
AC_PATH_PROG(PYTHON, python)

##################################################
## Create Files
##################################################
AC_CONFIG_FILES([ \
	Makefile \
	include/Makefile \
	include/usrp_uhd/Makefile \
	include/usrp_uhd/usrp/Makefile \
	include/usrp_uhd/usrp/dboard/Makefile \
	include/usrp_uhd/usrp/mboard/Makefile \
	include/usrp_uhd/quadradio/Makefile \
	lib/Makefile \
	lib/usrp/Makefile \
	lib/usrp/dboard/Makefile \
	lib/usrp/mboard/Makefile \
	lib/quadradio/Makefile \
	test/Makefile \
])
AC_OUTPUT