-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.ac
107 lines (91 loc) · 3.08 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
AC_PREREQ([2.69])
AC_INIT([netstat], [1.0], [david.l.cantrell@gmail.com])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/netstat.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h paths.h stdlib.h \
string.h strings.h sys/ioctl.h sys/param.h sys/socket.h \
unistd.h],
[],
[AC_MSG_FAILURE([*** Header file $ac_header not found.])],
[])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([setlocale strchr strcspn strrchr strspn strstr strtoul \
strtoull],
[],
[AC_MSG_FAILURE([*** Required function $ac_func not found.])])
# Localization support is optional.
AC_ARG_ENABLE(i18n,
AC_HELP_STRING([--enable-i18n],
[install translations for strings and man pages (default is no)]),
[i18n=$enableval],
[i18n=no])
# SELinux support is conditional and requires libraries.
AC_ARG_ENABLE(selinux,
AC_HELP_STRING([--enable-selinux],
[enable SELinux support (default is no)]),
[selinux=$enableval],
[selinux=no])
if test x$selinux = xyes ; then
AC_CHECK_LIB([selinux], [matchpathcon], [],
[AC_MSG_FAILURE([*** libselinux not usable.])])
AC_CHECK_LIB([selinux], [lsetfilecon], [],
[AC_MSG_FAILURE([*** libselinux not usable.])])
selinux_libs="-lselinux -laudit"
AC_SUBST(SELINUX_CFLAGS, [-DUSESELINUX=1])
AC_SUBST(SELINUX_LIBS, [$selinux_libs])
fi
# IPv6 support (and SIT) is not required
AC_ARG_ENABLE([ipv6],
AC_HELP_STRING([--enable-ipv6],
[enable IPv6 and SIT support (default is no)]),
[ipv6=$enableval],
[ipv6=no])
# Bluetooth support requires additional libraries.
AC_ARG_ENABLE([bluetooth],
AC_HELP_STRING([--enable-bluetooth],
[enable Bluetooth support (default is no)]),
[bluetooth=$enableval],
[bluetooth=no])
# Set conditional variables for Makefile.am files based on
# the --enable-* values.
AM_CONDITIONAL([ENABLE_I18N], [test x$i18n = xyes])
AM_CONDITIONAL([ENABLE_SELINUX], [test x$selinux = xyes])
AM_CONDITIONAL([ENABLE_IPV6], [test x$ipv6 = xyes])
AM_CONDITIONAL([ENABLE_BLUETOOTH], [test x$bluetooth = xyes])
# Filter CFLAGS (remove duplicate flags)
cflags_filter() {
have=
first=1
for flag in $* ; do
if test -z "`echo $have | grep -- $flag`" ; then
if test x$first = x1 ; then
first=2
else
echo -n " "
fi
echo -n $flag
have="$have $flag"
fi
done
}
CFLAGS="$(cflags_filter $CFLAGS)"
AC_CONFIG_FILES([Makefile
src/Makefile
man/Makefile
man/de_DE/Makefile
man/en_US/Makefile
man/fr_FR/Makefile
man/pt_BR/Makefile
po/Makefile])
AC_OUTPUT