-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathconfigure.ac
2428 lines (2251 loc) · 59.5 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
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AC_INIT([gensio],[2.8.11],[minyard@acm.org])
AC_SUBST(gensio_VERSION_MAJOR, 2)
AC_SUBST(gensio_VERSION_MINOR, 8)
AC_SUBST(gensio_VERSION_PATCH, 11)
AC_SUBST(gensio_VERSION_STRING, ${PACKAGE_VERSION})
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([-Wall])
AC_CONFIG_HEADERS([config.h])
AC_PROG_CC
AC_PROG_CXX
# Per discussions with the Debian maintainer, it's best for
# maintainers to have all the soname libary versions be the same if
# they come from a single source. So here it is.
GENSIO_LIB_VERSION=12:0:2
AC_SUBST(GENSIO_LIB_VERSION)
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [add -g option when building])
AS_HELP_STRING([--disable-debug], [remove -g option when building])])
if test -z ${enable_debug}; then
add_mg=yes
else
add_mg=${enable_debug}
fi
# Add or remove -g as necessary. This is message because we have to match
# -g at the beginning, end, in the middle, or by itself in the CFLAGS string.
# Maybe there is a better way to do this?
# Space and tab
ST='[[ ]]'
if test "${add_mg}" = yes; then
if ! echo "$CFLAGS" | grep -e "^-g${ST}" -e "${ST}-g$" -e "${ST}-g${ST}" -e "^-g$" ; then
CFLAGS="$CFLAGS -g"
fi
else
CFLAGS=`echo $CFLAGS | sed -e "s/^-g${ST}//" -e "s/${ST}-g$//" -e "s/${ST}-g${ST}/ /g" -e "s/^-g$//"`
fi
AM_PROG_AR
# Per discussion at:
# https://lists.gnu.org/archive/html/libtool/2022-09/msg00000.html
# This enabled RUNPATH over RPATH. libtool will not set
# LD_LIBRARY_PATH if RPATH is used, but the code uses LD_LIBRARY_PATH
# as a way to find module object files. So this is a hack until a
# workaround is available.
OLD_LDFLAGS="$LDFLAGS"
if uname -a | grep '^Linux' >/dev/null 2>/dev/null; then
LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
fi
LT_INIT(dlopen)
LDFLAGS="$OLD_LDFLAGS"
# defaults
OSH_LIBS=
BASE_LIBS=
AM_CFLAGS=
AM_CXXFLAGS=
EXTRA_CFLAGS=
uucp_locking_flag=yes
UUCP_LOCK_DIR=/var/spool/lock
flock_locking_flag=yes
USE_FILE_STDIO=0
broken_pselect=no
system_type=unix
# macos defines git_t, but getgrouplist() takes int*
USE_GGL_INT=0
# posix_openpt doesn't work like what we want on macos. You have to
# open the client before you can set the file descriptor non-blocking,
# which is a fairly annoying thing. See
# https://developer.apple.com/forums/thread/734230 for details.
USE_OPENPTY=0
# openssl calls sigprocmask() in it's startup code for ARM and some
# other processors. On at least macos, this affects all threads, not
# just the calling thread. So if you load it while threads are
# running, it will modify the thread masks of all running threads, and
# screw things up for waking using signals. Check for this on
# platforms that need it, and link -lssl to the main program to avoid
# the issue. See
# https://github.com/openssl/openssl/issues/21541
link_ssl_with_main=no
# Python extension modules end in .pyd on Windows, so we need to override
# the extension from .dll to that. We can ignore it on everything else.
PYTHON_EXT_EXT=.so
PYTHON_EXT_EXT_SET=
# Windows requires that -no-undefined be set, but homebrew on MacOS requires
# that -undefined be set. Sigh.
PYTHON_UNDEF_FLAG=-undefined
# Do we use the login program to login with gtlsshd, or do we directly
# run the shell? On MacOS you need to use login for things to work right.
USE_LOGIN_PROGRAM=0
# Do we have unix credentials on unix sockets?
HAVE_UCRED=0
HAVE_WIN32SOUND=0
case $target_os in
mingw*)
OSH_LIBS="$OSH_LIBS -lws2_32 -liphlpapi -lgdi32 -lbcrypt"
OSH_LIBS="$OSH_LIBS -lsecur32 -luserenv -lwtsapi32"
OSH_LIBS="$OSH_LIBS -lole32"
uucp_locking_flag=no
flock_locking_flag=no
system_type=windows
USE_FILE_STDIO=1
PYTHON_EXT_EXT=".pyd"
PYTHON_EXT_EXT_SET="-shrext .pyd"
PYTHON_UNDEF_FLAG=-no-undefined
HAVE_WIN32SOUND=1
;;
cygwin*)
OSH_LIBS="$OSH_LIBS -ldl"
uucp_locking_flag=no
flock_locking_flag=no
;;
linux*)
OSH_LIBS="$OSH_LIBS -ldl"
UUCP_LOCK_DIR=/var/lock
HAVE_UCRED=1
;;
darwin*)
# macos
OSH_LIBS="$OSH_LIBS -ldl"
link_ssl_with_main=check
uucp_locking_flag=no
USE_GGL_INT=1
USE_OPENPTY=1
USE_LOGIN_PROGRAM=1
HAVE_UCRED=1
broken_pselect=yes
;;
freebsd*)
OSH_LIBS="$OSH_LIBS -ldl"
broken_pselect=yes
HAVE_UCRED=1
;;
*bsd* | *BSD*)
OSH_LIBS="$OSH_LIBS -ldl"
broken_pselect=yes
;;
*)
# Defaults, maybe it will work
OSH_LIBS="$OSH_LIBS -ldl"
;;
esac
AC_DEFINE_UNQUOTED([USE_GGL_INT], [$USE_GGL_INT],
[Set to 1 to use gid_t, 0 to use int for groups])
AM_CONDITIONAL([USE_GGL_INT], [test ${USE_GGL_INT} = 1])
AC_SUBST(USE_GGL_INT)
AC_DEFINE_UNQUOTED([USE_OPENPTY], [$USE_OPENPTY],
[Set to 1 to use openpty, 0 to use posix_openpt])
AM_CONDITIONAL([USE_OPENPTY], [test ${USE_OPENPTY} = 1])
AC_SUBST(USE_OPENPTY)
AC_SUBST(PYTHON_EXT_EXT)
AC_SUBST(PYTHON_EXT_EXT_SET)
AC_DEFINE_UNQUOTED([USE_LOGIN_PROGRAM], [$USE_LOGIN_PROGRAM],
[Set to 1 to use login, 0 to directly execute the shell on login])
AM_CONDITIONAL([USE_LOGIN_PROGRAM], [test ${USE_LOGIN_PROGRAM} = 1])
AC_SUBST(USE_LOGIN_PROGRAM)
AC_DEFINE_UNQUOTED([HAVE_UCRED], [$HAVE_UCRED],
[Set to 1 if Unix credentials (permissions) enabled, 0 if not])
AM_CONDITIONAL([HAVE_UCRED], [test ${HAVE_UCRED} = 1])
AC_SUBST(HAVE_UCRED)
AC_ARG_WITH(link-ssl-with-main,
[AS_HELP_STRING([--with-link-ssl-with-main=[yes|no]],
[Link libssl with the main program. See "Issues with openssl and signal masks" in the FAQ])],
[link_ssl_with_main="$withval"]
)
pkgconfig_update_info() {
AC_MSG_CHECKING(["CPPFLAGS for $1"])
new_cppflags=`pkg-config --cflags $1`
if test -z $new_cppflags; then
AC_MSG_RESULT(["Not available"])
else
CPPFLAGS="$new_cppflags $CPPFLAGS"
AC_MSG_RESULT(["$new_cppflags"])
fi
AC_MSG_CHECKING(["LDFLAGS for $1"])
new_ldflags=`pkg-config --libs-only-L $1`
if test -z $new_ldflags; then
AC_MSG_RESULT(["Not available"])
else
LDFLAGS="$new_ldflags $LDFLAGS"
AC_MSG_RESULT(["$new_ldflags"])
fi
}
case $target_os in
darwin*)
pkgconfig_update_info openssl
pkgconfig_update_info portaudio-2.0
;;
*) ;;
esac
if test "$link_ssl_with_main" = "check"; then
AC_MSG_CHECKING([if ssl needs to be linked with the main library])
OPENSSLLIBDIR=`pkg-config --libs-only-L openssl | sed 's/-L//'`
AC_LANG_PUSH(C)
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <pthread.h>
#include <dlfcn.h>
#include <assert.h>
#include <sys/select.h>
struct cross_thread_info {
int waitfd;
int err;
};
static void *
cross_thread(void *data)
{
struct cross_thread_info *info = data;
sigset_t sigmask, omask;
int rv = 0;
fd_set rfds;
rv = pthread_sigmask(SIG_SETMASK, NULL, &sigmask);
assert(rv == 0);
if (!sigismember(&sigmask, SIGUSR1)) {
fprintf(stderr, "SIGUSR1 not in sigmask 1\n");
info->err = 1;
goto out_err;
}
FD_ZERO(&rfds);
FD_SET(info->waitfd, &rfds);
sigdelset(&sigmask, SIGUSR1);
rv = pthread_sigmask(SIG_SETMASK, &sigmask, &omask);
assert(rv == 0);
rv = pselect(info->waitfd + 1, &rfds, NULL, NULL, NULL, NULL);
assert(rv == 1);
rv = pthread_sigmask(SIG_SETMASK, &omask, &sigmask);
assert(rv == 0);
if (sigismember(&sigmask, SIGUSR1)) {
fprintf(stderr, "SIGUSR1 in sigmask 1\n");
info->err = 4;
goto out_err;
}
out_err:
return NULL;
}
static int
check_pselect_cross_thread(sigset_t mask)
{
int rv = 1;
int pipefds[2] = { -1, -1 };
struct cross_thread_info info;
pthread_t th;
char dummy = 0;
rv = pipe(pipefds);
if (rv == -1) {
perror("pipe");
return 1;
}
info.err = 0;
info.waitfd = pipefds[0];
rv = pthread_create(&th, NULL, cross_thread, &info);
sleep(2); /* Give the thread time to enter pselect() */
if (dlopen("$OPENSSLLIBDIR/libssl.dylib", RTLD_LAZY | RTLD_GLOBAL) == NULL) {
fprintf(stderr, "dlopen failed: %s\n", dlerror());
rv = 1;
}
write(pipefds[1], &dummy, 1);
pthread_join(th, NULL);
if (!rv)
rv = info.err;
if (!rv)
printf("dlopen does not affect other threads' sigmasks\n");
close(pipefds[0]);
close(pipefds[1]);
return rv;
}
int
main(int argc, char *argv[])
{
sigset_t mask;
int rv;
/* Start with SIGUSR1 blocked. */
rv = sigprocmask(SIG_SETMASK, NULL, &mask);
assert(rv == 0);
sigaddset(&mask, SIGUSR1);
rv = sigprocmask(SIG_SETMASK, &mask, NULL);
assert(rv == 0);
rv = check_pselect_cross_thread(mask);
return rv;
}]])],
[link_ssl_with_main=no],
[[if test $? = 4; then
link_ssl_with_main=yes
else
link_ssl_with_main=failed
fi
]],
[link_ssl_with_main=yes])
AC_LANG_POP(C)
AC_MSG_RESULT($link_ssl_with_main)
if test $link_ssl_with_main == failed; then
AC_MSG_FAILURE([Error running ssl link test program.])
fi
fi
if test "$version_type" = "windows"; then
# LN_S gets set to "cp -pR", which just doesn't work. MinGW has
# a working "ln", so force it.
LN_SF="ln -sf"
else
LN_SF="\$(LN_S) -f"
fi
AC_SUBST(LN_SF)
# If compiling static, turn off DLL visibility, primarily so Windows
# will link properly. Don't allow both static and shared libraries
# to be built at the same time for now.
if test "$version_type" = "windows"; then
if test "${enable_shared}" = yes; then
enable_static=no
fi
if test "$enable_static" = "yes"; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -DGENSIO_LINK_STATIC"
fi
# Need to pull in some special things for osops.
EXTRA_CFLAGS="$EXTRA_CFLAGS -DNTDDI_VERSION=0x0a000006 -DWINVER=0x0602"
fi
moduleinstalldir="\$(pkglibexecdir)"
AC_ARG_WITH(moduleinstall,
[AS_HELP_STRING([--with-moduleinstall=PATH],
[Install gensio modules in the given location.])],
moduleinstalldir="$withval",
)
AC_SUBST(moduleinstalldir)
AC_ARG_WITH(uucp-locking,
[AS_HELP_STRING([--with-uucp-locking], [Enable UUCP-style locking with yes/no, or set the uucp lock directory otherwise])],
uucp_locking_flag="$withval")
case "$uucp_locking_flag" in
yes)
USE_UUCP_LOCKING=1
;;
no)
USE_UUCP_LOCKING=0
;;
*)
USE_UUCP_LOCKING=1
UUCP_LOCK_DIR="$uucp_locking_flag"
;;
esac
AC_DEFINE_UNQUOTED([USE_UUCP_LOCKING], [$USE_UUCP_LOCKING],
[Enable device locking])
AC_DEFINE_UNQUOTED([UUCP_LOCK_DIR], ["$UUCP_LOCK_DIR"],
[Directory holding UUCP locks])
AC_ARG_WITH(flock-locking,
[AS_HELP_STRING([--with-flock-locking], [Enable flock-style on serial port locking with yes/no])],
flock_locking_flag="$withval")
case "$flock_locking_flag" in
yes)
USE_FLOCK_LOCKING=1
;;
no)
USE_FLOCK_LOCKING=0
;;
*)
USE_FLOCK_LOCKING=1
;;
esac
AC_DEFINE_UNQUOTED([USE_FLOCK_LOCKING], [$USE_FLOCK_LOCKING],
[Enable device locking])
AC_ARG_WITH(broken-pselect,
[AS_HELP_STRING([--with-broken-pselect], [pselect is not atomic, work around it])],
broken_pselect="$withval")
case "$broken_pselect" in
yes)
AC_DEFINE([BROKEN_PSELECT], [], [PSELECT call is not atomic])
;;
*)
;;
esac
AC_ARG_WITH(tcp-wrappers,
[AS_HELP_STRING([--with-tcp-wrappers], [Enable tcpwrappers support])],
tcp_wrappers="$withval",
tcp_wrappers="no")
if test "$tcp_wrappers" != "no"
then
AC_CHECK_HEADERS([tcpd.h])
AC_CHECK_LIB(wrap, request_init,
[HAVE_LIBWRAP=1; OSH_LIBS="-lwrap $OSH_LIBS"])
fi
AC_ARG_ENABLE([doc],
[AS_HELP_STRING([--disable=doc], [disable building and installing docs])],
[],
[enable_doc="yes"])
AM_CONDITIONAL([INSTALL_DOC], [test "x$enable_doc" != "xno"])
AX_HAVE_EPOLL_PWAIT(
[AX_CONFIG_FEATURE_ENABLE(epoll_pwait)],
[AX_CONFIG_FEATURE_DISABLE(epoll_pwait)])
AX_CONFIG_FEATURE(
[epoll_pwait], [This platform supports epoll(7) with epoll_pwait(2)],
[HAVE_EPOLL_PWAIT], [This platform supports epoll(7) with epoll_pwait(2).])
AC_CHECK_FUNCS(kevent)
if test "x$system_type" = "xunix"; then
use_pthreads=yes
else
use_pthreads=no
fi
use_pthreads_set=false
AC_ARG_WITH(pthreads,
[AS_HELP_STRING([--with-pthreads=yes|no], [Use pthreads or not])],
use_pthreads_set=true
if test "x$withval" = "xyes"; then
use_pthreads=yes
elif test "x$withval" = "xno"; then
use_pthreads=no
else
AC_MSG_FAILURE([Unknown value for --with-pthreads. Use yes or no])
fi,
)
if test "x$use_pthreads" != "xno"; then
AX_PTHREAD(
[OSH_LIBS="$OSH_LIBS $PTHREAD_LIBS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
AC_DEFINE([USE_PTHREADS], [], [Enable multithreaded support])],
[if $use_pthreads_set; then
AC_MSG_FAILURE([--with-pthreads was given, but no working pthread library was found])
fi
use_pthreads=no])
fi
if test "x$system_type" = "xunix"; then
tryglib=yes
trytcl=yes
else
tryglib=no
trytcl=no
fi
AC_ARG_WITH(cplusplus,
[AS_HELP_STRING([--with-cplusplus=yes|no],
[Enable or disable C++ support.])],
cplusplus="$withval",
[if test -z "$CXX"; then
cplusplus=no
else
cplusplus=yes
fi]
)
HAVE_CXX11=0
CPLUSPLUS_DIR=
if test "$cplusplus" = "yes"; then
AX_CXX_COMPILE_STDCXX(11, [], [optional])
if test "$HAVE_CXX11" = 1; then
CPLUSPLUS_DIR="c++"
else
AC_MSG_RESULT([C++ version $cplusplusver is too old, need at least 201102, disabling c++])
fi
fi
AC_SUBST(CPLUSPLUS_DIR)
# Find pkg-config
pkgprog=
AC_PATH_PROG(pkgprog, pkg-config)
AC_ARG_WITH(glib,
[AS_HELP_STRING([--with-glib=yes|no], [Look for glib.])],
if test "x$withval" = "xyes"; then
if test "x$tryglib" = "xno"; then
AC_MSG_FAILURE([glib only support on Unix systems for now])
fi
elif test "x$withval" = "xno"; then
tryglib=no
fi,
)
glibcflags=
AC_ARG_WITH(glibcflags,
[AS_HELP_STRING([--with-glibcflags=flags],
[Set the flags to compile with glib.])],
glibcflags="$withval",
)
gliblibs=
AC_ARG_WITH(gliblibs,
[AS_HELP_STRING([--with-gliblibs=libs],
[Set the libraries to link with glib.])],
gliblibs="$withval",
)
# Handle GLIB support
haveglib=no
if test "x$glibcflags" = "x" -o "x$gliblibs" = "x"; then
glibprog=
if test "x$tryglib" != "xno"; then
if test "x$pkgprog" != "x"; then
glibprog=$pkgprog
fi
fi
GLIB_CFLAGS=
GLIB_LIBS=
if test "x$glibprog" != "x"; then
GLIB_CFLAGS=`$glibprog --cflags gthread-2.0 2>/dev/null`
if test $? = 0; then
haveglib=yes
GLIB_LIBS=`$glibprog --libs gthread-2.0 2>/dev/null`
fi
fi
else
haveglib=yes
GLIB_CFLAGS="$glibcflags"
GLIB_LIBS="$gliblibs"
fi
echo "checking for glib... $haveglib"
AM_CONDITIONAL([HAVE_GLIB], [test "x$haveglib" = "xyes"])
if test "x$haveglib" = "xyes"; then
AC_DEFINE([HAVE_GLIB], [], [Have GLIB libraries])
GLIB_LIB='$(top_builddir)/glib/libgensioglib.la'
GLIB_DIR=glib
else
GLIB_LIB=
GLIB_DIR=
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_LIB)
AC_SUBST(GLIB_DIR)
AC_ARG_WITH(tcl,
[ --with-tcl=yes|no Look for tcl.],
if test "x$withval" = "xyes"; then
trytcl=yes
elif test "x$withval" = "xno"; then
trytcl=no
fi,
)
tclcflags=
AC_ARG_WITH(tclcflags,
[ --with-tclcflags=flags Set the flags to compile with tcl.],
tclcflags="$withval",
)
tcllibs=
AC_ARG_WITH(tcllibs,
[ --with-tcllibs=libs Set the libraries to link with tcl.],
tcllibs="$withval",
)
# Handle TCL support
TCL_LIBS=
TCL_CFLAGS=
havetcl=no
if test "x$trytcl" != "xno"; then
FOUND_TCL_HEADER=no
ver=`echo 'puts \$tcl_version' | tclsh`
if test "x$tclcflags" = "x"; then
AC_CHECK_HEADER(tcl/tcl.h, FOUND_TCL_HEADER=yes; )
if test "x$FOUND_TCL_HEADER" != "xyes"; then
AC_CHECK_HEADER(tcl.h, FOUND_TCL_HEADER=yes; )
if test "x$FOUND_TCL_HEADER" = "xyes"; then
TCL_CFLAGS=""
fi
else
tclcflags="-I /usr/include/tcl"
TCL_CFLAGS="$tclcflags"
fi
else
TCL_CFLAGS="$tclcflags"
FOUND_TCL_HEADER=yes
fi
if test "x$tcllibs" = "x"; then
if test "x$FOUND_TCL_HEADER" = "xyes"; then
AC_CHECK_LIB(tcl, Tcl_CancelIdleCall, TCL_LIBS=-ltcl)
if test "x$TCL_LIBS" = "x"; then
AC_CHECK_LIB(tcl$ver, Tcl_DoOneEvent, TCL_LIBS=-ltcl$ver)
fi
fi
else
TCL_LIBS="$tcllibs"
fi
if test "x$FOUND_TCL_HEADER" = "xyes" -a "x$TCL_LIBS" != "x"; then
havetcl=yes
fi
fi
if test "x$havetcl" = "xyes"; then
AC_DEFINE([HAVE_TCL], [], [Have TCL libraries])
TCL_LIB='$(top_builddir)/tcl/libgensiotcl.la'
TCL_DIR=tcl
else
TCL_LIB=
TCL_DIR=
fi
AC_SUBST(TCL_CFLAGS)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_LIB)
AC_SUBST(TCL_DIR)
AC_CHECK_FUNCS(regexec)
AC_CHECK_FUNCS(fnmatch)
have_pcre_posix=no
REGEX_LIB=
if test "x$ac_cv_func_regexec" != xyes; then
AC_CHECK_LIB(pcreposix, regexec, have_pcre_posix=yes)
if test $have_pcre_posix = yes; then
REGEX_LIB=-lpcreposix
AC_DEFINE([HAVE_PCRE_POSIX], [], [Have PCRE POSIX regex])
ac_cv_func_regexec=pcre
fi
fi
AC_SUBST(REGEX_LIB)
AC_CHECK_FUNCS(fnmatch)
# If not creating shared libraries, build everything in.
if test "$enable_shared" = "no"; then
default_all=yes
else
default_all=dynamic
fi
AC_ARG_WITH(all-gensios,
[AS_HELP_STRING([--with-all-gensios=yes|dynamic|no],
[Default setting for all gensios])],
if test "x$withval" = "xyes"; then
default_all=yes
elif test "x$withval" = "xdynamic"; then
default_all=dynamic
elif test "x$withval" = "xno"; then
default_all=no
fi,
)
BUILTIN_GENSIOS=""
DYNAMIC_GENSIOS=""
net=$default_all
AC_ARG_WITH(net,
[AS_HELP_STRING([--with-net=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
net=yes
elif test "x$withval" = "xdynamic"; then
net=dynamic
elif test "x$withval" = "xno"; then
net=no
fi,
)
BUILTIN_NET=0
DYNAMIC_NET=
case $net in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS net"
BUILTIN_NET=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS net"
DYNAMIC_NET=libgensio_net.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_NET], [test ${BUILTIN_NET} = 1])
AC_SUBST(DYNAMIC_NET)
dgram=$default_all
AC_ARG_WITH(dgram,
[AS_HELP_STRING([--with-dgram=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
dgram=yes
elif test "x$withval" = "xdynamic"; then
dgram=dynamic
elif test "x$withval" = "xno"; then
dgram=no
fi,
)
BUILTIN_DGRAM=0
DYNAMIC_DGRAM=
case $dgram in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS dgram"
BUILTIN_DGRAM=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS dgram"
DYNAMIC_DGRAM=libgensio_dgram.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_DGRAM], [test ${BUILTIN_DGRAM} = 1])
AC_SUBST(DYNAMIC_DGRAM)
trysctp=yes
AC_ARG_WITH(sctp,
[AS_HELP_STRING([--with-sctp=yes|no], [Look for sctp])],
if test "x$withval" = "xyes"; then
trysctp=yes
elif test "x$withval" = "xno"; then
trysctp=no
fi,
)
HAVE_LIBSCTP=0
if test "x$trysctp" != "xno"; then
AC_CHECK_LIB(sctp, sctp_bindx, [HAVE_LIBSCTP=1])
fi
AC_DEFINE_UNQUOTED([HAVE_LIBSCTP], [$HAVE_LIBSCTP],
[Set to 1 to enable SCTP, 0 to disable])
AC_SUBST(HAVE_LIBSCTP)
HAVE_SCTP_SENDV=0
if test "$HAVE_LIBSCTP" = "1"; then
AC_CHECK_LIB(sctp, sctp_sendv, [HAVE_SCTP_SENDV=1])
fi
AC_DEFINE_UNQUOTED([HAVE_SCTP_SENDV], [$HAVE_SCTP_SENDV],
[Set to 1 if sctp_sendv() is available, 0 if not])
if test "$HAVE_LIBSCTP" = "1"; then
sctp=$default_all
OSH_LIBS="-lsctp $OSH_LIBS"
else
sctp=no
fi
AC_ARG_WITH(sctp,
[AS_HELP_STRING([--with-sctp=yes|dynamic|no], [Enable sctp gensio])],
if test "x$withval" = "xyes"; then
sctp=yes
elif test "x$withval" = "xdynamic"; then
sctp=dynamic
elif test "x$withval" = "xno"; then
sctp=no
fi,
)
BUILTIN_SCTP=0
DYNAMIC_SCTP=
case $sctp in
yes)
if test $HAVE_LIBSCTP = 0; then
AC_MSG_ERROR("sctp enabled but libsctp not found")
fi
BUILTIN_GENSIOS="$BUILTIN_GENSIOS sctp"
BUILTIN_SCTP=1
;;
dynamic)
if test $HAVE_LIBSCTP = 0; then
AC_MSG_ERROR("sctp enabled but libsctp not found")
fi
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS sctp"
DYNAMIC_SCTP=libgensio_sctp.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_SCTP], [test ${BUILTIN_SCTP} = 1])
AC_SUBST(DYNAMIC_SCTP)
stdio=$default_all
AC_ARG_WITH(stdio,
[AS_HELP_STRING([--with-stdio=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
stdio=yes
elif test "x$withval" = "xdynamic"; then
stdio=dynamic
elif test "x$withval" = "xno"; then
stdio=no
fi,
)
BUILTIN_STDIO=0
DYNAMIC_STDIO=
case $stdio in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS stdio"
BUILTIN_STDIO=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS stdio"
DYNAMIC_STDIO=libgensio_stdio.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_STDIO], [test ${BUILTIN_STDIO} = 1])
AC_SUBST(DYNAMIC_STDIO)
pty=$default_all
AC_ARG_WITH(pty,
[AS_HELP_STRING([--with-pty=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
pty=yes
elif test "x$withval" = "xdynamic"; then
pty=dynamic
elif test "x$withval" = "xno"; then
pty=no
fi,
)
BUILTIN_PTY=0
DYNAMIC_PTY=
case $pty in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS pty"
BUILTIN_PTY=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS pty"
DYNAMIC_PTY=libgensio_pty.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_PTY], [test ${BUILTIN_PTY} = 1])
AC_SUBST(DYNAMIC_PTY)
dummy=$default_all
AC_ARG_WITH(dummy,
[AS_HELP_STRING([--with-dummy=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
dummy=yes
elif test "x$withval" = "xdynamic"; then
dummy=dynamic
elif test "x$withval" = "xno"; then
dummy=no
fi,
)
BUILTIN_DUMMY=0
DYNAMIC_DUMMY=
case $dummy in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS dummy"
BUILTIN_DUMMY=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS dummy"
DYNAMIC_DUMMY=libgensio_dummy.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_DUMMY], [test ${BUILTIN_DUMMY} = 1])
AC_SUBST(DYNAMIC_DUMMY)
conacc=$default_all
AC_ARG_WITH(conacc,
[AS_HELP_STRING([--with-conacc=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
conacc=yes
elif test "x$withval" = "xdynamic"; then
conacc=dynamic
elif test "x$withval" = "xno"; then
conacc=no
fi,
)
BUILTIN_CONACC=0
DYNAMIC_CONACC=
case $conacc in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS conacc"
BUILTIN_CONACC=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS conacc"
DYNAMIC_CONACC=libgensio_conacc.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_CONACC], [test ${BUILTIN_CONACC} = 1])
AC_SUBST(DYNAMIC_CONACC)
serialdev=$default_all
AC_ARG_WITH(serialdev,
[AS_HELP_STRING([--with-serialdev=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
serialdev=yes
elif test "x$withval" = "xdynamic"; then
serialdev=dynamic
elif test "x$withval" = "xno"; then
serialdev=no
fi,
)
BUILTIN_SERIALDEV=0
DYNAMIC_SERIALDEV=
case $serialdev in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS serialdev"
BUILTIN_SERIALDEV=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS serialdev"
DYNAMIC_SERIALDEV=libgensio_serialdev.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_SERIALDEV], [test ${BUILTIN_SERIALDEV} = 1])
AC_SUBST(DYNAMIC_SERIALDEV)
echo=$default_all
AC_ARG_WITH(echo,
[AS_HELP_STRING([--with-echo=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
echo=yes
elif test "x$withval" = "xdynamic"; then
echo=dynamic
elif test "x$withval" = "xno"; then
echo=no
fi,
)
BUILTIN_ECHO=0
DYNAMIC_ECHO=
case $echo in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS echo"
BUILTIN_ECHO=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS echo"
DYNAMIC_ECHO=libgensio_echo.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_ECHO], [test ${BUILTIN_ECHO} = 1])
AC_SUBST(DYNAMIC_ECHO)
file=$default_all
AC_ARG_WITH(file,
[AS_HELP_STRING([--with-file=yes|dynamic|no], [Enable tcp/unix gensio])],
if test "x$withval" = "xyes"; then
file=yes
elif test "x$withval" = "xdynamic"; then
file=dynamic
elif test "x$withval" = "xno"; then
file=no
fi,
)
BUILTIN_FILE=0
DYNAMIC_FILE=
case $file in
yes)
BUILTIN_GENSIOS="$BUILTIN_GENSIOS file"
BUILTIN_FILE=1
;;
dynamic)
DYNAMIC_GENSIOS="$DYNAMIC_GENSIOS file"
DYNAMIC_FILE=libgensio_file.la
;;
no)
;;
esac
AM_CONDITIONAL([BUILTIN_FILE], [test ${BUILTIN_FILE} = 1])
AC_SUBST(DYNAMIC_FILE)