forked from cederom/LibSWD
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
109 lines (106 loc) · 2.99 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
AC_INIT([libswd], [GIT-][m4_esyscmd_s([git rev-parse --short HEAD])], [[email protected]])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_ARG_ENABLE([application],
AS_HELP_STRING([--enable-application],
[build the LibSWD Application (default: no)]),
[case "${enableval}" in
yes) enable_application=true ;;
no) enable_application=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-application]) ;;
esac],
[enable_application=false]
)
AM_CONDITIONAL([APPLICATION], [test x"$enable_application" = x"true"])
LIBREADLINE=
AS_IF([test x"$enable_application" == x"true"],
[
AC_CHECK_LIB([readline], [readline],
[AC_SUBST([LIBREADLINE], ["-lreadline"])
AC_DEFINE([HAVE_READLINE], [1], [Define if you have libreadline])],
[AC_MSG_FAILURE([Readline not found, required by LibSWD Application!])]
)
]
)
LIBFTDI=
AS_IF([test x"$enable_application" == x"true"],
[
AC_CHECK_LIB([ftdi], [ftdi_new],
[AC_SUBST([LIBFTDI], ["-lftdi"])
AC_DEFINE([HAVE_FTDI], [1], [Define if you have libftdi])],
)
]
)
LIBFTDI1=
AS_IF([test x"$enable_application" == x"true"],
[
AC_CHECK_LIB([ftdi1], [ftdi_new],
[AC_SUBST([LIBFTDI], ["-lftdi1"])
AC_DEFINE([HAVE_FTDI1], [1], [Define if you have libftdi1])],
)
]
)
LIBUSB=
AS_IF([test x"$enable_application" == x"true"],
[
AS_IF(
[test `uname` == "FreeBSD"],
[
AC_CHECK_LIB([usb], [libusb_init],
[AC_SUBST([LIBUSB], ["-lusb"])
AC_DEFINE([HAVE_USB1], [1], [Define if you have libusb-1])]
,[AC_MSG_WARN([LibUSB-1 not found, no async USB I/O available...])]
)
],
[
AC_CHECK_LIB([usb-1.0], [libusb_init],
[AC_SUBST([LIBUSB], ["-lusb-1.0"])
AC_DEFINE([HAVE_USB1], [1], [Define if you have libusb-1])]
,[AC_MSG_WARN([LibUSB-1 not found, no async USB I/O available...])]
)
]
)
]
)
#Check if we have LibFTDI. If using LibFTDI1 also verify LibUSB1 presence.
AS_IF([test x"$enable_application" == x"true"],
[
AC_CHECK_DECL(HAVE_FTDI1,
[
AC_CHECK_DECL(HAVE_USB1,
[AC_MSG_NOTICE([LibFTDI1+LibUSB1 found, async USB I/O available!])],
[AC_MSG_FAILURE([LibFTDI1 requires LibUSB1, but it was not found!])]
)
],
[
AC_CHECK_DECL(HAVE_FTDI,
[AC_MSG_NOTICE([Old LibFTDI found, no async USB I/O available!])],
[AC_MSG_FAILURE([Neither LibFTDI nor LibFTDI1 was found, but required by LibSWD Application!])]
)
]
)
]
)
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug], [build with Debug Symbols (default: no)]),
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],
[debug=false]
)
AM_CONDITIONAL(DEBUG, test x"$debug" = x"true")
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
DX_PDF_FEATURE(ON)
DX_HTML_FEATURE(ON)
DX_PS_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_INIT_DOXYGEN($PACKAGE_STRING)
m4_pattern_allow([AM_PROG_AR])
AM_PROG_AR
AC_PROG_CC
LT_INIT
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT