root/configure.ac

Revision 0909bada2cdd1549295a414ff169354ed6d038d7, 3.8 kB (checked in by Hans Petter Jansson <hpj@ubuntu-vm.(none)>, 3 years ago)

Implement the first example: list-interfaces.

  • Property mode set to 100644
Line 
1 AC_INIT(configure.ac)
2
3 dnl ----------------------------
4 dnl Automake/autoconf input file
5 dnl ----------------------------
6
7 GLIB_REQUIRED=2.10.0
8 GNUTLS_REQUIRED=1.4.0
9
10 dnl --- Package configuration ---
11
12 AM_INIT_AUTOMAKE(flow, 0.0.0)
13 AM_CONFIG_HEADER(config.h)
14
15 AC_SUBST(VERSION)
16 AC_SUBST(PACKAGE)
17
18 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
19 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package name])
20
21 dnl --- Standard checks ---
22
23 AM_SANITY_CHECK
24 AM_MAINTAINER_MODE
25 AC_CANONICAL_HOST
26
27 AC_C_CONST
28 AC_ISC_POSIX
29 AC_PROG_CC
30 AC_PROG_INSTALL
31 AM_DISABLE_STATIC
32 AM_PROG_LIBTOOL
33
34 dnl --- Dependency checks ---
35
36 PKG_CHECK_MODULES(BASE, \
37     glib-2.0 >= $GLIB_REQUIRED
38     gobject-2.0 >= $GLIB_REQUIRED
39     gthread-2.0 >= $GLIB_REQUIRED
40     gnutls >= $GNUTLS_REQUIRED)
41
42 # The check is likely redundant, but this defines GLIB_GENMARSHAL,
43 # GLIB_MKENUMS and GOBJECT_QUERY for us:
44
45 AM_PATH_GLIB_2_0($GLIB_REQUIRED, :,
46   AC_MSG_ERROR([
47 *** GLib $GLIB_REQUIRED or newer is required. The latest version of
48 *** GLib is always available from ftp://ftp.gtk.org/pub/gtk/.]),
49   gobject gthread)
50
51 GTK_DOC_CHECK([1.4])
52
53 dnl --- OS capabilities ---
54
55 # Define a MAINT-like variable REBUILD which is set if Perl
56 # is found, so autogenerated sources can be rebuilt.
57
58 AC_PATH_PROGS(PERL, perl5 perl)
59
60 REBUILD=\#
61 if test "x$enable_rebuilds" = "xyes" && \
62   test -n "$PERL" && \
63   $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ;
64 then
65   REBUILD=
66 fi
67
68 AC_SUBST(REBUILD)
69
70 # IPv6 (HAVE_IPV6)
71
72 AC_CACHE_CHECK([for IPv6], flow_cv_hasipv6,[
73     AC_COMPILE_IFELSE([
74         #include <sys/types.h>
75         #include <sys/socket.h>
76         #include <netinet/in.h>
77         #include <arpa/inet.h>
78         int main () {
79         struct sockaddr_in6 *sa6_ptr;
80         int family = AF_INET6; }
81         ],
82     flow_cv_hasipv6=yes,
83     flow_cv_hasipv6=no,)
84 ])
85
86 case x$flow_cv_hasipv6 in
87     xyes) AC_DEFINE(HAVE_IPV6, 1, [Have IPv6])
88 esac
89
90 # getaddrinfo (HAVE_GETADDRINFO)
91
92 AC_CACHE_CHECK([for getaddrinfo], flow_cv_hasgetaddrinfo,[
93     AC_COMPILE_IFELSE([
94         #include <sys/types.h>
95         #include <sys/socket.h>
96         #include <netdb.h>
97         int main () {
98         struct addrinfo  hints;
99         struct addrinfo *res = NULL;
100         const char *name = "test";
101         hints.ai_socktype = SOCK_STREAM;
102         getaddrinfo (name, NULL, &hints, &res);
103         if (res) freeaddrinfo (res); }
104         ],
105     flow_cv_hasgetaddrinfo=yes,
106     flow_cv_hasgetaddrinfo=no,)
107 ])
108
109 case x$flow_cv_hasgetaddrinfo in
110     xyes) AC_DEFINE(HAVE_GETADDRINFO, 1, [Have getaddrinfo])
111 esac
112
113 # inet_ntop
114
115 AC_CACHE_CHECK([for inet_ntop], flow_cv_hasntop,[
116     AC_COMPILE_IFELSE([
117         #include <sys/types.h>
118         #include <sys/socket.h>
119         #include <arpa/inet.h>
120         int main () {
121         char *src;
122         char *dest;
123         const char *ret;
124         ret = inet_ntop (AF_INET, src, dest, 64); }
125         ],
126     flow_cv_hasntop=yes,
127     flow_cv_hasntop=no,)
128 ])
129
130 case x$flow_cv_hasntop in
131     xyes) AC_DEFINE(HAVE_INET_NTOP, 1, [Have inet_ntop])
132 esac
133
134 # inet_pton
135
136 AC_CACHE_CHECK([for inet_pton], flow_cv_haspton,[
137     AC_COMPILE_IFELSE([
138         #include <sys/types.h>
139         #include <sys/socket.h>
140         #include <arpa/inet.h>
141         int main () {
142         char *src;
143         char *dest;
144         int ret;
145         ret = inet_pton (AF_INET, src, dest); }
146         ],
147     flow_cv_haspton=yes,
148     flow_cv_haspton=no,)
149 ])
150
151 case x$flow_cv_haspton in
152     xyes) AC_DEFINE(HAVE_INET_PTON, 1, [Have inet_pton])
153 esac
154
155 dnl --- Set compiler flags ---
156
157 BASE_CFLAGS="$BASE_CFLAGS -Wall"
158 FLOW_LIBS="$BASE_LIBS"
159 FLOW_CFLAGS="$BASE_CFLAGS"
160
161 AC_SUBST(FLOW_LIBS)
162 AC_SUBST(FLOW_CFLAGS)
163
164 dnl --- Output ---
165
166 AC_OUTPUT(Makefile                \
167           flow/Makefile           \
168           test/Makefile           \
169           example/Makefile        \
170           doc/Makefile            \
171           doc/reference/Makefile  \
172           doc/reference/version.xml \
173           flow/flow.pc            \
174           flow.spec)
Note: See TracBrowser for help on using the browser.