-
Notifications
You must be signed in to change notification settings - Fork 11
/
configure.ac
919 lines (810 loc) · 21.3 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
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
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
# Process this file with autoconf to produce a configure script.
m4_include([m4/version.m4])
AC_PREREQ(2.59)
AC_INIT(
[ptpd],
[VERSION_NUMBER],
[],
[PTPD_URL]dnl
)
AC_CONFIG_SRCDIR([src/arith.c])
AC_CONFIG_HEADER([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_GNU_SOURCE
AM_INIT_AUTOMAKE([1.9 foreign silent-rules -Wall])
AM_SILENT_RULES([yes])
MAN_DATE="RELEASE_DATE"
MAN_VERSION="VERSION_NUMBER"
AC_SUBST(MAN_DATE)
AC_SUBST(MAN_VERSION)
# Checks for programs
AC_PROG_AWK
AC_PROG_CC
ifdef([AC_PROG_CC_C99], [AC_PROG_CC_C99])
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
# check for 'make' alternatives, set the MAKE variable accordingly
AC_PATH_PROGS(MAKE, [ make gmake gnumake ])
AC_SUBST(MAKE)
# Check for uname,date, cut and tr
AC_PATH_PROG(cutpath, cut)
AC_PATH_PROG(trpath, tr)
AC_PATH_PROG(datepath, date)
AC_PATH_PROG(unamepath, uname)
if test -n "$unamepath"; then
os_family=`uname`
fi
if test -n "$datepath"; then
build_date=`$datepath +%Y%m%d`
AC_DEFINE_UNQUOTED(BUILD_DATE, ["$build_date"], [build date year-month-day])
fi
# Set CODE_REVISION if git, version is suffixed with "-git" and code is versioned
if test -n "$cutpath" && test -n "$trpath"; then
ver_suffix=`echo VERSION_NUMBER | $cutpath -s -d- -f4`
if test -z "$ver_suffix"; then
ver_suffix=`echo VERSION_NUMBER | $cutpath -s -d- -f3`
if test -z "$ver_suffix"; then
ver_suffix=`echo VERSION_NUMBER | $cutpath -s -d- -f2`
fi
fi
AC_PATH_PROG(gitpath, git)
if test "$ver_suffix" = "git" && test -n "$gitpath"; then
git_rev=`$gitpath log -1 --format="%h" 2>/dev/null`
if test -n "$git_rev"; then
AC_DEFINE_UNQUOTED(CODE_REVISION, ["-$git_rev"], [source code revision])
fi
fi
fi
# Checks for libraries.
AC_SEARCH_LIBS([pow], [m])
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_SEARCH_LIBS([timer_create], [rt])
AC_SEARCH_LIBS([connect], [socket])
AC_SEARCH_LIBS([gethostbyname], [nsl])
AC_SEARCH_LIBS([glob], [android-glob])
AC_SEARCH_LIBS([__android_log_print], [log])
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h net/ethernet.h netinet/in.h netinet/in_systm.h netinet/ether.h sys/uio.h net/if_dl.h net/if_types.h])
AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h sys/sockio.h sys/time.h syslog.h unistd.h])
AC_CHECK_HEADERS([glob.h sched.h utmp.h utmpx.h unix.h sys/timex.h getopt.h sys/un.h])
AC_CHECK_HEADERS([linux/if_packet.h linux/sockios.h linux/rtc.h ])
AC_CHECK_HEADERS([ifaddrs.h], [have_ifaddrs_h=true], [have_ifaddrs_h=false], [])
AC_CHECK_HEADERS([endian.h machine/endian.h sys/isa_defs.h sys/pfmod.h sys/bufmod.h])
AC_CHECK_HEADERS([math.h],[],[AC_MSG_ERROR([math.h is required to compile PTPd])],[])
# MUST chck for cpuset AFTER the check for param as the latter needs
# the former to pass the compile check.
AC_CHECK_HEADERS([sys/cpuset.h], [], [],
[#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
])
# Similar case for if.h
AC_CHECK_HEADERS([net/if.h linux/if.h linux/un.h], [], [],
[
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
])
# Similar case for if_arp.h
AC_CHECK_HEADERS([net/if_arp.h], [], [],
[
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
])
# Similar case for netinet/if_ether.h
AC_CHECK_HEADERS([netinet/if_ether.h], [], [],
[
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NET_IF_ARP_H
#include <net/if_arp.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
])
# ...and for if_ether.h
AC_CHECK_HEADERS([net/if_ether.h], [], [],
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_STDBOOL
AC_HEADER_TIME
AC_C_VOLATILE
# Automake 2.59 has a problem with those on RHEL5
m4_version_prereq(2.60,[
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_INT64_T
],
[AC_TYPE_SIZE_T]
)
AC_CHECK_MEMBERS([struct utmp.ut_time], [], [], [
#ifdef HAVE_UTMP_H
#include <utmp.h>
#endif
])
AC_CHECK_MEMBERS([struct timex.tick], [], [], [[#include <sys/timex.h>]])
AC_CHECK_MEMBERS([struct timex.tai], [], [], [[#include <sys/timex.h>]])
AC_CHECK_MEMBERS([struct ntptimeval.tai], [], [],
[
#include <sys/time.h>
#include <sys/timex.h>
])
# Check for ifr_hwaddr in the ifreq structure
AC_CHECK_MEMBERS([struct ifreq.ifr_hwaddr], [], [], [[#include <net/if.h>]])
# Check for ifr_index in the ifreq structure
AC_CHECK_MEMBERS([struct ifreq.ifr_index], [], [], [[#include <net/if.h>]])
# Check for ifr_ifindex in the ifreq structure
AC_CHECK_MEMBERS([struct ifreq.ifr_ifindex], [], [], [[#include <net/if.h>]])
# ether_add: octet vs. ether_addr_octet - FreeBSD, any others?
AC_CHECK_MEMBERS([struct ether_addr.octet], [], [],
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_ETHER_H
#include <netinet/ether.h>
#endif
#ifdef HAVE_NET_ETHERNET_H
#include <net/ethernet.h>
#endif
#ifdef HAVE_NET_IF_ETHER_H
#include <net/if.h>
#endif
#ifdef HAVE_NET_IF_ETHER_H
#include <net/if_ether.h>
#endif
])
#Check for source / dest in udphdr structure
AC_CHECK_MEMBERS([struct udphdr.source], [], [], [[#include <netinet/udp.h>]])
# Checks for library functions
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([clock_gettime dup2 ftruncate gethostbyname2 gettimeofday inet_ntoa memset pow select socket strchr strdup strerror strtol glob pututline utmpxname updwtmpx setutent endutent signal ntp_gettime getopt_long clock_adjtime if_nametoindex ntp_adjtime adjtimex])
AC_CHECK_FUNCS([daemon], [have_daemon=true], [have_daemon=false])
if test -n "$GCC"; then
AC_MSG_CHECKING(if GCC -fstack-protector is usable)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fstack-protector"
AC_TRY_LINK(,,[
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
CFLAGS="$OLDCFLAGS"
])
fi
# Solaris libdlpi checks
have_libdlpi="false"
case $host in
*solaris*)
AC_CHECK_HEADERS([sys/dlpi.h])
AC_SEARCH_LIBS([dlpi_open], [dlpi], [have_libdlpi=true], [have_libdlpi=false])
DLPI_LIBS=""
AC_CHECK_HEADERS([libdlpi.h],
[
AC_MSG_CHECKING([for libdlpi library])
if test "$have_libdlpi" = "true"; then
AC_MSG_RESULT([-ldlpi])
elif test -f "/lib/libdlpi.so.1"; then
have_libdlpi="true"
AC_MSG_RESULT([/lib/libdlpi.so.1])
DLPI_LIBS="/lib/libdlpi.so.1"
else
AC_MSG_RESULT([none])
AC_MSG_ERROR([no usable libdlpi library found])
fi
# Check if we have the extended packetfilt structure available
AC_CHECK_MEMBERS([struct Pf_ext_packetfilt.Pf_Priority], [], [], [
#include <sys/types.h>
#include <sys/pfmod.h>
])
],
[],
[]
)
AC_SUBST([DLPI_LIBS])
;;
esac
AM_CONDITIONAL([CCK_BUILD_TTRANSPORT_DLPI], [test "$have_libdlpi" = "true"])
is_linux=false
case $host in
*linux*)
is_linux=true
AC_DEFINE([CCK_BUILD_TTRANSPORT_SOCK_RAWETH], [1], [Build LibCCK Linux raw ethernet transport])
;;
esac
AM_CONDITIONAL([LINUX], [test "$is_linux" = "true" ])
AM_CONDITIONAL([CCK_BUILD_TTRANSPORT_SOCK_RAWETH], [test "$is_linux" = "true" ])
AM_CONDITIONAL([CCK_BUILD_DAEMON], [test "$have_daemon" = "false" ])
AM_CONDITIONAL([CCK_BUILD_SOLARIS_GETIFADDRS], [test "$have_ifaddrs_h" = "false"])
# LibCCK conditional component build checks
build_linuxphc=false
case $host in
*solaris*)
AS_IF([test "$have_ifaddrs_h" = "false"],
[
AC_DEFINE([CCK_BUILD_SOLARIS_GETIFADDRS], [1], [Build internal getifaddrs() implementation on Solaris])
]
)
AS_IF([test "$have_libdlpi" = "true"],
[
AC_DEFINE([CCK_BUILD_TTRANSPORT_DLPI], [1], [Build libdlpi transports on Solaris])
]
)
;;
*linux*)
build_linuxphc=true
AC_CHECK_HEADERS([linux/ethtool.h], [], [build_linuxphc=false], [])
AC_CHECK_HEADERS([linux/ptp_clock.h], [], [build_linuxphc=false], [])
AC_CHECK_HEADERS([linux/net_tstamp.h], [], [build_linuxphc=false], [])
# If we have Linux HWTS headers, check if they are complete...
AC_CHECK_DECLS([PTP_SYS_OFFSET], [], [], [[#include <linux/ptp_clock.h>]])
AC_CHECK_DECLS([ETHTOOL_GET_TS_INFO], [], [], [[#include <linux/ethtool.h>]])
AC_CHECK_DECLS([ADJ_SETOFFSET], [], [], [[#include <linux/timex.h>]])
AC_CHECK_DECLS([MSG_ERRQUEUE], [], [build_linuxphc=false], [[#include <sys/socket.h>]])
AS_IF([test "$build_linuxphc" = "true"],
[
AC_DEFINE([CCK_BUILD_TTRANSPORT_LINUXTS], [1], [Build LibCCK Linux timestamping transports])
AC_DEFINE([CCK_BUILD_CLOCKDRIVER_LINUXPHC], [1], [Build LibCCK Linux PHC clock driver])
]
)
;;
esac
AM_CONDITIONAL([CCK_BUILD_TTRANSPORT_LINUXTS], [test "$build_linuxphc" = "true"])
AM_CONDITIONAL([CCK_BUILD_CLOCKDRIVER_LINUXPHC], [test "$build_linuxphc" = "true"])
build_timerfd=true
AC_CHECK_HEADERS([sys/timerfd.h], [], [build_timerfd=false], [])
AS_IF([test "$build_timerfd" = "true"],
[
AC_DEFINE([CCK_BUILD_TIMER_TIMERFD], [1], [Build LibCCK timer FD timer])
]
)
AM_CONDITIONAL([CCK_BUILD_TIMER_TIMERFD], [test "$build_timerfd" = "true"])
build_itimer=true
AC_CHECK_FUNCS([setitimer], [], [build_itimer=false])
AS_IF([test "$build_itimer" = "true"],
[
AC_DEFINE([CCK_BUILD_TIMER_ITIMER], [1], [Build LibCCK timer itimer])
]
)
AM_CONDITIONAL([CCK_BUILD_TIMER_ITIMER], [test "$build_itimer" = "true"])
AC_MSG_NOTICE([************************************************************])
AC_MSG_NOTICE([* PTPD BUILD FLAG AND LIBRARY DEPENDENCY CHECKS START HERE *])
AC_MSG_NOTICE([************************************************************])
AC_MSG_CHECKING([if we can build libdlpi transports])
case "$have_libdlpi" in
"true")
AC_MSG_RESULT([yes])
;;
*) AC_MSG_RESULT([no])
;;
esac
AC_MSG_CHECKING([if we can build itimer support])
case "$build_itimer" in
"true")
AC_MSG_RESULT([yes])
;;
*) AC_MSG_RESULT([no])
;;
esac
AC_MSG_CHECKING([if we can build FD timer support])
case "$build_timerfd" in
"true")
AC_MSG_RESULT([yes])
;;
*) AC_MSG_RESULT([no])
;;
esac
AC_CHECK_DECLS([POSIX_TIMERS_SUPPORTED], [build_posix_timers=true], [build_posix_timers=false], [
#ifdef __sun && !defined(_XPG6)
#define _XPG6
#endif
#include <unistd.h>
#if _POSIX_TIMERS && (_POSIX_TIMERS - 200112L) >= 0
#define POSIX_TIMERS_SUPPORTED
#else
#endif
])
AC_MSG_CHECKING([if we can build POSIX timer support])
case "$build_posix_timers" in
"true")
AC_DEFINE([CCK_BUILD_TIMER_POSIX], [1], [Build POSIX timer implementation])
AC_MSG_RESULT([yes])
;;
*) AC_MSG_RESULT([no])
;;
esac
AM_CONDITIONAL([CCK_BUILD_TIMER_POSIX], [test "$build_posix_timers" = "true" ])
AC_ARG_WITH(
[pcap-config],
[AS_HELP_STRING(
[--with-pcap-config],
[+ =pcap-config]
)],
[ans=$withval],
[ans=yes]
)
case "$ans" in
no)
;;
yes)
ans=pcap-config
;;
/*)
pcap_config_dirname=`dirname $ans`
pcap_config_basename=`basename $ans`
ans=abspath
;;
*/*)
AC_MSG_ERROR([--with-pcap-config takes either a name or an absolute path])
;;
*)
;;
esac
PROG_PCAP_CONFIG=$ans
case "$PROG_PCAP_CONFIG" in
no)
;;
abspath)
AC_PATH_PROG([PATH_PCAP_CONFIG], [$pcap_config_basename], [], [$pcap_config_dirname])
AS_UNSET([ac_cv_path_PATH_PCAP_CONFIG])
;;
*)
AC_PATH_PROG([PATH_PCAP_CONFIG], [$PROG_PCAP_CONFIG])
AS_UNSET([ac_cv_path_PATH_PCAP_CONFIG])
;;
esac
AC_MSG_CHECKING([if we want to build with libpcap support])
AC_ARG_ENABLE(
[pcap],
[AS_HELP_STRING(
[--disable-pcap],
[disable support for PCAP (enabled by default / if we find pcap-config)]
)],
[try_pcap=$enableval],
[try_pcap=yes]
)
if test "x$try_pcap" = "xyes"; then
case "$PATH_PCAP_CONFIG" in
/*)
AC_MSG_RESULT([yes, pcap-config])
AC_CHECK_HEADERS([pcap/pcap.h pcap.h])
try_pcap=yes
;;
*)
AC_MSG_RESULT([yes, guessing flags])
AC_CHECK_HEADERS([pcap/pcap.h pcap.h])
try_pcap=guess
;;
esac
fi
build_pcap=false
case "$try_pcap" in
yes)
case "$PATH_PCAP_CONFIG" in
/*)
PCAP_LIBS=`$PATH_PCAP_CONFIG --libs`
AC_SUBST([PCAP_LIBS])
# Separate CPPFLAGS and CFLAGS
foo=`$PATH_PCAP_CONFIG --cflags`
PCAP_CPPFLAGS=
PCAP_CFLAGS=
for i in $foo; do
case "$i" in
-D*|-F*|-U*|-I*)
PCAP_CPPFLAGS="$PCAP_CPPFLAGS $i"
;;
*) PCAP_CFLAGS="$PCAP_CFLAGS $i"
;;
esac
done
AC_SUBST([PCAP_CPPFLAGS])
AC_SUBST([PCAP_CFLAGS])
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LIBS=$LIBS
CFLAGS=$PCAP_CFLAGS
CPPFLAGS=$PCAP_CPPFLAGS
CFLAGS=$save_CFLAGS
AS_UNSET([save_CFLAGS])
CPPFLAGS=$save_CPPFLAGS
AS_UNSET([save_CPPFLAGS])
LIBS=$save_LIBS
AS_UNSET([save_LIBS])
AC_MSG_CHECKING([if we can build with libpcap support])
case "$ac_cv_header_pcap_pcap_h" in
yes)
build_pcap=true
AC_MSG_RESULT([yes])
;;
no)
case "$ac_cv_header_pcap_h" in
yes)
build_pcap=true
AC_MSG_RESULT([yes])
;;
no)
build_pcap=false
PCAP_LIBS=""
PCAP_CPPFLAGS=""
PCAP_CFLAGS=""
AC_MSG_RESULT([no])
;;
esac
;;
esac
;;
*)
# This case can't be triggered - we won't get here unless we
# have an absolute path to pcap-config.
AC_MSG_WARN([Cannot build with libpcap support - pcap-config cannot be found])
;;
esac
;;
guess)
PCAP_LIBS="-lpcap"
AC_SUBST([PCAP_LIBS])
AC_MSG_CHECKING([if we can build with PCAP support])
case "$ac_cv_header_pcap_pcap_h" in
yes)
build_pcap=true
AC_MSG_RESULT([yes])
;;
no)
case "$ac_cv_header_pcap_h" in
yes)
build_pcap=true
AC_MSG_RESULT([yes])
;;
no)
build_pcap=false
PCAP_LIBS=""
PCAP_CPPFLAGS=""
PCAP_CFLAGS=""
AC_MSG_RESULT([no])
;;
esac
;;
esac
;;
no)
build_pcap=false
PCAP_LIBS=""
PCAP_CPPFLAGS=""
PCAP_CFLAGS=""
AC_MSG_RESULT([no])
;;
esac
AS_IF([test "$build_pcap" = "true"],
[
AC_DEFINE([CCK_BUILD_TTRANSPORT_PCAP], [1], [Build LibCCK libpcap transports])
]
[]
)
AM_CONDITIONAL([CCK_BUILD_TTRANSPORT_PCAP], [test "$build_pcap" = "true"])
AC_ARG_WITH(
[net-snmp-config],
[AS_HELP_STRING(
[--with-net-snmp-config],
[+ =net-snmp-config]
)],
[ans=$withval],
[ans=yes]
)
case "$ans" in
no)
;;
yes)
ans=net-snmp-config
;;
/*)
net_snmp_config_dirname=`dirname $ans`
net_snmp_config_basename=`basename $ans`
ans=abspath
;;
*/*)
AC_MSG_ERROR([--with-net-snmp-config takes either a name or an absolute path])
;;
*)
;;
esac
PROG_NET_SNMP_CONFIG=$ans
case "$PROG_NET_SNMP_CONFIG" in
no)
;;
abspath)
AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$net_snmp_config_basename], [], [$net_snmp_config_dirname])
AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
;;
*)
AC_PATH_PROG([PATH_NET_SNMP_CONFIG], [$PROG_NET_SNMP_CONFIG])
AS_UNSET([ac_cv_path_PATH_NET_SNMP_CONFIG])
;;
esac
AC_MSG_CHECKING([if we want to try building SNMP support])
AC_ARG_ENABLE(
[snmp],
[AS_HELP_STRING(
[--disable-snmp],
[disable support for SNMP (enabled if we find net-snmp-config)]
)],
[try_snmp=$enableval],
[case "$PATH_NET_SNMP_CONFIG" in
/*)
try_snmp=yes
;;
*)
try_snmp=no
;;
esac]
)
AC_MSG_RESULT([$try_snmp])
ptpd_snmp_enabled=0
case "$try_snmp" in
yes)
case "$PATH_NET_SNMP_CONFIG" in
/*)
SNMP_LIBS=`$PATH_NET_SNMP_CONFIG --agent-libs`
AC_SUBST([SNMP_LIBS])
# HMS: we really want to separate CPPFLAGS and CFLAGS
foo=`$PATH_NET_SNMP_CONFIG --base-cflags`
SNMP_CPPFLAGS=
SNMP_CFLAGS=
for i in $foo; do
case "$i" in
-D*|-F*|-U*|-I*)
SNMP_CPPFLAGS="$SNMP_CPPFLAGS $i"
;;
*) SNMP_CFLAGS="$SNMP_CFLAGS $i"
;;
esac
done
AC_SUBST([SNMP_CPPFLAGS])
AC_SUBST([SNMP_CFLAGS])
save_CFLAGS=$CFLAGS
save_CPPFLAGS=$CPPFLAGS
save_LIBS=$LIBS
CFLAGS=$SNMP_CFLAGS
CPPFLAGS=$SNMP_CPPFLAGS
AC_CHECK_HEADER([net-snmp/net-snmp-config.h])
CFLAGS=$save_CFLAGS
AS_UNSET([save_CFLAGS])
CPPFLAGS=$save_CPPFLAGS
AS_UNSET([save_CPPFLAGS])
LIBS=$save_LIBS
AS_UNSET([save_LIBS])
AC_MSG_CHECKING([if we are building SNMP support])
case "$ac_cv_header_net_snmp_net_snmp_config_h" in
yes)
ptpd_snmp_enabled=1
AC_MSG_RESULT([yes])
;;
no)
SNMP_LIBS=""
SNMP_CPPFLAGS=""
SNMP_CFLAGS=""
AC_MSG_RESULT([no])
;;
esac
;;
*)
# This case can't be triggered - we won't get here unless we
# have an absolute path to net-snmp-config.
AC_MSG_WARN([Cannot build with SNMP support - net-snmp-config cannot be found])
;;
esac
;;
esac
AS_IF([test x$ptpd_snmp_enabled = x1],
[
AC_DEFINE([PTPD_SNMP], [1], [Build PTPd with SNMP support])
]
[]
)
AM_CONDITIONAL([PTPD_SNMP], [test x$ptpd_snmp_enabled = x1])
AC_MSG_CHECKING([for RUNTIME_DEBUG])
AC_ARG_ENABLE(
[runtime-debug],
[AS_HELP_STRING(
[--enable-runtime-debug (disabled by default)],
[Enable all debug messages]
)],
[],
[enable_runtime_debug=no]
)
AC_MSG_RESULT([$enable_runtime_debug])
case "$enable_runtime_debug" in
yes)
PTP_DBL="-DRUNTIME_DEBUG"
;;
*)
AC_MSG_CHECKING([for (old-style) debug message level])
AC_ARG_ENABLE(
[debug-level],
[AS_HELP_STRING(
[[[[--enable-debug-level={basic,medium,all}]]]],
[debug message level: basic, medium, all]
)],
[ptp_dblevel=$enableval],
[ptp_dblevel=no]
)
AC_MSG_RESULT([$ptp_dblevel])
case "$ptp_dblevel" in
"basic")
PTP_DBL="-DPTPD_DBG"
;;
"medium")
PTP_DBL="-DPTPD_DBG2"
;;
"all")
PTP_DBL="-DPTPD_DBGV"
;;
*) PTP_DBL=""
;;
esac
;;
esac
AC_SUBST(PTP_DBL)
AC_MSG_CHECKING([if we want to enable LibCCK debug mode])
AC_ARG_ENABLE(
[libcck-debug],
[AS_HELP_STRING(
[--enable-libcck-debug (disabled by default)],
[Enable LibCCK debug mode]
)],
[
AC_DEFINE([CCK_DEBUG], [1], [Enable LibCCK debug mode])
libcck_debug=yes
],
[libcck_debug=no]
)
AC_MSG_RESULT([$libcck_debug])
AC_MSG_CHECKING([for maximum unicast destination table size])
AC_ARG_WITH(
[max-unicast-destinations],
[AS_HELP_STRING(
[--with-max-unicast-destinations = [ 16 .. 2048 (default: 128)]],
[Change maximum supported number of unicast destinations -
this determines the maximum supported number of slaves
in unicast mode (with and without signaling)]
)],
[max_destinations=$with_max_unicast_destinations],
[max_destinations=128]
)
test $max_destinations -lt 16 && max_destinations=16
test $max_destinations -gt 2048 && max_destinations=2048
AC_DEFINE_UNQUOTED([PTP_UNICAST_MAX], [$max_destinations], [Maximum PTP unicast destinations])
AC_MSG_RESULT([$max_destinations])
AC_MSG_CHECKING([for non-default UTC to TAI offset])
AC_ARG_WITH(
[utc-tai-offset],
[AS_HELP_STRING(
[--with-utc-tai-offset = [ 0+ (default: LibCCK build default)]],
[Change the default UTC to TAI offset used. LibCCK provides its
own default value which is kept up to date with IERS Bulletin C.
This overrides this default.]
)],
[utc_tai_offset=$with_utc_tai_offset],
[utc_tai_offset=-1]
)
if test $utc_tai_offset -gt -1
then
AC_DEFINE_UNQUOTED([CCK_BUILD_UTC_TAI_OFFSET], [$utc_tai_offset], [Non-default LibCCK UTC to TAI offset])
AC_MSG_RESULT([$utc_tai_offset])
else
AC_MSG_RESULT([none given])
fi
AC_MSG_CHECKING([for daemon mode])
AC_ARG_ENABLE(
[daemon],
[AS_HELP_STRING(
[--disable-daemon (enabled by default)],
[Disable daemon mode]
)],
[],
[enable_daemon=yes]
)
AC_MSG_RESULT([$enable_daemon])
case "$enable_daemon" in
no)
PTP_DAEMON="-DPTPD_NO_DAEMON"
;;
esac
AC_SUBST(PTP_DAEMON)
AC_MSG_CHECKING([for clock sync profiling output])
AC_ARG_ENABLE(
[clock-sync-profiling],
[AS_HELP_STRING(
[--enable-clock-sync-profiling (disabled by default)],
[Enable inter-clock sync profiling log output]
)],
[],
[enable_clock_sync_profiling=no]
)
AC_MSG_RESULT([$enable_clock_sync_profiling])
case "$enable_clock_sync_profiling" in
yes)
PTP_PROFILING_OUTPUT="-DPTPD_CLOCK_SYNC_PROFILING"
;;
esac
AC_SUBST(PTP_PROFILING_OUTPUT)
AC_MSG_CHECKING([for experimental options])
AC_ARG_ENABLE(
[experimental-options],
[AS_HELP_STRING(
[--enable-experimental-options (disabled by default)],
[Enable experimental options]
)],
[],
[enable_experimental_options=no]
)
AC_MSG_RESULT([$enable_experimental_options])
case "$enable_experimental_options" in
yes)
PTP_EXP="-DPTPD_EXPERIMENTAL"
;;
esac
AC_SUBST(PTP_EXP)
AM_CONDITIONAL([EXP], [test x$enable_experimental_options = xyes])
AC_MSG_CHECKING([if we're building a slave-only build])
AC_ARG_ENABLE(
[slave-only],
[AS_HELP_STRING(
[--enable-slave-only (disabled by default)],
[Build a slave-only version incapable of running as PTP master]
)],
[],
[enable_slave_only=no]
)
AC_MSG_RESULT([$enable_slave_only])
case "$enable_slave_only" in
yes)
PTP_SLAVE_ONLY="-DPTPD_SLAVE_ONLY"
;;
esac
AC_SUBST(PTP_SLAVE_ONLY)
AM_CONDITIONAL([SLAVE_ONLY], [test x$enable_slave_only = xyes])
AC_MSG_NOTICE([************************************************************])
AC_MSG_NOTICE([* END OF PTPD BUILD FLAG AND LIBRARY DEPENDENCY CHECKS *])
AC_MSG_NOTICE([************************************************************])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([src/ptpd.8])
AC_CONFIG_FILES([src/ptpd.conf.5])
AC_OUTPUT