File: configure.ac

package info (click to toggle)
tlf 1.3.2-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 3,424 kB
  • sloc: ansic: 25,667; sh: 4,284; makefile: 124
file content (207 lines) | stat: -rw-r--r-- 5,886 bytes parent folder | download
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# Process this file with autoconf to produce a configure script.
AC_INIT([Tlf],
	[1.3.2],
	[tlf-devel@nongnu.org],
	[tlf],
	[https://github.com/Tlf/tlf])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/tlf.h])
AC_CONFIG_MACRO_DIR([macros])
AC_CONFIG_HEADERS([config.h])

dnl Clean compilation output makes compiler warnings more visible
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h \
	sys/ioctl.h sys/socket.h sys/time.h syslog.h termios.h])

# Checks for typedefs, structures, and compiler characteristics.
dnl needed? AC_HEADER_STDBOOL
AC_TYPE_MODE_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T

# Checks for library functions.
dnl obsolescent AC_PROG_GCC_TRADITIONAL
dnl obsolescent AC_FUNC_STRFTIME
AC_CHECK_FUNCS([bzero floor ftruncate gethostbyname memset mkfifo putenv \
	select socket sqrt strcasecmp strchr strcspn strdup strpbrk strspn \
	strstr])

# Checks for libraries.
AC_CHECK_LIB([m], [atan], [
	AC_DEFINE([HAVE_LIBM], [1],
		[Define to 1 if you have the `m' library (-lm).])
	AC_SUBST([LIBM_LIB], [-lm])], [
	AC_MSG_ERROR([m library not found...])])

AX_PTHREAD


##----------------------------------##
## Third party library tests follow ##
##----------------------------------##

dnl Make certain pkg-config is installed
PKG_PROG_PKG_CONFIG([0.16])

AS_IF([test "x$PKG_CONFIG" = x],
	[AC_MSG_ERROR([pkg-config is required to configure $PACKAGE_NAME])])

dnl From /usr/share/aclocal/glib-2.0.m4 on Debian 8.0.
dnl Provides compilation testing of the found glib library for suitability.
AM_PATH_GLIB_2_0

dnl check for cmocka test framework and warn if not installed
have_cmocka="yes"
PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1.0],,[have_cmocka="no"])
AC_CHECK_HEADER([setjmp.h])
AC_CHECK_HEADER([cmocka.h],, [have_cmocka="no"],
[#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
])

if test "${have_cmocka}" = "no"; then
    AC_MSG_WARN([you will need cmocka for running unit tests])
fi


# ncurses and panel required, if not found exit with error message.

dnl macros/ax_with_curses.m4
AX_WITH_CURSES

AS_IF([test "x$ax_cv_curses" != xyes || test "x$ax_cv_curses_color" != xyes],
	[AC_MSG_ERROR([a Curses library with color support is required])])

dnl macros/ax_with_curses_extra.m4
AX_WITH_CURSES_PANEL

AS_IF([test "x$ax_cv_panel" != xyes],
	[AC_MSG_ERROR([the Curses Panel library is required])])


dnl Check if we want to link the Hamradio control libraries (hamlib)
AC_MSG_CHECKING([whether to build Hamlib support])
AC_ARG_ENABLE([hamlib],
	[AS_HELP_STRING([--enable-hamlib],
		[Add support for Ham Radio Control Libraries])],
	[wanthamlib=true],
	[wanthamlib=false])

AS_IF([test "x$wanthamlib" = xtrue], [
	dnl Look for hamlib
	AC_MSG_RESULT([yes])
	hamlib_modules="hamlib >= 1.2.8"
	PKG_CHECK_MODULES([HAMLIB], [$hamlib_modules], [],
		[AC_MSG_ERROR([Hamradio control libraries 1.2.8 or later not found...])])

	tlf_saved_LIBS=$LIBS
	LIBS="$LIBS $HAMLIB_LIBS"

	AC_CHECK_LIB([hamlib], [rig_open], [
		AC_DEFINE([HAVE_LIBHAMLIB], [1],
			[Define to 1 if you have the `hamlib' library (-lhamlib).])], [
		AC_MSG_ERROR([Hamradio control libraries not found!])])

	LIBS=$tlf_saved_LIBS

	tlf_saved_CFLAGS=$CFLAGS
	tlf_saved_CPPFLAGS=$CPPFLAGS
	CFLAGS="$CFLAGS $HAMLIB_CFLAGS"
	CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags-only-I hamlib 2>&1`"

	AC_CHECK_HEADERS([hamlib/rig.h], [], [
		AC_MSG_ERROR([Hamlib headers not found...])])

	CPPFLAGS=$tlf_saved_CPPFLAGS
	CFLAGS=$tlf_saved_CFLAGS], [

	dnl else Hamlib not wanted
	AC_MSG_RESULT([no])])


dnl Check if we want to use xmlrpc to read carrier from Fldigi
AC_MSG_CHECKING([whether to build Fldigi XML RPC support])
AC_ARG_ENABLE([fldigi-xmlrpc],
	[AS_HELP_STRING([--enable-fldigi-xmlrpc],
		[Add support for XMLRPC to read Fldigi's carrier (usually in RTTY/DIGIMODE)])],
	[wantfldigixmlrpc=true],
	[wantfldigixmlrpc=false])

AS_IF([test "x$wantfldigixmlrpc" = xtrue], [
	dnl Look for xmlrpc libraries
	AC_MSG_RESULT([yes])

	AC_CHECK_LIB([xmlrpc], [xmlrpc_read_int], [
		AC_DEFINE([HAVE_LIBXMLRPC], [1],
			[Define to 1 if you have the `xmlrpc' library (-lxmlrpc).])
		AC_SUBST([LIBXMLRPC_LIB], [-lxmlrpc])], [
		AC_MSG_ERROR([xmlrpc library not found...])])

	AC_CHECK_LIB([xmlrpc_client], [xmlrpc_client_cleanup], [
		AC_DEFINE([HAVE_LIBXMLRPC_CLIENT], [1],
			[Define to 1 if you have the `xmlrpc_client' library (-lxmlrpc_client).])
		AC_SUBST([LIBXMLRPC_CLIENT_LIB], [-lxmlrpc_client])], [
		AC_MSG_ERROR([xmlrpc-client library not found...])])

	AC_CHECK_LIB([xmlrpc_util], [xmlrpc_env_init], [
		AC_DEFINE([HAVE_LIBXMLRPC_UTIL], [1],
			[Define to 1 if you have the `xmlrpc_util' library (-lxmlrpc_util).])
		AC_SUBST([LIBXMLRPC_UTIL_LIB], [-lxmlrpc_util])], [
		AC_MSG_ERROR([xmlrpc-util library not found...])])

	AC_CHECK_HEADERS([xmlrpc-c/base.h], [], [
		AC_MSG_ERROR([xmlrpc-c/base.h header not found...])])

	AC_CHECK_HEADERS([xmlrpc-c/client.h], [], [
		AC_MSG_ERROR([xmlrpc-c/client.h header not found...])])], [

	dnl else Fldigi XML RPC not wanted
	AC_MSG_RESULT([no])])


dnl Set warnings for compilation
dnl CFLAGS is reserved for user, so set the AM_* counterpart.
# macros/ax_cflags_warn_all.m4
AX_CFLAGS_WARN_ALL([AM_CFLAGS])

AC_SUBST([AM_CFLAGS])

m4_syscmd([ cd test; perl generate_defs.pl ])


AC_CONFIG_FILES([Makefile
	doc/Makefile
	rules/Makefile
	scripts/Makefile
	share/Makefile
	src/Makefile
	test/Makefile
	tlf.1])

AC_OUTPUT

echo \
"----------------------------------------------------------------------

 ${PACKAGE_NAME} Version ${PACKAGE_VERSION} configuration:

 Prefix         ${prefix}
 Preprocessor   ${CPP} ${CPPFLAGS}
 C Compiler     ${CC} ${CFLAGS}

 Package features:

 With Hamlib	$wanthamlib
 With XML RPC	$wantfldigixmlrpc

-----------------------------------------------------------------------"