forked from ryuever/unix-network-programming-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
716 lines (667 loc) · 23.3 KB
/
configure.in
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
dnl
dnl autoconf script for UNP 3/e Volume 1 source code.
dnl Process this file with autoconf to produce a configure script.
dnl
dnl The end result of running configure is the "config.h" file and the
dnl "Make.defines" file in the current directory. These two files are
dnl created from the "config.h.in" and "Make.defines.in" files in the
dnl current directory.
dnl
dnl The header "unp.h" that is in every source directory then does a
dnl #include "../config.h" and the Makefile in each source directory
dnl then does a include of ../Make.defines.
dnl
AC_REVISION($Revision: 1.13 $)
AC_INIT(lib/unp.h)
AC_CANONICAL_HOST
AC_CONFIG_HEADER(config.h)
dnl The following cpu_vendor_os string goes into config.h.
dnl
AC_DEFINE_UNQUOTED(CPU_VENDOR_OS, "$host", [CPU, vendor, and operating system])
dnl ##################################################################
dnl Checks for programs.
dnl
dnl Some system-specific stuff ...
dnl Some operating systems require additional flags in order to get all
dnl the definitions that we're looking for in some system headers.
dnl The configure script uses both CFLAGS and CPPFLAGS when compiling.
case "$host_os" in
*aix*) CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE" ;;
*osf*) CPPFLAGS="$CPPFLAGS -D_SOCKADDR_LEN" ;;
esac
AC_PROG_CC
AC_PROG_RANLIB
dnl ##################################################################
dnl Checks for libraries.
dnl The order of these tests is the *reverse* order of the libraries in
dnl the LIBS variable that is constructed: each new one gets prepended,
dnl not appended.
dnl
dnl We are building three strings here; something like:
dnl LIBS="-lresolv -lsocket -lnsl -lpthread"
dnl LIBS_XTI="-lxti -lresolv -lnsl -lpthread"
dnl LIBUNP="./libunp.a"
dnl LIBUNPXTI="./libunpxti.a"
dnl
dnl If a threads library is found, need to update CFLAGS too.
dnl
AC_CHECK_LIB(pthread, pthread_create)
if test "$ac_cv_lib_pthread_pthread_create" = yes ; then
CFLAGS="$CFLAGS -D_REENTRANT"
else
AC_CHECK_LIB(pthreads, pthread_create)
if test "$ac_cv_lib_pthreads_pthread_create" = yes ; then
CFLAGS="$CFLAGS -D_REENTRANT"
fi
fi
AC_CHECK_LIB(nsl, t_open)
AC_SEARCH_LIBS(socket, socket)
dnl Bind 8.1.1 places its library in /usr/local/bind/lib/libbind.a; we check
dnl for it first. Also check for libbind.a in user's home directory.
dnl If there is a libresolv.a in the user's HOME directory, we will use
dnl that instead of -lresolv. Need this for people interested in building
dnl an IPv6-knowledgable resolver, instead of using the system provided
dnl resolver (which is often way out of date).
dnl
AC_MSG_CHECKING(for /usr/local/bind/lib/libbind.a)
if test -f /usr/local/bind/lib/libbind.a ; then
AC_MSG_RESULT(yes)
LIBS="/usr/local/bind/lib/libbind.a $LIBS"
else
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for $HOME/libbind.a)
if test -f $HOME/libbind.a ; then
AC_MSG_RESULT(yes)
LIBS="$HOME/libbind.a $LIBS"
else
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for $HOME/libresolv.a)
if test -f $HOME/libresolv.a ; then
AC_MSG_RESULT(yes)
LIBS="$HOME/libresolv.a $LIBS"
else
AC_MSG_RESULT(no)
AC_CHECK_LIB(resolv, res_init)
fi
fi
fi
dnl Now check for XTI library.
dnl
AC_CHECK_LIB(xti, t_open)
dnl We now need to check for our own libraries, but we cannot prepend
dnl them to the LIBS variable, as that variable is used when compiling
dnl programs later in this script, and that would mess things up.
dnl
dnl If the user has a file named $HOME/libunp.a, then use it.
dnl Else store our library in current directory.
dnl I use this because my source directory is NFS mounted from my various
dnl systems, but I have a unique home directory on each system.
dnl
AC_MSG_CHECKING(for $HOME/libunp.a)
if test -f $HOME/libunp.a ; then
AC_MSG_RESULT(yes)
LIBUNP="$HOME/libunp.a"
LIBUNP_NAME=$HOME/libunp.a
else
AC_MSG_RESULT(no, using ./libunp.a)
LIBUNP="../libunp.a"
LIBUNP_NAME=../libunp.a
fi
dnl If the user has a file named $HOME/libunpxti.a, then use it.
dnl Else store our library in current directory.
dnl Same reasoning as above.
dnl
AC_MSG_CHECKING(for $HOME/libunpxti.a)
if test -f $HOME/libunpxti.a ; then
AC_MSG_RESULT(yes)
LIBUNPXTI="$HOME/libunpxti.a"
LIBUNPXTI_NAME=$HOME/libunpxti.a
else
AC_MSG_RESULT(no, using ./libunpxti.a)
LIBUNPXTI="../libunpxti.a"
LIBUNPXTI_NAME=../libunpxti.a
fi
dnl ##################################################################
dnl Checks for header files.
dnl
dnl The list of headers in the AC_CHECK_HEADERS macro is the same as in
dnl our "unp.h" header, followed by our "unpxti.h" header.
dnl
AC_HEADER_STDC
dnl
dnl The includes (the 4th argument to AC_CHECK_HEADERS) here are
dnl the defeault set ($ac_includes_default) plus <sys/param.h>
dnl for <sys/sysctl.h> on NetBSD and OpenBSD.
AC_CHECK_HEADERS(sys/types.h sys/socket.h sys/time.h time.h netinet/in.h arpa/inet.h errno.h fcntl.h netdb.h signal.h stdio.h stdlib.h string.h sys/stat.h sys/uio.h unistd.h sys/wait.h sys/un.h sys/param.h sys/select.h sys/sysctl.h poll.h sys/event.h strings.h sys/ioctl.h sys/filio.h sys/sockio.h pthread.h net/if_dl.h xti.h xti_inet.h netconfig.h netdir.h stropts.h, [], [], [
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# endif
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif])
dnl ##################################################################
dnl Checks for typedefs.
dnl
dnl We use our own AC_UNP_CHECK_TYPE macro, instead of AC_CHECK_TYPE,
dnl to #include more headers. Our macro is defined in "aclocal.m4".
dnl
AC_HEADER_TIME
AC_UNP_CHECK_TYPE(uint8_t, unsigned char, 8-bit unsigned type)
AC_UNP_CHECK_TYPE(int16_t, short, 16 bit signed type)
AC_UNP_CHECK_TYPE(uint16_t, unsigned short, 16 bit unsigned type)
AC_UNP_CHECK_TYPE(int32_t, int, 32 bit signed type)
AC_UNP_CHECK_TYPE(uint32_t, unsigned int, 32 bit unsigned type)
AC_UNP_CHECK_TYPE(size_t, unsigned int, unsigned integer type of the result of the sizeof operator)
AC_UNP_CHECK_TYPE(ssize_t, int, a signed type appropriate for a count of bytes or an error indication)
AC_UNP_CHECK_TYPE(socklen_t, unsigned int, a type appropriate for address, hostname, buffer, etc. lengths)
dnl
dnl The SA_FAMILY_T in the following is #defined later, as its definition
dnl depends on whether socket address structures have a length field or not.
dnl
AC_UNP_CHECK_TYPE(sa_family_t, SA_FAMILY_T, the type of the sa_family struct member)
dnl We also have our own macro to check for XTI definitions, that can
dnl be defined after #include of our "unpxti.h" header.
dnl
AC_UNPXTI_CHECK_TYPE(t_scalar_t, int32_t, scalar type)
AC_UNPXTI_CHECK_TYPE(t_uscalar_t, uint32_t, unsigned scalar type)
dnl ##################################################################
dnl Check if sockaddr{} has sa_len member.
dnl
AC_CHECK_MEMBER([struct sockaddr.sa_len],
AC_DEFINE(HAVE_SOCKADDR_SA_LEN, 1, define if socket address structures have length fields),,[
#include <sys/types.h>
#include <sys/socket.h>])
dnl Now we can complete the definition for sa_family_t, if needed.
dnl The size of this datatype depends whether socket address structures
dnl have a length field or not.
dnl
if test $ac_cv_type_sa_family_t = no ; then
if test $ac_cv_member_struct_sockaddr_sa_len = yes ; then
AC_DEFINE(SA_FAMILY_T, uint8_t, the size of the sa_family field in a socket address structure)
else
AC_DEFINE(SA_FAMILY_T, uint16_t)
fi
fi
dnl
dnl Check for sockaddr_storage.
dnl If it's present, check for ss_family.
dnl If ss_family isn't there, check for __ss_family and
dnl #define ss_family __ss_family if so.
dnl If neither is there, I don't know what to do.
dnl
AC_CHECK_TYPES([struct sockaddr_storage],
AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],,
AC_CHECK_MEMBER([struct sockaddr_storage.__ss_family],
AC_DEFINE([ss_family],[__ss_family],[define to __ss_family if sockaddr_storage has that instead of ss_family]),
AC_MSG_ERROR([cannot find ss_family in sockaddr_storage]),[
#include <sys/types.h>
#include <sys/socket.h>]),[
#include <sys/types.h>
#include <sys/socket.h>]),,[
#include <sys/types.h>
#include <sys/socket.h>])
dnl Check if msghdr{} has msg_control member.
dnl
AC_CHECK_MEMBER([struct msghdr.msg_control],
AC_DEFINE(HAVE_MSGHDR_MSG_CONTROL, 1, define if struct msghdr contains the msg_control member),,[
#include <sys/types.h>
#include <sys/socket.h>])
dnl
dnl Check for ifr_mtu in ifreq - some systems have SIOCGIFMTU
dnl but don't have ifr_mtu!!
AC_CHECK_MEMBERS([struct ifreq.ifr_mtu],,,
[#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>])
dnl ##################################################################
dnl Check for function prototypes in headers.
dnl AC_CHECK_FUNC_PROTO is our own macro in "aclocal.m4".
dnl
AC_CHECK_FUNC_PROTO(getaddrinfo, netdb.h)
AC_CHECK_FUNC_PROTO(getnameinfo, netdb.h)
AC_CHECK_FUNC_PROTO(gethostname, unistd.h)
AC_CHECK_FUNC_PROTO(getrusage, sys/resource.h)
AC_CHECK_FUNC_PROTO(hstrerror, netdb.h)
AC_CHECK_FUNC_PROTO(if_nametoindex, net/if.h)
AC_CHECK_FUNC_PROTO(inet_aton, arpa/inet.h)
AC_CHECK_FUNC_PROTO(inet_pton, arpa/inet.h)
AC_CHECK_FUNC_PROTO(pselect, sys/select.h)
AC_CHECK_FUNC_PROTO(snprintf, stdio.h)
AC_CHECK_FUNC_PROTO(sockatmark, sys/socket.h)
dnl
dnl autoheader doesn't know how to handle the above, so we have
dnl to help it out.
AH_TEMPLATE(HAVE_GETADDRINFO_PROTO, define if getaddrinfo prototype is in <netdb.h>)
AH_TEMPLATE(HAVE_GETNAMEINFO_PROTO, define if getnameinfo prototype is in <netdb.h>)
AH_TEMPLATE(HAVE_GETHOSTNAME_PROTO, define if gethostname prototype is in <unistd.h>)
AH_TEMPLATE(HAVE_GETRUSAGE_PROTO, define if getrusage prototype is in <sys/resource.h>)
AH_TEMPLATE(HAVE_HSTRERROR_PROTO, define if hstrerror prototype is in <netdb.h>)
AH_TEMPLATE(HAVE_IF_NAMETOINDEX_PROTO, define if if_nametoindex prototype is in <net/if.h>)
AH_TEMPLATE(HAVE_INET_ATON_PROTO, define if inet_aton prototype is in <arpa/inet.h>)
AH_TEMPLATE(HAVE_INET_PTON_PROTO, define if inet_pton prototype is in <arpa/inet.h>)
AH_TEMPLATE(HAVE_PSELECT_PROTO, define if pselect prototype is in <sys/stat.h>)
AH_TEMPLATE(HAVE_SNPRINTF_PROTO, define if snprintf prototype is in <stdio.h>)
AH_TEMPLATE(HAVE_SOCKATMARK_PROTO, define if sockatmark prototype is in <sys/socket.h>)
dnl ##################################################################
dnl Check for structure definitions.
dnl
AC_CHECK_TYPE(struct addrinfo,
AC_DEFINE(HAVE_ADDRINFO_STRUCT, 1, Define to 1 if <netdb.h> defines struct addrinfo),,[
#include <netdb.h>])
dnl
AC_CHECK_TYPE(struct if_nameindex,
AC_DEFINE(HAVE_IF_NAMEINDEX_STRUCT, 1, Define to 1 if <net/if.h> defines struct if_nameindex),,[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>])
dnl
AC_CHECK_TYPE([struct sockaddr_dl],
AC_DEFINE(HAVE_SOCKADDR_DL_STRUCT, 1, Define to 1 if <net/if_dl.h> defines struct sockaddr_dl),,[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>])
dnl OpenBSD puts struct timespec in <sys/time.h> instead of <time.h>,
dnl thus this complex test.
AC_CHECK_TYPE([struct timespec],
AC_DEFINE(HAVE_TIMESPEC_STRUCT, 1, Define to 1 if <time.h> or <sys/time.h> defines struct timespec),,[
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
])
dnl ##################################################################
dnl Check for XTI devices.
dnl
AC_MSG_CHECKING(for /dev/tcp)
if test -r /dev/tcp ; then
AC_DEFINE(HAVE_DEV_TCP, 1, Define to 1 if the /dev/tcp device exists)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for /dev/xti/tcp)
if test -r /dev/xti/tcp ; then
AC_DEFINE(HAVE_DEV_XTI_TCP, 1, Define to 1 if the /dev/xti/tcp device exists)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for /dev/streams/xtiso/tcp)
if test -r /dev/streams/xtiso/tcp ; then
AC_DEFINE(HAVE_DEV_STREAMS_XTISO_TCP, 1, Define to 1 if the /dev/streams/xtiso/tcp device exists)
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
fi
fi
dnl ##################################################################
dnl Checks for library functions.
dnl
AC_CHECK_FUNCS(bzero)
AC_CHECK_FUNCS(getaddrinfo)
AC_CHECK_FUNCS(gethostname)
AC_CHECK_FUNCS(gethostbyname2)
AC_CHECK_FUNCS(gethostbyname_r)
AC_CHECK_FUNCS(getnameinfo)
AC_CHECK_FUNCS(hstrerror)
AC_CHECK_FUNCS(if_nametoindex)
AC_CHECK_FUNCS(inet_aton)
AC_CHECK_FUNCS(inet_pton)
AC_CHECK_FUNCS(inet6_rth_init)
AC_CHECK_FUNCS(kqueue kevent)
AC_CHECK_FUNCS(mkstemp)
AC_CHECK_FUNCS(poll)
AC_CHECK_FUNCS(pselect)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(sockatmark)
AC_CHECK_FUNCS(vsnprintf)
dnl ##################################################################
dnl Check for system services.
dnl Let's see if the system really supports IPv4.
dnl
AC_MSG_CHECKING(for IPv4 support)
AC_CACHE_VAL(ac_cv_ipv4,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
/* Make sure the definitions for AF_INET and struct sockaddr_in
* are defined, and that we can actually create an IPv4 TCP socket.
*/
main()
{
int fd;
struct sockaddr_in foo;
fd = socket(AF_INET, SOCK_STREAM, 0);
exit(fd >= 0 ? 0 : 1);
}],
ac_cv_ipv4=yes,
ac_cv_ipv4=no,
ac_cv_ipv4=no))
AC_MSG_RESULT($ac_cv_ipv4)
if test $ac_cv_ipv4 = yes ; then
AC_DEFINE(IPV4, 1, Define to 1 if the system supports IPv4)
AC_DEFINE(IPv4, 1, Define to 1 if the system supports IPv4)
fi
dnl Let's see if the system really supports IPv6.
dnl
AC_MSG_CHECKING(for IPv6 support)
AC_CACHE_VAL(ac_cv_ipv6,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
/* Make sure the definitions for AF_INET6 and struct sockaddr_in6
* are defined, and that we can actually create an IPv6 TCP socket.
*/
main()
{
int fd;
struct sockaddr_in6 foo;
fd = socket(AF_INET6, SOCK_STREAM, 0);
exit(fd >= 0 ? 0 : 1);
}],
ac_cv_ipv6=yes,
ac_cv_ipv6=no,
ac_cv_ipv6=no))
AC_MSG_RESULT($ac_cv_ipv6)
if test $ac_cv_ipv6 = yes ; then
AC_DEFINE(IPV6, 1, Define to 1 if the system supports IPv6)
AC_DEFINE(IPv6, 1, Define to 1 if the system supports IPv6)
fi
dnl Let's see if the system really supports Unix domain sockets.
dnl
AC_MSG_CHECKING(for Unix domain sockets)
AC_CACHE_VAL(ac_cv_unixdomain,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <sys/un.h>
/* Make sure the definitions for AF_UNIX and struct sockaddr_un
* are defined, and that we can actually create an IPv4 TCP socket.
*/
main()
{
int fd;
struct sockaddr_un foo;
fd = socket(AF_UNIX, SOCK_STREAM, 0);
exit(fd >= 0 ? 0 : 1);
}],
ac_cv_unixdomain=yes,
ac_cv_unixdomain=no,
ac_cv_unixdomain=no))
AC_MSG_RESULT($ac_cv_unixdomain)
if test $ac_cv_unixdomain = yes ; then
AC_DEFINE(UNIXDOMAIN, 1, Define to 1 if the system supports UNIX domain sockets)
AC_DEFINE(UNIXdomain, 1, Define to 1 if the system supports UNIX domain sockets)
fi
dnl Let's see if the system really supports multicasting.
dnl
AC_MSG_CHECKING(for multicast support)
AC_CACHE_VAL(ac_cv_multicast,
AC_TRY_RUN([
# include <sys/types.h>
# include <sys/socket.h>
# include <netinet/in.h>
main()
{
int fd;
unsigned char flag = 1;
struct sockaddr_in foo;
struct ip_mreq mreq;
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) exit(1);
if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP,
(void*)&flag, sizeof(flag)) < 0)
exit(1);
exit(0);
}],
ac_cv_multicast=yes,
ac_cv_multicast=no,
ac_cv_multicast=no))
AC_MSG_RESULT($ac_cv_multicast)
if test $ac_cv_multicast = yes ; then
AC_DEFINE(MCAST, 1, Define to 1 if the system supports IP Multicast)
fi
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the lib/ directory.
dnl
LIB_OBJS=
LIB_OBJS="$LIB_OBJS connect_nonb.o"
LIB_OBJS="$LIB_OBJS connect_timeo.o"
LIB_OBJS="$LIB_OBJS daemon_inetd.o"
LIB_OBJS="$LIB_OBJS daemon_init.o"
LIB_OBJS="$LIB_OBJS dg_cli.o"
LIB_OBJS="$LIB_OBJS dg_echo.o"
LIB_OBJS="$LIB_OBJS error.o"
LIB_OBJS="$LIB_OBJS get_ifi_info.o"
LIB_OBJS="$LIB_OBJS gf_time.o"
LIB_OBJS="$LIB_OBJS host_serv.o"
if test "$ac_cv_func_hstrerror" = no ; then
LIBFREE_OBJS="$LIBFREE_OBJS hstrerror.o"
fi
if test "$ac_cv_func_if_nametoindex" = no ; then
LIB_OBJS="$LIB_OBJS if_nametoindex.o if_indextoname.o if_nameindex.o"
fi
if test "$ac_cv_multicast" = yes ; then
LIB_OBJS="$LIB_OBJS family_to_level.o"
LIB_OBJS="$LIB_OBJS mcast_leave.o mcast_join.o"
LIB_OBJS="$LIB_OBJS mcast_get_if.o mcast_get_loop.o mcast_get_ttl.o"
LIB_OBJS="$LIB_OBJS mcast_set_if.o mcast_set_loop.o mcast_set_ttl.o"
fi
LIB_OBJS="$LIB_OBJS my_addrs.o"
if test "$ac_cv_func_pselect" = no ; then
LIB_OBJS="$LIB_OBJS pselect.o"
fi
LIB_OBJS="$LIB_OBJS read_fd.o"
LIB_OBJS="$LIB_OBJS readline.o"
LIB_OBJS="$LIB_OBJS readn.o"
LIB_OBJS="$LIB_OBJS readable_timeo.o"
LIB_OBJS="$LIB_OBJS rtt.o"
LIB_OBJS="$LIB_OBJS signal.o"
LIB_OBJS="$LIB_OBJS signal_intr.o"
if test "$ac_cv_func_snprintf" = no ; then
LIB_OBJS="$LIB_OBJS snprintf.o"
fi
if test "$ac_cv_func_sockatmark" = no ; then
LIB_OBJS="$LIB_OBJS sockatmark.o"
fi
LIB_OBJS="$LIB_OBJS sock_bind_wild.o"
LIB_OBJS="$LIB_OBJS sock_cmp_addr.o"
LIB_OBJS="$LIB_OBJS sock_cmp_port.o"
LIB_OBJS="$LIB_OBJS sock_ntop.o"
LIB_OBJS="$LIB_OBJS sock_ntop_host.o"
LIB_OBJS="$LIB_OBJS sock_get_port.o"
LIB_OBJS="$LIB_OBJS sock_set_addr.o"
LIB_OBJS="$LIB_OBJS sock_set_port.o"
LIB_OBJS="$LIB_OBJS sock_set_wild.o"
LIB_OBJS="$LIB_OBJS sockfd_to_family.o"
LIB_OBJS="$LIB_OBJS str_cli.o"
LIB_OBJS="$LIB_OBJS str_echo.o"
LIB_OBJS="$LIB_OBJS tcp_connect.o"
LIB_OBJS="$LIB_OBJS tcp_listen.o"
LIB_OBJS="$LIB_OBJS tv_sub.o"
LIB_OBJS="$LIB_OBJS udp_client.o"
LIB_OBJS="$LIB_OBJS udp_connect.o"
LIB_OBJS="$LIB_OBJS udp_server.o"
LIB_OBJS="$LIB_OBJS wraplib.o"
LIB_OBJS="$LIB_OBJS wrapsock.o"
LIB_OBJS="$LIB_OBJS wrapstdio.o"
if test "$ac_cv_header_pthread_h" = yes ; then
LIB_OBJS="$LIB_OBJS wrappthread.o"
fi
LIB_OBJS="$LIB_OBJS wrapunix.o"
LIB_OBJS="$LIB_OBJS write_fd.o"
LIB_OBJS="$LIB_OBJS writen.o"
LIB_OBJS="$LIB_OBJS writable_timeo.o"
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libfree/ directory.
dnl
LIBFREE_OBJS=
LIBFREE_OBJS="$LIBFREE_OBJS in_cksum.o"
if test "$ac_cv_func_inet_aton" = no ; then
LIBFREE_OBJS="$LIBFREE_OBJS inet_aton.o"
fi
dnl We always include both inet_ntop() and inet_pton() because some
dnl vendor's implementations are from the Internet Drafts leading to
dnl RFC 1323, and are wrong.
LIBFREE_OBJS="$LIBFREE_OBJS inet_ntop.o inet_pton.o"
dnl if test "$ac_cv_func_inet_pton" = no ; then
dnl LIBFREE_OBJS="$LIBFREE_OBJS inet_pton.o"
dnl fi
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libgai/ directory (getaddrinfo() and friends).
dnl
dnl If the system has a getaddrinfo implementation, then
dnl there should be nothing here.
if test "$ac_cv_func_getaddrinfo" = no ; then
LIBGAI_OBJS="getaddrinfo.o getnameinfo.o freeaddrinfo.o gai_strerror.o"
LIBGAI_OBJS="$LIBGAI_OBJS ga_aistruct.o ga_clone.o ga_echeck.o ga_nsearch.o"
LIBGAI_OBJS="$LIBGAI_OBJS ga_port.o ga_serv.o ga_unix.o gn_ipv46.o"
else
LIBGAI_OBJS=""
fi
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libroute/ directory (routing socket functions).
dnl
LIBROUTE_OBJS="get_rtaddrs.o"
LIBROUTE_OBJS="$LIBROUTE_OBJS if_indextoname.o if_nameindex.o if_nametoindex.o"
LIBROUTE_OBJS="$LIBROUTE_OBJS net_rt_iflist.o net_rt_dump.o"
LIBROUTE_OBJS="$LIBROUTE_OBJS sock_masktop.o"
dnl ##################################################################
dnl Build the list of object files to build from the source files in
dnl the libxti/ directory.
dnl Systems that do not provide <netdir.h> and <netconfig.h> do not
dnl support our tcp_XXX and udp_XXX functions.
dnl
LIBXTI_OBJS=
if test "$ac_cv_header_netdir_h" = yes ; then
LIBXTI_OBJS="$LIBXTI_OBJS tcp_connect.o"
LIBXTI_OBJS="$LIBXTI_OBJS tcp_listen.o"
LIBXTI_OBJS="$LIBXTI_OBJS udp_server.o"
LIBXTI_OBJS="$LIBXTI_OBJS udp_client.o"
fi
LIBXTI_OBJS="$LIBXTI_OBJS wrapxti.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_accept.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_flags_str.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_getopt.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_ntop.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_ntop_host.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_rdwr.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_setopt.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_str_opts.o"
LIBXTI_OBJS="$LIBXTI_OBJS xti_tlook_str.o"
dnl Now make certain that when configure is run, AC_OUTPUT replaces these
dnl strings that we built in shell variables in the output files that
dnl it generates.
dnl
AC_SUBST(LIB_OBJS)
AC_SUBST(LIBFREE_OBJS)
AC_SUBST(LIBGAI_OBJS)
AC_SUBST(LIBROUTE_OBJS)
AC_SUBST(LIBXTI_OBJS)
dnl We need our own variable LIBS_XTI for linking XTI programs,
dnl but do not want -lsocket in there.
dnl Ditto for -lxti in LIBS.
dnl
LIBS_XTI=`echo $LIBS | sed 's/-lsocket//'`
LIBS=`echo $LIBS | sed 's/-lxti//'`
AC_SUBST(LIBS_XTI)
AC_SUBST(LIBUNP)
AC_SUBST(LIBUNPXTI)
AC_SUBST(LIBUNP_NAME)
AC_SUBST(LIBUNPXTI_NAME)
dnl ##################################################################
dnl Now that we're doing compiling, modify CFLAGS.
dnl
dnl If the directory $HOME/doc/unp2ev1/src/include exists, the user can
dnl place modified copies of the system's headers in there, with the
dnl function prototypes corrected, as per Posix and X/Open. Lots of
dnl system headers today are missing const qualifiers, they have char*
dnl instead of void*, and so on.
dnl
AC_MSG_CHECKING(for -I$HOME/doc/unp2ev1/src/include)
if test -d $HOME/doc/unp2ev1/src/include ; then
CFLAGS="$CFLAGS -I$HOME/doc/unp2ev1/src/include"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
dnl If the compiler is gcc, enable all warnings. Main purpose is to
dnl catch any function call where the function has not been prototyped.
dnl
if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wall"
dnl
dnl These warnings are useful during development, but not to deploy.
dnl CFLAGS="$CFLAGS -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wno-format-extra-args"
fi
dnl Some system-specific stuff ...
dnl Some operating systems require additional flags in order to get all
dnl the definitions that we're looking for in some system headers.
case "$host_os" in
*aix*) CFLAGS="$CFLAGS -D_ALL_SOURCE" ;;
*osf*) CFLAGS="$CFLAGS -D_SOCKADDR_LEN" ;;
*solaris*) if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -D__EXTENSIONS__"
else
CFLAGS="$CFLAGS -D__STDC__"
fi ;;
esac
dnl ##################################################################
dnl We also create a "Makefile" but it is not used for much.
dnl
AC_OUTPUT(Makefile Make.defines)
dnl
dnl If a directory exists whose name equals the host
dnl (e.g., sparc-sun-solaris2.5.1), then save the five files that we
dnl create in that directory also.
dnl Quick and dirty to be able to NFS mount this directory on different
dnl systems and move quickly between the systems, without having to
dnl rerun configure each time.
dnl The "myconfig" script in this directory does the move.
dnl
if test -d "$host" ; then
cp -p config.h config.cache config.status Makefile Make.defines $host
echo "saving copies in $host/"
fi