File: configure.ac

package info (click to toggle)
skstream 0.3.5-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,700 kB
  • ctags: 382
  • sloc: sh: 8,247; cpp: 2,317; makefile: 113
file content (410 lines) | stat: -rw-r--r-- 8,926 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
dnl Initialise autoconf

AC_INIT(skstream, 0.3.5, alriddoch@zepler.org)
AC_CONFIG_SRCDIR(skstream/skstream.cpp)
AC_CONFIG_HEADERS([config.h])

dnl Detect the canonical host environment

AC_CANONICAL_HOST

dnl Initialise automake

AM_INIT_AUTOMAKE([dist-bzip2 check-news])

SKSTREAM_CURRENT=3
SKSTREAM_REVISION=0
SKSTREAM_AGE=0
SKSTREAM_VERSION_INFO=$SKSTREAM_CURRENT:$SKSTREAM_REVISION:$SKSTREAM_AGE
SKSTREAM_VERSION_NO=$SKSTREAM_CURRENT.$SKSTREAM_AGE.$SKSTREAM_REVISION

SKSTREAM_UNIX_PC=
SKSTREAM_UNIX_PC_IN=
SKSTREAM_LIB_SUFFIX="-0.3"
SKSTREAM_LIBS="-lskstream$SKSTREAM_LIB_SUFFIX"
SKSTREAM_EXTRA_LIBS=

AC_SUBST(SKSTREAM_CURRENT)
AC_SUBST(SKSTREAM_VERSION_INFO)
AC_SUBST(SKSTREAM_VERSION_NO)

dnl Test for GNU libtool

AC_DISABLE_STATIC
AC_PROG_LIBTOOL

dnl Test for C++ compiler

AC_PROG_CXX

AC_ARG_ENABLE(debug,
    [  --enable-debug          enable debug information [default=no]],
    [
        if test "$enableval" = "yes"; then
            CXXFLAGS="$CXXFLAGS -Wall -DDEBUG"
        else
            CXXFLAGS="$CXXFLAGS -Wall -DNDEBUG"
        fi
    ],[
        CXXFLAGS="$CXXFLAGS -Wall -DNDEBUG"
    ]
)

dnl Test for ANSI standard language features

dnl Test for C++ bool keyword

AC_LANG(C++)

dnl Test for C++ Standard Library

AC_CHECK_HEADERS(cstdio iostream string)

dnl Test for mingw32

# There might be a better way to do this.
AC_MSG_CHECKING(for mingw32)
AC_TRY_COMPILE(,[
#ifdef __MINGW32__
#error MingW32 detected, adding -lws2_32 and -lwsock32 to LIBS
#endif
],
AC_MSG_RESULT(no),[
AC_MSG_RESULT(yes)
LIBS="$LIBS -lws2_32 -lwsock32"
SKSTREAM_EXTRA_LIBS="$SKSTREAM_EXTRA_LIBS -lws2_32 -lwsock32"
])

dnl Test for types

AC_MSG_CHECKING([for socket type])
SKSTREAM_SOCKET_TYPE=int;
SKSTREAM_SOCKET_HEADER="#include <unistd.h>"
AC_CACHE_VAL(ac_cv_socket_type,
[
    AC_TRY_COMPILE([#include <ws2tcpip.h>],
    [
        SOCKET foo;
    ],
    [
        ac_cv_socket_type=SOCKET
        SKSTREAM_SOCKET_TYPE=$ac_cv_socket_type
        SKSTREAM_SOCKET_HEADER="#include <ws2tcpip.h>"
    ],
    [
        ac_cv_socket_type=int
        SKSTREAM_SOCKET_TYPE=$ac_cv_socket_type
        SKSTREAM_SOCKET_HEADER="#include <unistd.h>"
    ])
])
AC_MSG_RESULT($ac_cv_socket_type)
AC_SUBST(SKSTREAM_SOCKET_TYPE)
AC_SUBST(SKSTREAM_SOCKET_HEADER)

AC_MSG_CHECKING([for socket address length type])
SKSTREAM_SOCKLEN_TYPE=int;
AC_CACHE_VAL(ac_cv_socklen_type,
[
    AC_TRY_COMPILE([#include <unistd.h>
                    #include <sys/socket.h>],
    [
        socklen_t foo;
    ],
    [
        ac_cv_socklen_type=socklen_t
        SKSTREAM_SOCKLEN_TYPE=$ac_cv_socklen_type
    ],
    [
        ac_cv_socklen_type=int
        SKSTREAM_SOCKLEN_TYPE=$ac_cv_socklen_type
    ])
])
AC_MSG_RESULT($ac_cv_socklen_type)
AC_SUBST(SKSTREAM_SOCKLEN_TYPE)

AC_MSG_CHECKING([for unix domain sockets])
AC_TRY_COMPILE([#include <sys/types.h>
                #include <sys/socket.h>
                #include <sys/un.h>],
[
    sockaddr_un sa;
    sa.sun_family = AF_UNIX;
],
[
    AC_MSG_RESULT(yes)
    AC_DEFINE(SKSTREAM_UNIX_SOCKETS, 1,
              [Define if unix domain sockets are supported])
    SKSTREAM_UNIX_PC=skstream-unix-0.3.pc
    SKSTREAM_UNIX_PC_IN=skstream-unix-0.3.pc.in
],
[
    AC_MSG_RESULT(no)
])

AC_SUBST(SKSTREAM_UNIX_PC)
AC_SUBST(SKSTREAM_UNIX_PC_IN)

AC_MSG_CHECKING([for timeval header])
SKSTREAM_TIMEVAL_HEADER="#include <sys/time.h>"
SKSTREAM_UNIX_HEADER_FLAG=0
SKSTREAM_BEOS_HEADER_FLAG=0
SKSTREAM_WINDOWS_HEADER_FLAG=0
AC_CACHE_VAL(ac_cv_timeval_header,
[
    AC_TRY_COMPILE([#include <winsock2.h>],
    [
        timeval foo;
    ],
    [
        ac_cv_timeval_header="#include <winsock2.h>"
        SKSTREAM_TIMEVAL_HEADER=$ac_cv_timeval_header
        SKSTREAM_WINDOWS_HEADER_FLAG=1
    ],
    [
        AC_TRY_COMPILE([#include <sys/time.h>],
        [
            timeval foo;
        ],
        [
            ac_cv_timeval_header="#include <sys/time.h>"
            SKSTREAM_TIMEVAL_HEADER=$ac_cv_timeval_header
            SKSTREAM_UNIX_HEADER_FLAG=1
        ],
        [
            AC_TRY_COMPILE([#include <net/socket.h>],
            [
                timeval foo;
            ],
            [
                ac_cv_timeval_header="#include <net/socket.h>"
                SKSTREAM_TIMEVAL_HEADER=$ac_cv_timeval_header
                SKSTREAM_BEOS_HEADER_FLAG=1
            ],
            [
                AC_MSG_ERROR(Unable to find header for timeval type)
            ])
    
        ])
    ])
])
AC_MSG_RESULT($ac_cv_timeval_header)
AC_SUBST(SKSTREAM_TIMEVAL_HEADER)
AC_SUBST(SKSTREAM_UNIX_HEADER_FLAG)
AC_SUBST(SKSTREAM_BEOS_HEADER_FLAG)
AC_SUBST(SKSTREAM_WINDOWS_HEADER_FLAG)

dnl Test for socket block error value

AC_MSG_CHECKING([for socket block error value])
AC_TRY_COMPILE([#include <errno.h>],
[
    int i = EINPROGRESS;
],
[
    SKSTREAM_BLOCK_ERROR_VAL=EINPROGRESS
],
[
    AC_TRY_COMPILE([#include <windows.h>],
    [
        int i = WSAEWOULDBLOCK;
    ],
    [
        SKSTREAM_BLOCK_ERROR_VAL=WSAEWOULDBLOCK
    ],
    [
        AC_MSG_RESULT(failed)
        AC_MSG_ERROR(Unable to determine error message for socket blocking)
    ])
])
AC_MSG_RESULT($SKSTREAM_BLOCK_ERROR_VAL)
AC_SUBST(SKSTREAM_BLOCK_ERROR_VAL)

dnl Test for IPv6 socket addresses

AC_MSG_CHECKING([for IPv6 socket address])
AC_TRY_COMPILE([#include <sys/types.h>
                #include <sys/socket.h>
                #include <netinet/in.h>],
[
    sockaddr_in6 sin6;
    sin6.sin6_family = AF_INET6;
],
[
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_IPV6, 1, true if we have sockaddr_in6 and AF_INET6)
],
[
    AC_TRY_COMPILE([#include <ws2tcpip.h>],
    [
        sockaddr_in6 sin6;
        sin6.sin6_family = AF_INET6;
    ],
    [
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_IPV6, 1, true if we have sockaddr_in6 and AF_INET6)
    ],
    [
        AC_MSG_RESULT(no)
    ])
])

dnl Test for in_addr_t

AC_MSG_CHECKING([for in_addr_t])
AC_TRY_COMPILE([#include <sys/types.h>
                #include <sys/socket.h>
                #include <netinet/in.h>],
[
    in_addr_t ia;
],
[
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_IN_ADDR_T, 1, true if we have in_addr_t)
],
[
    AC_TRY_COMPILE([#include <ws2tcpip.h>],
    [
        in_addr_t ia;
    ],
    [
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_IN_ADDR_T, 1, true if we have in_addr_t)
    ],
    [
        AC_MSG_RESULT(no)
    ])
])

dnl Test for nsl library

AC_CHECK_FUNC(gethostbyname,,
[
    AC_MSG_CHECKING([for gethostbyname in ws2tcpip.h])
    AC_TRY_COMPILE(
    [
        #include <ws2tcpip.h>
    ],
    [
        ::gethostbyname("foo");
    ],
    [
        AC_MSG_RESULT(yes)
    ],
    [
        AC_MSG_RESULT(no)
        AC_CHECK_LIB(nsl, gethostbyname,
        [
            LIBS="$LIBS -lnsl"
            SKSTREAM_EXTRA_LIBS="$SKSTREAM_EXTRA_LIBS -lnsl"
        ],
        [
            AC_MSG_ERROR(Unable to find gethostbyname() socket call.)
        ])
    ])
])

dnl Test for socket library

AC_CHECK_FUNC(connect,,
[
    AC_MSG_CHECKING([for connect in ws2tcpip.h])
    AC_TRY_COMPILE(
    [
        #include <ws2tcpip.h>
    ],
    [
        ::connect(0, 0, 0);
    ],
    [
        AC_MSG_RESULT(yes)
    ],
    [
        AC_MSG_RESULT(no)
        AC_CHECK_LIB(socket, connect,
        [
            LIBS="$LIBS -lsocket"
            SKSTREAM_EXTRA_LIBS="$SKSTREAM_EXTRA_LIBS -lsocket"
        ],
        [
            AC_MSG_ERROR(Unable to find connect() socket call.)
        ])
    ])
])

dnl Test for closesocket

AC_MSG_CHECKING([for closesocket])
AC_TRY_COMPILE([#include <ws2tcpip.h>],
[
    closesocket(0);
],
[
    AC_DEFINE(HAVE_CLOSESOCKET, 1, "Define to 1 if you have the `closesocket' function.")
    AC_MSG_RESULT(yes)
],
[
    AC_MSG_RESULT(no)
])

dnl Test for getaddrinfo

AC_CHECK_FUNC(getaddrinfo,
[
    AC_DEFINE(HAVE_GETADDRINFO, 1, "Define to 1 if you have the `getaddrinfo' function.")
],
[
    AC_MSG_CHECKING([for getaddrinfo in ws2tcpip.h])
    AC_TRY_COMPILE(
    [
        #include <ws2tcpip.h>
    ],
    [
        ::getaddrinfo(0, 0, 0, 0);
    ],
    [
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_GETADDRINFO, 1, "Define to 1 if you have the `getaddrinfo' function.")
    ],
    [
        AC_MSG_RESULT(no)
    ])
])

dnl Test for C library functions

AC_CHECK_FUNCS([inet_aton])

dnl Test for Libraries

found_cppunit=yes
AM_PATH_CPPUNIT(1.6.1,, 
    AC_MSG_WARN(Couldn't Find CppUnit - Tests will not work)
    found_cppunit=no
)

AM_CONDITIONAL(USE_CPPUNIT, test "$found_cppunit" = "yes")

dnl test for support programs

AC_CHECK_PROG(SK_ZIP, zip, zip, no)
AM_CONDITIONAL(HAVE_PROG_ZIP, test x$ac_cv_prog_SK_ZIP = xzip)

AC_SUBST(SKSTREAM_LIB_SUFFIX)
AC_SUBST(SKSTREAM_LIBS)
AC_SUBST(SKSTREAM_EXTRA_LIBS)

AC_DEFINE(CONFIG_H_INCLUDED, 1, true if config.h was included)

dnl Generate files

AC_CONFIG_FILES([
	Makefile
	skstream/Makefile
	ping/Makefile
	test/Makefile
	skstream.spec
	skstream-0.3.pc
	skstream-unix-0.3.pc
	skstream/skstreamconfig.h
])
AC_OUTPUT