summaryrefslogtreecommitdiffstats
path: root/configure.ac
blob: f4453278cb633e67e526e9ea0fa78bf574811cff (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#
# Copyright 2010 Ettus Research LLC
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

##################################################
## 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_COMPILE_IFELSE(AC_LANG_PROGRAM([],[[
        #ifndef $2
            fail
        #endif
        return 0;
    ]]), [$3], [$4])
])

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_DATE_TIME], [HAVE_BOOST_DATE_TIME],
    [], [AC_MSG_ERROR("cannot find boost date time")]
)
UHD_CHECK_BOOST(
    [AX_BOOST_PROGRAM_OPTIONS], [HAVE_BOOST_PROGRAM_OPTIONS],
    [], [AC_MSG_ERROR("cannot find boost program options")]
)
UHD_CHECK_BOOST(
    [AX_BOOST_SYSTEM], [HAVE_BOOST_SYSTEM],
    [], [AC_MSG_ERROR("cannot find boost system")]
)
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