-
Notifications
You must be signed in to change notification settings - Fork 37
/
configure.ac
111 lines (91 loc) · 2.94 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
m4_define([LIBUL_MAJOR], 1)
m4_define([LIBUL_MINOR], 2)
m4_define([LIBUL_MICRO], 1)
m4_define([LIBUL_RC],)
AC_INIT([libuldaq],[LIBUL_MAJOR[.]LIBUL_MINOR[.]LIBUL_MICRO[]LIBUL_RC],[info@mccdaq.com],[libuldaq],[http://www.mccdaq.com])
# Library versioning
# These numbers should be tweaked on every release. Read carefully:
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
# http://sourceware.org/autobook/autobook/autobook_91.html
lt_current=3
lt_revision=1
lt_age=2
LTLDFLAGS="-version-info ${lt_current}:${lt_revision}:${lt_age}"
CFLAGS='-O3'
CXXFLAGS='-O3'
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AM_PROG_AR
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PREREQ([2.69])
AC_PROG_CXX
AC_PROG_CC
LT_INIT
libul_lib_error() {
echo ""
echo " Library $1 was not found on this system."
echo " Please install it and re-run ./configure"
echo ""
exit 1
}
AC_MSG_CHECKING([operating system])
AC_MSG_RESULT($host)
case $host in
*-linux*)
AC_MSG_RESULT([ Linux])
AC_DEFINE(OS_LINUX, 1, [Linux implementations])
AC_SUBST(OS_LINUX)
backend="linux"
os="linux"
;;
*-darwin*)
AC_MSG_RESULT([ Mac OS X])
AC_DEFINE(OS_DARWIN, 1, [Mac implementation])
AC_SUBST(OS_DARWIN)
backend="mac"
os="darwin"
LIBS="${LIBS} -framework IOKit -framework CoreFoundation"
;;
*)
AC_MSG_ERROR([UL for Linux is not supported on your operating system yet])
esac
# Checks for libraries.
AC_CHECK_LIB([usb-1.0], [libusb_init], [], [libul_lib_error libusb-1.0])
AC_CHECK_HEADERS([libusb-1.0/libusb.h], [], [libul_lib_error libusb-1.0])
# OS info for Automake
AM_CONDITIONAL(OS_LINUX, test "x$os" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$os" = xdarwin)
# Examples build
AC_ARG_ENABLE([examples], AS_HELP_STRING([--disable-examples], [disable building example applications [default=no]]))
AM_CONDITIONAL(BUILD_EXAMPLES, test "x$enable_examples" != xno)
# Debug enable
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging [default=no]]))
AM_CONDITIONAL(DEBUG, test "x$enable_debug" = xyes)
if test "$enable_debug" = "yes"; then
CFLAGS="-DDEBUG -O0 -g3"
CXXFLAGS="-DDEBUG -O0 -g3"
AC_MSG_NOTICE([---------------- Debug mode enabled -----------------])
fi
# Check if g++ supports -Wno-psabi flag
if test "$os" = "linux"; then
AC_LANG_PUSH([C++])
original_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -Wno-psabi"
AC_MSG_CHECKING([if g++ supports -Wno-psabi flag])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[flag_supported=yes],[flag_supported=no])
AC_MSG_RESULT($flag_supported)
if test "$flag_supported" = "no"; then
CXXFLAGS="$original_CXXFLAGS"
fi
AC_LANG_POP([C++])
fi
AC_SUBST(LTLDFLAGS)
# Silence warning: ar: 'u' modifier ignored since 'D' is the default
AC_SUBST(AR_FLAGS, [cr])
AC_CONFIG_FILES([libuldaq.pc])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([examples/Makefile])
AC_OUTPUT