forked from CESNET/libnetconf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
687 lines (626 loc) · 21.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
#
# Copyright (c) 2012-2014 CESNET, z.s.p.o.
#
# LICENSE TERMS
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the Company nor the names of its contributors
# may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# ALTERNATIVELY, provided that this notice is retained in full, this
# product may be distributed under the terms of the GNU General Public
# License (GPL) version 2 or later, in which case the provisions
# of the GPL apply INSTEAD OF those given above.
#
# This software is provided ``as is'', and any express or implied
# warranties, including, but not limited to, the implied warranties of
# merchantability and fitness for a particular purpose are disclaimed.
# In no event shall the company or contributors be liable for any
# direct, indirect, incidental, special, exemplary, or consequential
# damages (including, but not limited to, procurement of substitute
# goods or services; loss of use, data, or profits; or business
# interruption) however caused and on any theory of liability, whether
# in contract, strict liability, or tort (including negligence or
# otherwise) arising in any way out of the use of this software, even
# if advised of the possibility of such damage.
#
# $Id$
#
# Process this file with autoconf to produce a configure script.
AC_INIT([libnetconf], m4_esyscmd([cut -f1 ./VERSION | tr -d '\n']))
m4_include([m4/ax_pthread.m4])
m4_include([m4/ax_python_module.m4])
AC_CANONICAL_HOST
PACKAGE_VERSION=`cut -f1 ./VERSION | tr -d '\n'`
AC_SUBST(PACKAGE_VERSION)
LIBTOOL_VERSION_INFO=`echo ${PACKAGE_VERSION} | sed -e 's/\./:/g' `
AC_SUBST(LIBTOOL_VERSION_INFO)
if test -n "`git branch | grep '\* *master'`"; then
RELEASE_TAG="_trunk"
fi
RELEASE="`git log | grep '^commit' | sed "/$(git log | grep -B 4 -m 1 "VERSION: bump to" | grep ^commit)/q" | wc -l`$RELEASE_TAG"
if test -z "${RELEASE}"; then
RELEASE=1
fi
AC_SUBST(RELEASE)
if test "`git show > /dev/null 2>&1;echo $?`" = "0"; then
CPPFLAGS="$CPPFLAGS -DRCSID=\\\"\$(IDGIT)\\\""
else
CPPFLAGS="$CPPFLAGS -DRCSID=\\\"\$(IDNOGIT)\\\""
fi
USERNAME=`git config --get user.name`
USERMAIL=`git config --get user.email`
AC_SUBST(USERNAME)
AC_SUBST(USERMAIL)
NC_WORKINGDIR_PATH="/var/lib/$PACKAGE_NAME/"
SETBIT=0
SETUSER=""
SETGROUP=""
CONFIGURE_PARAMS=""
LIBS="$LIBS -ldl"
# Check for pkg-config.
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR(['pkgconfig' not found.])
fi
# Check for pyang used in lnctool
AC_CHECK_PROG([HAVE_PYANG], [pyang], [yes], [])
AC_SUBST(HAVE_PYANG)
# hack for expanding paths in lnctool in case of building RPM package
AC_ARG_WITH([rpm], [],
[LNCTOOLDESTDIR=""],
[LNCTOOLDESTDIR="\$(DESTDIR)"]
)
AC_SUBST(LNCTOOLDESTDIR)
# Check for xsltproc used in lnctool
AC_CHECK_PROG([HAVE_XSLTPROC], [xsltproc], [yes], [])
AC_SUBST(HAVE_XSLTPROC)
AC_ARG_WITH([libxml2],
[AC_HELP_STRING([--with-libxml2], [specific libxml2 location])],
[
AC_CHECK_PROG([XML2_CONFIG], [xml2-config], [yes], [no], [$withval])
if test "$XML2_CONFIG" = "no"; then
AC_MSG_ERROR([Missing development package of libxml2.])
fi
CFLAGS="`$withval/xml2-config --cflags` $CFLAGS"
LIBXML2_LIBS="`$withval/xml2-config --libs`"
LIBS="$LIBXML2_LIBS $LIBS"
WITH_LIBXML2="$withval"
CONFIGURE_PARAMS="--with-libxml2=$withval $CONFIGURE_PARAMS"
AC_SUBST(LIBXML2_LIBS)
]
)
AC_ARG_WITH([libxslt],
[AC_HELP_STRING([--with-libxslt], [specific libxslt location])],
[
AC_CHECK_PROG([XSLT_CONFIG], [xslt-config], [yes], [no], [$withval])
if test "$XSLT_CONFIG" != "no"; then
AC_MSG_ERROR([Missing xslt-config to get XSLT flags for compilation.])
fi
CFLAGS="`$withval/xslt-config --cflags` $CFLAGS"
LIBS="`$withval/xslt-config --libs` $LIBS"
WITH_LIBXSLT="$withval"
CONFIGURE_PARAMS="--with-libxslt=$withval $CONFIGURE_PARAMS"
]
)
AC_ARG_VAR(READ_TIMEOUT, [Timeout [s] for reading a complete NETCONF message (30)])
if test -z "$READ_TIMEOUT"; then
READ_TIMEOUT=30
fi
AC_ARG_VAR(MONITORING_LIST_SIZE, [Size [KB] of the storage for NETCONF sessions monitoring (16)])
if test -z "$MONITORING_LIST_SIZE"; then
MONITORING_LIST_SIZE=16
fi
AC_ARG_ENABLE([libssh],
AC_HELP_STRING([--disable-libssh], [Use ssh client program instead of libssh.]),
if test "$enableval" = "no"; then
libssh="no"
CPPFLAGS="$CPPFLAGS -DDISABLE_LIBSSH"
LIBS="$LIBS -lutil" # forkpty()
LIBSSH_DIRECTIVE="#define DISABLE_LIBSSH"
CONFIGURE_PARAMS="--disable-libssh $CONFIGURE_PARAMS"
else
libssh="yes"
fi
,
# use libssh by default
libssh="yes"
)
AC_SUBST(LIBSSH_DIRECTIVE)
tls="no"
AC_ARG_ENABLE([tls],
AC_HELP_STRING([--enable-tls], [Enable support for NETCONF over TLS using OpenSSL.]),
if test "$enableval" = "yes"; then
tls="yes"
CPPFLAGS="$CPPFLAGS -DENABLE_TLS"
LIBS="$LIBS -lssl"
CONFIGURE_PARAMS="--enable-tls $CONFIGURE_PARAMS"
fi
)
dnssec="no"
AC_ARG_ENABLE([dnssec],
AC_HELP_STRING([--enable-dnssec], [Enable support for SSHFP retrieval using DNSSEC for SSH.]),
if test "$enableval" = "yes"; then
dnssec="yes"
CPPFLAGS="$CPPFLAGS -DENABLE_DNSSEC"
CONFIGURE_PARAMS="--enable-dnssec $CONFIGURE_PARAMS"
fi
)
AC_ARG_ENABLE([yang-schemas],
AC_HELP_STRING([--disable-yang-schemas], [Disable support for YANG format in <get-schema> operation.]),
[
if test "$enableval" = "no"; then
yang="no"
else
yang="yes"
fi
],
# it is supported by default
yang="yes"
)
if test "$yang" = "no"; then
CONFIGURE_PARAMS="--disable-yang-schemas $CONFIGURE_PARAMS"
CPPFLAGS="$CPPFLAGS -DDISABLE_YANGFORMAT"
fi
AC_ARG_ENABLE([notifications],
AC_HELP_STRING([--disable-notifications], [Disable support of NETCONF Notifications (RFC 5277)]),
[
if test "$enableval" = "no"; then
notif="no"
else
notif="yes"
fi
],
# notifications are supported by default
notif="yes"
)
if test "$notif" = "yes"; then
HDRS_PUBL_SUBDIR_NOTIFICATIONS="src/notifications.h src/notifications_xml.h"
HDRS_PRIV_NOTIFICATIONS="src/notifications.h src/notifications_xml.h"
SRCS_NOTIFICATIONS="src/notifications.c"
[INCLUDE_NOTIFICATIONS="#include \"libnetconf/notifications.h\""]
[INCLUDE_NOTIFICATIONS_XML="#include \"libnetconf/notifications_xml.h\""]
PROVIDES="$PROVIDES libnetconf-notifications"
else
CONFIGURE_PARAMS="$CONFIGURE_PARAMS --disable-notifications"
CPPFLAGS="$CPPFLAGS -DDISABLE_NOTIFICATIONS"
HDRS_PUBL_SUBDIR_NOTIFICATIONS=""
HDRS_PRIV_NOTIFICATIONS=""
SRCS_NOTIFICATIONS=""
[INCLUDE_NOTIFICATIONS="#define DISABLE_NOTIFICATIONS"]
[INCLUDE_NOTIFICATIONS_XML="#define DISABLE_NOTIFICATIONS"]
fi
AC_ARG_ENABLE([url],
AC_HELP_STRING([--disable-url], [Disable support of NETCONF URL Capability (RFC 6241)]),
[
if test "$enableval" = "no"; then
url="no"
else
url="yes"
fi
],
# URL Capability is supported by default
url="yes"
)
if test "$url" = "yes"; then
HDRS_PUBL_SUBDIR_URL="src/url.h"
HDRS_PRIV_URL="src/url_internal.h src/url.h"
SRCS_URL="src/url.c"
[INCLUDE_URL="#include \"libnetconf/url.h\""]
PROVIDES="$PROVIDES libnetconf-url"
else
CONFIGURE_PARAMS="$CONFIGURE_PARAMS --disable-url"
CPPFLAGS="$CPPFLAGS -DDISABLE_URL"
HDRS_PUBL_SUBDIR_URL=""
HDRS_PRIV_URL=""
SRCS_URL=""
[INCLUDE_URL="#define DISABLE_URL"]
fi
AC_ARG_ENABLE([validation],
AC_HELP_STRING([--disable-validation], [Disable support for configuration data validation]),
[
if test "$enableval" = "no"; then
validation="no"
else
validation="yes"
fi
],
# support validation by default
validation="yes"
)
if test "$validation" = "no"; then
CONFIGURE_PARAMS="--disable-validation $CONFIGURE_PARAMS"
CPPFLAGS="$CPPFLAGS -DDISABLE_VALIDATION"
fi
AC_ARG_ENABLE([doc],
AC_HELP_STRING([--disable-doc], [Disable generation of documentation]),
[
if test "$enableval" = "no"; then
doc="no"
else
doc="yes"
fi
],
# support doc by default
doc="yes"
)
if test "$doc" = "no"; then
INSTALL_DOC=""
else
INSTALL_DOC=install-doc
fi
AC_SUBST(INSTALL_DOC)
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug],[Compile with debug options]),
CFLAGS="$CFLAGS -g -O0 -DDEBUG"
CONFIGURE_PARAMS="--enable-debug $CONFIGURE_PARAMS",
CFLAGS="$CFLAGS -O3 -DNDEBUG"
)
AC_ARG_ENABLE([debug-threads],
AC_HELP_STRING([--enable-debug-threads],[Extend debug mode for threads]),
CPPFLAGS="$CPPFLAGS -DDEBUG_THREADS"
CONFIGURE_PARAMS="--enable-debug-threads $CONFIGURE_PARAMS"
)
AC_ARG_WITH([workingdir],
AC_HELP_STRING([--with-workingdir=path],[Path to a working directory of libnetconf, the default value is /var/lib/libnetconf/]),
NC_WORKINGDIR_PATH="$withval"
CONFIGURE_PARAMS="--with-workingdir=$withval $CONFIGURE_PARAMS"
)
AC_ARG_WITH([sessionfiledir],
AC_HELP_STRING([--with-sessionfiledir=path],[Path to a session file directory of libnetconf, the default value is inside libnetconf working directory]),
NC_SESSIONFILE_PATH="$withval"
CONFIGURE_PARAMS="--with-sessionfiledir=$withval $CONFIGURE_PARAMS"
,
NC_SESSIONFILE_PATH="$NC_WORKINGDIR_PATH"
)
AC_ARG_WITH([maxnotificationfilesize],
AC_HELP_STRING([--with-maxnotificationfilesize=size],[Maximum size for the notification stream files, if not specified the file can grow indefinitely]),
NCNTF_STREAMS_MAX_SIZE_IN_MB="$withval"
CONFIGURE_PARAMS="--with-maxnotificationfilesize=$withval $CONFIGURE_PARAMS"
,
NCNTF_STREAMS_MAX_SIZE_IN_MB=0
)
AC_ARG_WITH([streamsdir],
AC_HELP_STRING([--with-streamsdir=path],[Path to the events streams, the default value is streams subdirectory of libnetconf working directory]),
NCNTF_STREAMS_PATH="$withval"
CONFIGURE_PARAMS="--with-streamsdir=$withval $CONFIGURE_PARAMS"
,
NCNTF_STREAMS_PATH="$NC_WORKINGDIR_PATH/streams/"
)
AC_ARG_WITH([suid],
AC_HELP_STRING([--with-suid=user],[When creating files or directories using libnetconf, rely on the SUID bit set and change their ownership to the specified user]),
if test "$withval" != "no"; then
SETBIT=$(($SETBIT | 1))
if test "$withval" != "yes"; then
SETUSER="$withval"
else
SETUSER="`id -un`"
fi
CONFIGURE_PARAMS="--with-suid=$withval $CONFIGURE_PARAMS"
fi
)
AC_ARG_WITH([sgid],
AC_HELP_STRING([--with-sgid=group],[When creating files or directories using libnetconf, rely on the SGID bit set and change their ownership to the specified group]),
if test "$withval" != "no"; then
SETBIT=$(($SETBIT | 2))
if test "$withval" != "yes"; then
SETGROUP="$withval"
else
SETGROUP="`id -gn`"
fi
CONFIGURE_PARAMS="--with-sgid=$withval $CONFIGURE_PARAMS"
fi
)
AC_ARG_WITH([nacm-recovery-uid],
AC_HELP_STRING([--with-nacm-recovery-uid=uid], [Set UID to be used to identify NACM recovery session, default value is 0.]),
[
if test -z "$withval"; then
NACM_RECOVERY_UID="0"
elif expr "$withval" : "-\?[[0-9]]\+$" > /dev/null ; then
NACM_RECOVERY_UID="$withval"
CONFIGURE_PARAMS="--with-nacm-recovery-uid=$withval $CONFIGURE_PARAMS"
else
AC_MSG_ERROR([Invalid NACM recovey UID. The value must be a valid number.])
fi
],
NACM_RECOVERY_UID="0"
)
AC_ARG_WITH([pyapi],
AC_HELP_STRING([--with-pyapi@<:@=path_to_python3@:>@], [Build also libnetconf Python API. Optionally provide path to python3.]),
[
if test "$withval" = "yes"; then
AC_PATH_PROG([PYTHON], [python3], ["missing"])
if test "$PYTHON" = "missing"; then
AC_MSG_ERROR([Missing python3.])
fi
elif test "$withval" != "no"; then
AC_MSG_CHECKING([python3])
if test -x "$withval"; then
PYTHON="$withval"
AC_MSG_RESULT([$withval])
else
AC_MSG_RESULT([invalid])
AC_MSG_ERROR([Given python3 ($withval) is not executable.])
fi
fi
# Check python for manager and configurator
AX_PYTHON_MODULE(distutils, fatal)
PYPREFIX="`$PYTHON -c 'import os.path; import sys; print(os.path.abspath(sys.prefix));'`"
AC_SUBST(PYPREFIX)
],[]
)
AC_SUBST(PYTHON)
############################ Check for programs ################################
# Check for architecture, only x86 and x86_64 are supported
if test -z "$host_cpu";
then
AC_CHECK_PROG([UNAME], [uname], [yes], [no])
if test "$UNAME" = "no"; then
AC_MSG_ERROR(["uname not found!"])
fi
build_cpu=`uname -m`
host_cpu=$build_cpu
fi
AC_MSG_CHECKING([for host architecture])
case $host_cpu in
i?86 )
AC_MSG_RESULT($host_cpu is supported)
;;
x86_64 )
AC_MSG_RESULT($host_cpu is supported)
;;
* )
AC_MSG_WARN([unsupported architecture $host_cpu])
;;
esac
if test "$libssh" = "no"; then
# ssh for NETCONF connection
AC_PATH_PROG([SSH_PROG], [ssh], ["missing"])
if test "$SSH_PROG" = "missing"; then
AC_MSG_ERROR([Missing ssh client (install OpenSSH)])
fi
fi
# Check for doxygen
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, no)
# Check for rpmbuild
AC_CHECK_PROG(RPMBUILD, rpmbuild, rpmbuild, no)
# Check whether readlink supports the -f option
READLINK_FKNOWN=`$readlink -f xxx 1>/dev/null 2>&1 && echo yes`
if test "x${READLINK_FKNOWN}" != "xyes";
then
# Try finding greadlink (e.g., Mac OS X)
AC_CHECK_PROG(READLINK, greadlink, greadlink, readlink)
if test "x${READLINK}" = "xreadlink";
then
AC_MSG_WARN([Try installing greadlink.])
fi
else
AC_SUBST(READLINK, [readlink])
fi
AC_CHECK_PROG([LIBT], [libtool], [yes], [no])
if test "$LIBT" = "no"; then
AC_MSG_ERROR([Missing libtool])
fi
# Check for standard programs
AC_PROG_CC(clang llvm-gcc gcc)
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_INSTALL
# Use libtool
AC_PROG_LIBTOOL
# Always use ./libtool unless overridden from command-line
if test -z "$libtool"; then
libtool='./libtool'
fi
AC_SUBST(libtool)
# Check for compiler's visibility attribute
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fvisibility=hidden"
AC_MSG_CHECKING(for ELF visibility)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#pragma GCC visibility push(hidden)
__attribute__((visibility("default")))
int var=10;
]])
],[
AC_MSG_RESULT([yes])
API="__attribute__((visibility(\"default\")))"
],[
AC_MSG_RESULT([no])
CFLAGS="$SAVE_CFLAGS"
API=""
]
)
AC_SUBST(API)
############################ Check for libraries ###############################
export PKG_CONFIG_PATH=/usr/local/${libdir##*/}/pkgconfig:$PKG_CONFIG_PATH
### libxml2 ###
if test -z "$WITH_LIBXML2" ; then
AC_CHECK_PROG([XML2_CONFIG], [xml2-config], [yes], [no], [$WITH_LIBXML2 $PATH])
if test "$XML2_CONFIG" = "no"; then
AC_MSG_ERROR([Missing development package of libxml2.])
fi
CFLAGS="`xml2-config --cflags` $CFLAGS"
LIBXML2_LIBS="`xml2-config --libs`"
LIBS="$LIBXML2_LIBS $LIBS"
AC_SUBST(LIBXML2_LIBS)
fi
AC_CHECK_LIB([xml2], [xmlDOMWrapReconcileNamespaces],
[HAVE_LIBXML2_RECONNS="#define HAVE_XMLDOMWRAPRECONCILENAMESPACE"],
[HAVE_LIBXML2_RECONNS="#undef HAVE_XMLDOMWRAPRECONCILENAMESPACE"]
)
### libxslt ###
if test "$validation" = "yes" -o "$yang" = "yes"; then
if test -z "$WITH_LIBXSLT" ; then
AC_CHECK_PROG([XSLT_CONFIG], [xslt-config], [yes], [no], [$WITH_LIBXSLT $PATH])
if test "$XSLT_CONFIG" != "no"; then
CFLAGS="`xslt-config --cflags` $CFLAGS"
LIBS="`xslt-config --libs` $LIBS"
fi
fi
AC_CHECK_LIB([xslt], [xsltApplyStylesheet], [], AC_MSG_ERROR([Missing libxslt library]))
AC_CHECK_HEADERS([libxslt/transform.h libxslt/xsltInternals.h], [], AC_MSG_ERROR([Missing libxslt headers]))
fi
if test "$libssh" = "yes"; then
### libssh ###
AC_CHECK_LIB([ssh], [ssh_threads_get_pthread], [], [
AC_CHECK_LIB([ssh], [ssh_pki_key_ecdsa_name], [], AC_MSG_ERROR([Missing libssh (>=0.6.4).]))
AC_CHECK_LIB([ssh_threads], [ssh_threads_get_pthread], [], AC_MSG_ERROR([Missing the libssh_threads library.]))
])
AC_CHECK_HEADERS([libssh/libssh.h], [], AC_MSG_ERROR([Missing libssh headers.]))
BUILDREQS="$BUILDREQS libssh-devel >= 0.6.4"
DEVELREQS="$DEVELREQS libssh-devel >= 0.6.4"
fi
SRCS_TRANSPORT="src/ssh.c"
HDRS_PRIV_TRANSPORT="src/ssh.h"
if test "$tls" = "yes"; then
### OpenSSL ###
AC_CHECK_LIB([ssl], [SSL_library_init], [], AC_MSG_ERROR([Missing OpenSSL library.]))
AC_CHECK_HEADERS([openssl/bio.h openssl/ssl.h openssl/err.h openssl/pem.h], [], AC_MSG_ERROR([Missing OpenSSL headers.]))
SRCS_TRANSPORT="$SRCS_TRANSPORT src/tls.c"
HDRS_PRIV_TRANSPORT="$HDRS_PRIV_TRANSPORT src/tls.h"
HDRS_PRIV_TLS="src/libnetconf_tls.h"
HDRS_PUBL_TLS="headers/libnetconf_tls.h"
BUILDREQS="$BUILDREQS openssl-devel >= 1.0.0"
DEVELREQS="$DEVELREQS openssl-devel >= 1.0.0"
elif test "$dnssec" = "yes"; then
AC_CHECK_LIB([ssl], [SSL_library_init], [], AC_MSG_ERROR([Missing OpenSSL library.]))
AC_CHECK_HEADERS([openssl/bio.h openssl/ssl.h openssl/err.h openssl/pem.h], [], AC_MSG_ERROR([Missing OpenSSL headers.]))
BUILDREQS="$BUILDREQS openssl-devel >= 1.0.0"
DEVELREQS="$DEVELREQS openssl-devel >= 1.0.0"
fi
### pthread ###
AX_PTHREAD([
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"], AC_MSG_ERROR([Missing POSIX threads support.]))
#AC_CHECK_LIB([pthread], [pthread_create], [], AC_MSG_ERROR([Missing POSIX threads library.]))
AC_CHECK_HEADERS([pthread.h], [], AC_MSG_ERROR([Missing POSIX threads headers.]))
# This must be after pthread detection
AC_SEARCH_LIBS([sem_init], [pthread rt], ,
[AC_MSG_ERROR([Could not find sem_init() in expected locations. Install or/and add the comprising library into the list of tested libraries.])])
if test "$dnssec" = "yes"; then
# This must be after pthread as well...
LIBS="$LIBS -lval-threads -lsres"
if test "$tls" = "no"; then
LIBS="$LIBS -lssl"
fi
### libval (libval-threads & libsres) ###
AC_CHECK_LIB([val-threads], [val_res_query], [], AC_MSG_ERROR([Missing libval-threads (libval part) library.]))
AC_CHECK_LIB([sres], [ns_initparse], [], AC_MSG_ERROR([Missing libsres (libval part) library.]))
AC_CHECK_HEADERS([validator/validator.h validator/resolver.h validator/validator-compat.h], [], AC_MSG_ERROR([Missing libval headers.]))
fi
if test "$url" = "yes"; then
### libcurl ###
PKG_CHECK_MODULES([CURL], [libcurl])
AC_CHECK_LIB([curl], [curl_global_init], [], AC_MSG_ERROR([Missing libcurl.]))
AC_CHECK_HEADERS([curl/curl.h], [], AC_MSG_ERROR([Missing libcurl headers.]))
BUILDREQS="$BUILDREQS libcurl-devel"
fi
###################### Check for configure parameters ##########################
######################### Checks for header files ##############################
AC_CHECK_HEADERS([fcntl.h limits.h netdb.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/socket.h termios.h unistd.h], [], AC_MSG_ERROR([Missing system headers.]))
AC_CHECK_HEADERS([utmpx.h], [HAVE_UTMPX="#define HAVE_UTMPX_H"], [HAVE_UTMPX="#undef HAVE_UTMPX_H"])
######## Checks for typedefs, structures, and compiler characteristics #########
AC_CHECK_HEADER_STDBOOL
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_INT32_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT64_T
######################## Checks for library functions ##########################
AC_FUNC_GETGROUPS
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_CHECK_FUNCS([ftruncate memset mkdir munmap socket strcasecmp strchr strdup strerror strrchr strstr strtol strtoul])
if test "$libssh" = "no"; then
AC_CHECK_FUNCS([dup2])
fi
AC_CHECK_FUNC([eaccess], [HAVE_EACCESS="#define HAVE_EACCESS"], [HAVE_EACCESS="#undef HAVE_EACCESS"] )
### check for the shared memory implementation
AC_CHECK_FUNC([shmc], [],
[LIBS="$LIBS -lrt"
AC_CHECK_FUNCS([shm_open],
[CPPFLAGS="$CPPFLAGS -DPOSIX_SHM"],
[AC_MSG_ERROR([Missing shared memory implementation.])])
]
)
############################### Set output #####################################
AC_SUBST(V_SHLIB_CMD)
AC_SUBST(V_SHLIB_OPT)
AC_SUBST(V_SONAME_OPT)
AC_SUBST(NACM_RECOVERY_UID)
AC_SUBST(BUILDREQS)
AC_SUBST(DEVELREQS)
AC_SUBST(PROVIDES)
AC_SUBST(DISTRO)
AC_SUBST(NC_WORKINGDIR_PATH)
AC_SUBST(NC_SESSIONFILE_PATH)
AC_SUBST(NCNTF_STREAMS_MAX_SIZE_IN_MB)
AC_SUBST(NCNTF_STREAMS_PATH)
AC_SUBST(SETBIT)
AC_SUBST(SETUSER)
AC_SUBST(SETGROUP)
AC_SUBST(HDRS_PUBL_SUBDIR_NOTIFICATIONS)
AC_SUBST(HDRS_PRIV_NOTIFICATIONS)
AC_SUBST(HDRS_PRIV_TLS)
AC_SUBST(HDRS_PUBL_TLS)
AC_SUBST(SRCS_TRANSPORT)
AC_SUBST(HDRS_PRIV_TRANSPORT)
AC_SUBST(SRCS_NOTIFICATIONS)
AC_SUBST(INCLUDE_NOTIFICATIONS)
AC_SUBST(INCLUDE_NOTIFICATIONS_XML)
AC_SUBST(HDRS_PUBL_SUBDIR_URL)
AC_SUBST(HDRS_PRIV_URL)
AC_SUBST(SRCS_URL)
AC_SUBST(INCLUDE_URL)
AC_SUBST(CONFIGURE_PARAMS)
AC_SUBST(HAVE_EACCESS)
AC_SUBST(HAVE_UTMPX)
AC_SUBST(HAVE_LIBXML2_RECONNS)
AC_SUBST(SSH_PROG)
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(READ_TIMEOUT)
AC_SUBST(MONITORING_LIST_SIZE)
AC_SUBST(DOXYGEN)
if test -z "$DOXYGEN"; then
AC_MSG_WARN([Due to missing doxygen you will not able to generate Doxygen documentation.])
else
# check for dot if we are able to use it
AC_CHECK_PROG([GRAPHS], [dot], [YES], [NO])
AC_SUBST(GRAPHS)
fi
AC_SUBST(RPMBUILD)
if test -z "$RPMBUILD"; then
AC_MSG_WARN([Due to missing rpmbuild you will not able to generate RPM package.])
fi
if test -z "$HAVE_XSLTPROC"; then
AC_MSG_WARN([Due to missing xsltproc, lnctool will not work.])
fi
if test -z "$HAVE_PYANG"; then
AC_MSG_WARN([Due to missing pyang, lnctool will not work.])
fi
if test -n "$PYTHON"; then
AC_CONFIG_FILES(python/python3-netconf.spec)
fi
AC_CONFIG_FILES(dev-tools/lncdatastore/Makefile)
AC_CONFIG_FILES(Makefile src/config.h libnetconf.spec libnetconf.pc Doxyfile)
AC_CONFIG_FILES(headers/libnetconf.h headers/libnetconf_xml.h headers/libnetconf_ssh.h)
AC_OUTPUT