-
Notifications
You must be signed in to change notification settings - Fork 5
/
configure.ac
1804 lines (1612 loc) · 45.1 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT
# Making releases:
# VERSION_PATCHLEVEL += 1;
# OWFS_INTERFACE_AGE += 1;
# OWFS_BINARY_AGE += 1;
# if any functions have been added, set OWFS_INTERFACE_AGE to 0.
# if backwards compatibility has been broken,
# set OWFS_BINARY_AGE _and_ OWFS_INTERFACE_AGE to 0.
# (In our case it's better to always keep AGE to 0, since nobody else will use our library)
VERSION_MAJOR=3
VERSION_MINOR=1
VERSION_PATCHLEVEL=0
OWFS_INTERFACE_AGE=0
OWFS_BINARY_AGE=0
AC_SUBST(VERSION_MAJOR)
AC_SUBST(VERSION_MINOR)
AC_SUBST(VERSION_PATCHLEVEL)
AC_SUBST(OWFS_INTERFACE_AGE)
AC_SUBST(OWFS_BINARY_AGE)
LT_CURRENT=`expr $VERSION_PATCHLEVEL - $OWFS_INTERFACE_AGE`
LT_REVISION=$OWFS_INTERFACE_AGE
LT_AGE=`expr $OWFS_BINARY_AGE - $OWFS_INTERFACE_AGE`
AC_SUBST(LT_CURRENT)dnl
AC_SUBST(LT_REVISION)dnl
AC_SUBST(LT_AGE)dnl
LT_RELEASE=$VERSION_MAJOR.$VERSION_MINOR
AC_SUBST(LT_RELEASE)dnl
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}p${VERSION_PATCHLEVEL}"
AC_SUBST(VERSION)dnl
PACKAGE="owfs"
AC_SUBST(PACKAGE)dnl
AC_MSG_RESULT(Configuring ${PACKAGE}-${VERSION})
AC_CONFIG_AUX_DIR(src/scripts/install)dnl
AC_CONFIG_MACRO_DIR([src/scripts/m4])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(${PACKAGE}, ${VERSION})dnl
# Process config.h.in
AH_TOP([
#ifndef OWCONFIG_H
#define OWCONFIG_H
])
AH_BOTTOM([#endif])
AM_CONFIG_HEADER(src/include/config.h)
AC_PREREQ(2.57)dnl
AC_PREFIX_DEFAULT(/opt/owfs)dnl
AC_PATH_PROG(ECHO,echo,,$PATH)dnl
AC_PATH_PROG(TEST,test,,$PATH)dnl
AC_PATH_PROG(RM,rm,,$PATH)dnl
AC_PATH_PROG(RPM,rpm,,$PATH)dnl
AC_PATH_PROG(RPMBUILD,rpmbuild,,$PATH)dnl
AC_PATH_PROG([SWIG],[swig],,$PATH)dnl
AC_PATH_PROG([SOELIM],[soelim])
AM_CONDITIONAL([SOELIM], [test -n "${SOELIM}"])
# Check for additional programs
# We don't need c++ right now.
#AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_LIBTOOL_WIN32_DLL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_AWK
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
# Supposedly this helps OS X compiling
AC_DEFINE(_DARWIN_C_SOURCE, 1, [Define on Darwin to activate all library features])
HAVE_DEBIAN="false"
AC_MSG_CHECKING([if debian-system is used])
AC_ARG_ENABLE(debian,
[ --enable-debian Enable debian-system (default false)],
[
AC_MSG_RESULT([$enableval])
if test "$enableval" = "yes" ; then
HAVE_DEBIAN="true"
fi
],
[
AC_MSG_RESULT([no (default)])
])
AC_SUBST(HAVE_DEBIAN)
AM_CONDITIONAL(HAVE_DEBIAN, test "${HAVE_DEBIAN}" = "true")
HAVE_DARWIN="false"
HAVE_FREEBSD="false"
HAVE_CYGWIN="false"
AC_MSG_CHECKING([for special host])
case "$host" in
*-*-cygwin*)
HAVE_CYGWIN="true"
CFLAGS="$CFLAGS -mwin32 -g"
AC_MSG_RESULT([Cygwin])
;;
*-darwin*)
HAVE_DARWIN="true"
AC_MSG_RESULT([Darwin])
;;
*-freebsd*)
HAVE_FREEBSD="true"
AC_MSG_RESULT([FreeBSD])
;;
*)
AC_MSG_RESULT([Other host])
;;
esac
AC_SUBST(HAVE_DARWIN)
AM_CONDITIONAL(HAVE_DARWIN, test "${HAVE_DARWIN}" = "true")
AC_SUBST(HAVE_CYGWIN)
AM_CONDITIONAL(HAVE_CYGWIN, test "${HAVE_CYGWIN}" = "true")
AC_SUBST(HAVE_FREEBSD)
AM_CONDITIONAL(HAVE_FREEBSD, test "${HAVE_FREEBSD}" = "true")
# launchd using the new launch_activate_socket
AC_CHECK_FUNCS(launch_activate_socket)
# AC_CHECK_HEADERS(launch.h)
PIC_FLAGS=""
if test "$lt_prog_compiler_pic_works" = yes; then
PIC_FLAGS="$lt_prog_compiler_pic"
fi
AC_SUBST(PIC_FLAGS)
# Make sure tclConfig.sh is found under /usr/lib64/
# Should perhaps support cross-compiling to other cpu-type too?
LIBPOSTFIX=
case "${host_os}" in
*linux* )
case "${host_cpu}" in
powerpc64 | s390x | x86_64 )
LIBPOSTFIX="64"
CFLAGS="$CFLAGS -m64"
;;
esac
;;
esac
AC_SUBST(LIBPOSTFIX)
if test "$cross_compiling" != yes; then
OW_CHECK_NESTED_FUNCTIONS
fi
OWFSROOT="`pwd`"
AC_SUBST(OWFSROOT)
m4_include([src/scripts/m4/acx_pthread.m4])
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([asm/types.h arpa/inet.h sys/ioctl.h sys/mkdev.h sys/socket.h sys/time.h sys/times.h sys/types.h sys/uio.h feature_tests.h fcntl.h netinet/in.h stdlib.h string.h strings.h sys/file.h syslog.h termios.h unistd.h limits.h stdint.h features.h getopt.h resolv.h semaphore.h])
AC_CHECK_HEADERS([linux/limits.h linux/types.h netdb.h dlfcn.h])
AC_CHECK_HEADERS(sys/event.h sys/inotify.h)
# Test if debugging out enabled
ENABLE_DEBUG="true"
AC_MSG_CHECKING([if debug-output is enabled])
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug-output (default true)],
[
AC_MSG_RESULT([$enableval])
if ! test "$enableval" = "yes" ; then
ENABLE_DEBUG="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_DEBUG)
AM_CONDITIONAL(ENABLE_DEBUG, test "${ENABLE_DEBUG}" = "true")
# Test if mutex-debugging is enabled. Should not be enabled for smaller embedded systems
ENABLE_MUTEX_DEBUG="true"
AC_MSG_CHECKING([if mutexdebug is enabled])
AC_ARG_ENABLE(mutexdebug,
[ --enable-mutexdebug Enable mutexdebug-output (default true)],
[
AC_MSG_RESULT([$enableval])
if ! test "$enableval" = "yes" ; then
ENABLE_MUTEX_DEBUG="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_MUTEX_DEBUG)
AM_CONDITIONAL(ENABLE_MUTEX_DEBUG, test "${ENABLE_MUTEX_DEBUG}" = "true")
# Test if OWSHELL should be supported
ENABLE_OWSHELL="true"
AC_MSG_CHECKING([if OWSHELL support is enabled])
AC_ARG_ENABLE(owshell,
[ --enable-owshell Enable owshell support (default true)],
[
AC_MSG_RESULT([$enableval])
if ! test "$enableval" = "yes" ; then
ENABLE_OWSHELL="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWSHELL)
AM_CONDITIONAL(ENABLE_OWSHELL, test "${ENABLE_OWSHELL}" = "true")
# Test if OWLIB should be supported
ENABLE_OWLIB="true"
AC_MSG_CHECKING([if OWLIB support is enabled])
AC_ARG_ENABLE(owlib,
[ --enable-owlib Enable owlib support (default true)],
[
AC_MSG_RESULT([$enableval])
if ! test "$enableval" = "yes" ; then
ENABLE_OWLIB="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWLIB)
AM_CONDITIONAL(ENABLE_OWLIB, test "${ENABLE_OWLIB}" = "true")
# Test if OWNETLIB should be supported
ENABLE_OWNETLIB="true"
AC_MSG_CHECKING([if OWNETLIB support is enabled])
AC_ARG_ENABLE(ownetlib,
[ --enable-ownetlib Enable ownetlib support (default true)],
[
AC_MSG_RESULT([$enableval])
if ! test "$enableval" = "yes" ; then
ENABLE_OWNETLIB="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWNETLIB)
AM_CONDITIONAL(ENABLE_OWNETLIB, test "${ENABLE_OWNETLIB}" = "true")
# Check for threading
ACX_PTHREAD
if test "$acx_pthread_ok" = "yes"; then
#CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# can't set pthread flags for all compilations, since owshell doesn't need it.
if test "$cross_compiling" = yes; then
# We need to link libow.so with -lpthread on some cross-platforms
# since owtcl.so doesn't work otherwise. -pthread is not enough
if test x"$PTHREAD_LIBS" = x -a "x$PTHREAD_CFLAGS" = "x-pthread"; then
AC_MSG_RESULT([add -lpthread to PTHREAD_LIBS])
PTHREAD_LIBS="-lpthread"
fi
fi
ENABLE_MT="true"
else
ENABLE_MT="false"
PTHREAD_CFLAGS=""
PTHREAD_LIBS=""
PTHREAD_CC=""
fi
# Check for i2c support
ENABLE_I2C="true"
AC_MSG_CHECKING([if i2c(DS2482-x00) is enabled])
AC_ARG_ENABLE(i2c,
[ --enable-i2c Enable i2c (DS2482-x00) support (default true)],
[
AC_MSG_RESULT([$enableval])
if ! test "$enableval" = "yes" ; then
ENABLE_I2C="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_I2C)
AM_CONDITIONAL(ENABLE_I2C, test "${ENABLE_I2C}" = "true")
# Check for W1 (linux kernel module)
ENABLE_W1="true"
AC_MSG_CHECKING([if W1 is enabled])
AC_ARG_ENABLE(w1,
[ --enable-w1 Enable w1 support (default true)],
[
AC_MSG_RESULT([$enableval])
if ! test "$enableval" = "yes" ; then
ENABLE_W1="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_W1)
AM_CONDITIONAL(ENABLE_W1, test "${ENABLE_W1}" = "true")
# Check if the modules are enabled
#Check owhttpd
ENABLE_OWHTTPD="true"
AC_MSG_CHECKING(if owhttpd is enabled)
AC_ARG_ENABLE(owhttpd,
[ --enable-owhttpd Enable owhttpd module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWHTTPD="false"
else
ENABLE_OWLIB="true"
fi
],
[
ENABLE_OWLIB="true"
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWHTTPD)
AM_CONDITIONAL(ENABLE_OWHTTPD, test "${ENABLE_OWHTTPD}" = "true")
#Check owftpd
ENABLE_OWFTPD="true"
AC_MSG_CHECKING(if owftpd is enabled)
AC_ARG_ENABLE(owftpd,
[ --enable-owftpd Enable owftpd module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWFTPD="false"
else
# if test ! "${ENABLE_MT}" = "true" ; then
# AC_MSG_ERROR([owftpd needs multithreading])
# fi
ENABLE_OWLIB="true"
fi
],
[
if test "${ENABLE_MT}" = "true" ; then
ENABLE_OWLIB="true"
AC_MSG_RESULT([yes (default)])
else
ENABLE_OWFTPD="false"
AC_MSG_RESULT([no (multithreading needed)])
fi
])
AC_SUBST(ENABLE_OWFTPD)
AM_CONDITIONAL(ENABLE_OWFTPD, test "${ENABLE_OWFTPD}" = "true")
#Check owserver
AC_MSG_CHECKING(if owserver is enabled)
ENABLE_OWSERVER="true"
AC_ARG_ENABLE(owserver,
[ --enable-owserver Enable owserver module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWSERVER="false"
else
ENABLE_OWLIB="true"
fi
],
[
ENABLE_OWLIB="true"
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWSERVER)
AM_CONDITIONAL(ENABLE_OWSERVER, test "${ENABLE_OWSERVER}" = "true")
#Check owexternal
AC_MSG_CHECKING(if owexternal is enabled)
ENABLE_OWEXTERNAL="true"
AC_ARG_ENABLE(owexternal,
[ --enable-owexternal Enable owexternal module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWEXTERNAL="false"
else
ENABLE_OWLIB="true"
fi
],
[
ENABLE_OWLIB="true"
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWEXTERNAL)
AM_CONDITIONAL(ENABLE_OWEXTERNAL, test "${ENABLE_OWEXTERNAL}" = "true")
#Check ownet
ENABLE_OWNET="true"
AC_MSG_CHECKING(if ownet is enabled)
AC_ARG_ENABLE(ownet,
[ --enable-ownet Enable ownet module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWNET="false"
else
ENABLE_OWLIB="true"
fi
],
[
ENABLE_OWLIB="true"
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWNET)
AM_CONDITIONAL(ENABLE_OWNET, test "${ENABLE_OWNET}" = "true")
#Check owtap
ENABLE_OWTAP="true"
AC_MSG_CHECKING(if owtap is enabled)
AC_ARG_ENABLE(owtap,
[ --enable-owtap Enable owtap module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWTAP="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWTAP)
AM_CONDITIONAL(ENABLE_OWTAP, test "${ENABLE_OWTAP}" = "true")
#Check owmalloc (special memory allocation routines)
ENABLE_OWMALLOC="false"
AC_MSG_CHECKING(if owmalloc is enabled)
AC_ARG_ENABLE(owmalloc,
[ --enable-owmalloc Enable owmalloc checking (default false)],
[
AC_MSG_RESULT([$enableval])
if test "$enableval" = "yes" ; then
ENABLE_OWMALLOC="true"
fi
],
[
AC_MSG_RESULT([no (default)])
])
AC_SUBST(ENABLE_OWMALLOC)
AM_CONDITIONAL(ENABLE_OWMALLOC, test "${ENABLE_OWMALLOC}" = "true")
#Check owmon
AC_MSG_CHECKING(if owmon is enabled)
ENABLE_OWMON="true"
AC_ARG_ENABLE(owmon,
[ --enable-owmon Enable owmon module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWMON="false"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWMON)
AM_CONDITIONAL(ENABLE_OWMON, test "${ENABLE_OWMON}" = "true")
#Check owcapi
AC_MSG_CHECKING(if owcapi is enabled)
ENABLE_OWCAPI="true"
AC_ARG_ENABLE(owcapi,
[ --enable-owcapi Enable owcapi module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWCAPI="false"
else
ENABLE_OWLIB="true"
fi
],
[
ENABLE_OWLIB="true"
AC_MSG_RESULT([yes (default)])
])
AC_SUBST(ENABLE_OWCAPI)
AM_CONDITIONAL(ENABLE_OWCAPI, test "${ENABLE_OWCAPI}" = "true")
#Check swig
AC_MSG_CHECKING(if swig is enabled)
if test -z "$SWIG" ; then
ENABLE_SWIG="false"
else
ENABLE_SWIG="auto"
fi
AC_ARG_ENABLE(swig,
[ --enable-swig Enable swig (default auto)],
[
if test "$enableval" = "no"; then
ENABLE_SWIG="false"
SWIG=""
AC_MSG_RESULT([no])
else
if test -z "$SWIG"; then
AC_MSG_ERROR([Swig is not found and could not be enabled])
fi
ENABLE_OWLIB="true"
ENABLE_SWIG="true"
AC_MSG_RESULT([yes])
fi
],
[
AC_MSG_RESULT([auto (default)])
])
if test "${HAVE_CYGWIN}" = "true"; then
if test ! "$ENABLE_SWIG" = "true"; then
ENABLE_SWIG="false"
SWIG=""
AC_MSG_RESULT([(Disable swig by default in Cygwin)])
fi
else
if test "$ENABLE_SWIG" = "auto"; then
ENABLE_SWIG="true"
fi
fi
AC_SUBST(ENABLE_SWIG)
AM_CONDITIONAL(ENABLE_SWIG, test "${ENABLE_SWIG}" = "true")
#Check owperl
AC_MSG_CHECKING(if owperl is enabled)
ENABLE_OWPERL="true"
AC_ARG_ENABLE(owperl,
[ --enable-owperl Enable owperl module (default true)],
[
AC_MSG_RESULT([$enableval])
if test ! "$enableval" = "yes" ; then
ENABLE_OWPERL="false"
else
if test -z "$SWIG" ; then
AC_MSG_WARN([Cannot find swig program. Look for it at http://www.swig.org or use CPAN])
AC_MSG_WARN([OWPERL is disabled because swig is not found])
ENABLE_OWPERL="false"
fi
fi
],
[
if test -z "$SWIG" ; then
AC_MSG_RESULT([no (swig disabled)])
ENABLE_OWPERL="false"
else
AC_MSG_RESULT([yes (default)])
fi
])
PERL=""
if test "${ENABLE_OWPERL}" = "true"; then
m4_include(module/swig/perl5/perl5.m4)
AC_MSG_RESULT(Looking for location of Perl executable)
SC_PATH_PERL5
AC_SUBST(PERL5EXT)
AC_SUBST(PERL5DYNAMICLINKING)
AC_SUBST(PERL5LIB)
AC_SUBST(PERL5DIR)
AC_SUBST(PERL5NAME)
AC_SUBST(PERL5CCFLAGS)
if test -z "${PERL}" ; then
AC_MSG_WARN([Cannot find perl binary.])
AC_MSG_WARN([OWPERL is disabled because perl binary is not found])
ENABLE_OWPERL="false"
else
if test -z "${PERL5NAME}" ; then
AC_MSG_WARN([Cannot find perl library. Install perl-devel package.])
AC_MSG_WARN([OWPERL is disabled because perl library is not found])
ENABLE_OWPERL="false"
fi
fi
fi
AC_SUBST(PERL)
AC_SUBST(ENABLE_OWPERL)
AM_CONDITIONAL(ENABLE_OWPERL, test "${ENABLE_OWPERL}" = "true")
if test -z "$PERL" ; then
ENABLE_PERL="false"
else
ENABLE_PERL="true"
fi
AC_SUBST(ENABLE_PERL)
AM_CONDITIONAL(ENABLE_PERL, test "${ENABLE_PERL}" = "true")
#Check owphp
AC_MSG_CHECKING(if owphp is enabled)
ENABLE_OWPHP="true"
AC_ARG_ENABLE(owphp,
[ --enable-owphp Enable owphp module (default true)],
[
AC_MSG_RESULT([$enableval])
if test "$enableval" = "no" ; then
ENABLE_OWPHP="false"
fi
if test "$enableval" = "yes" ; then
ENABLE_OWPHP="true"
fi
if test -z "$SWIG" ; then
AC_MSG_WARN([Cannot find swig program. Look for it at http://www.swig.org or use CPAN])
AC_MSG_WARN([OWPHP is disabled because swig is not found])
ENABLE_OWPHP="false"
fi
],
[
if test -z "$SWIG" ; then
AC_MSG_RESULT([no (swig disabled)])
ENABLE_OWPHP="false"
else
AC_MSG_RESULT([yes (default)])
fi
])
PHP=""
if test "${ENABLE_OWPHP}" = "true" ; then
m4_include(module/swig/php/php.m4)
AC_MSG_RESULT(Looking for location of Php executable)
SC_PATH_PHP
AC_SUBST(PHPCONFIG)
AC_SUBST(PHPINC)
AC_SUBST(PHPEXT)
AC_SUBST(PHPLIBDIR)
if test -z "${PHP}" ; then
AC_MSG_WARN([Cannot find php binary. Install php or php5 package])
AC_MSG_WARN([OWPHP is disabled because php binary is not found])
ENABLE_OWPHP="false"
else
if test -z "${PHPCONFIG}" ; then
AC_MSG_WARN([Cannot find php-config binary. Install php-devel or php5-dev package])
AC_MSG_WARN([include and library paths will be guessed])
fi
if test -z "${PHPINC}" ; then
AC_MSG_WARN([Cannot find php include-file. Install php-devel or php5-dev package])
AC_MSG_WARN([OWPHP is disabled because php include-file is not found])
ENABLE_OWPHP="false"
else
if test -z "${PHPLIBDIR}" ; then
AC_MSG_WARN([Cannot find php extension-dir. Install php-devel or php5-dev package])
AC_MSG_WARN([OWPHP is disabled because php extension-dir is not found])
ENABLE_OWPHP="false"
fi
fi
fi
fi
AC_SUBST(PHP)
AC_SUBST(ENABLE_OWPHP)
AM_CONDITIONAL(ENABLE_OWPHP, test "${ENABLE_OWPHP}" = "true")
if test -z "$PHP" ; then
ENABLE_PHP="false"
else
ENABLE_PHP="true"
fi
AC_SUBST(ENABLE_PHP)
AM_CONDITIONAL(ENABLE_PHP, test "${ENABLE_PHP}" = "true")
#Check owpython
AC_MSG_CHECKING(if owpython is enabled)
ENABLE_OWPYTHON="true"
AC_ARG_ENABLE(owpython,
[ --enable-owpython Enable owpython module (default true)],
[
AC_MSG_RESULT([$enableval])
if test "$enableval" = "no" ; then
ENABLE_OWPYTHON="false"
fi
if test "$enableval" = "yes" ; then
ENABLE_OWPYTHON="true"
if test -z "$SWIG" ; then
AC_MSG_WARN([Cannot find swig program. Look for it at http://www.swig.org or use CPAN])
AC_MSG_WARN([OWPYTHON is disabled because swig is not found])
ENABLE_OWPYTHON="false"
fi
fi
],
[
if test -z "$SWIG" ; then
AC_MSG_RESULT([no (swig disabled)])
ENABLE_OWPYTHON="false"
else
AC_MSG_RESULT([yes (default)])
fi
])
PYTHON=""
if test "${ENABLE_OWPYTHON}" = "true" ; then
m4_include(module/swig/python/python.m4)
AC_MSG_RESULT(Looking for location of Python executable)
SC_PATH_PYTHON
AC_SUBST(PYCFLAGS)
AC_SUBST(PYLDFLAGS)
AC_SUBST(PYLIB)
AC_SUBST(PYVERSION)
AC_SUBST(PYSITEDIR)
AC_SUBST(PYTHONDYNAMICLINKING)
if test -z "${PYTHON}" ; then
AC_MSG_WARN([Cannot find python binary. Install python package.])
AC_MSG_WARN([OWPYTHON is disabled because python binary is not found])
ENABLE_OWPYTHON="false"
else
if test -z "${PYLDFLAGS}" ; then
AC_MSG_WARN([Cannot find python library. Install python-devel package.])
AC_MSG_WARN([OWPYTHON is disabled because python library is not found])
ENABLE_OWPYTHON="false"
else
if test -z "${PYCFLAGS}" ; then
AC_MSG_WARN([Cannot find python include-file. Install python-devel package.])
AC_MSG_WARN([OWPYTHON is disabled because python include-file is not found])
ENABLE_OWPYTHON="false"
fi
fi
fi
fi
AC_SUBST(ENABLE_OWPYTHON)
AM_CONDITIONAL(ENABLE_OWPYTHON, test "${ENABLE_OWPYTHON}" = "true")
AC_SUBST(PYTHON)
if test -z "$PYTHON" ; then
ENABLE_PYTHON="false"
else
ENABLE_PYTHON="true"
fi
AC_SUBST(ENABLE_PYTHON)
AM_CONDITIONAL(ENABLE_PYTHON, test "${ENABLE_PYTHON}" = "true")
#Check owtcl
AC_MSG_CHECKING(if owtcl is enabled)
ENABLE_OWTCL="true"
AC_ARG_ENABLE(owtcl,
[ --enable-owtcl Enable owtcl module (default true)],
[
AC_MSG_RESULT([$enableval])
if test "$enableval" = "no" ; then
ENABLE_OWTCL="false"
fi
if test "$enableval" = "yes" ; then
ENABLE_OWTCL="true"
fi
],
[
AC_MSG_RESULT([yes (default)])
])
if test "${ENABLE_OWTCL}" = "true" ; then
m4_include(module/owtcl/tcl.m4)
AC_MSG_RESULT(Looking for tclConfig.sh)
SC_PATH_TCLCONFIG
if test -z "$TCL_BIN_DIR" -o ! -f "$TCL_BIN_DIR/tclConfig.sh" ; then
AC_MSG_WARN([OWTCL is disabled because tclConfig.sh is not found])
ENABLE_OWTCL="false"
else
SC_LOAD_TCLCONFIG
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_SHLIB_CFLAGS)
AC_SUBST(TCL_SHLIB_LD)
AC_SUBST(TCL_SHLIB_LD_LIBS)
AC_SUBST(TCL_SHLIB_SUFFIX)
AC_SUBST(TCL_VERSION)
AC_SUBST(TCL_PREFIX)
AC_SUBST(TCL_EXEC_PREFIX)
AC_SUBST(TCL_CFLAGS)
AC_SUBST(TCL_DEFS)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_LD_FLAGS)
AC_SUBST(TCL_COMPAT_OBJS)
AC_SUBST(TCL_LD_SEARCH_FLAGS)
AC_SUBST(TCL_SRC_DIR)
AC_SUBST(TCL_LIB_SPEC)
AC_SUBST(TCL_STUB_LIB_SPEC)
AC_SUBST(TCL_BUILD_LIB_SPEC)
AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
AC_SUBST(TCL_INCLUDE_SPEC)
AC_SUBST(TCL_PACKAGE_PATH)
# guess that tcl will install the files under the first path in
# TCL_PACKAGE_PATH. TCL_BIN_DIR is usually correct, but this
# might contain staging_dir prefix when cross-compiling.
OWTCL_INSTALL_PATH="`echo ${TCL_PACKAGE_PATH} | cut -d' ' -f1`"
case "${host_cpu}-${host_os}" in
*-darwin*)
OWTCL_INSTALL_PATH="`echo ${TCL_BIN_DIR} | cut -d' ' -f1`"
;;
*)
OWTCL_INSTALL_PATH="`echo ${TCL_PACKAGE_PATH} | cut -d' ' -f1`"
;;
esac
# Debian Hack: do not install in /usr/local/lib/tcltk
# OWTCL_INSTALL_PATH="/usr/lib/tcltk"
AC_SUBST(OWTCL_INSTALL_PATH)
fi
fi
AC_SUBST(ENABLE_OWTCL)
AM_CONDITIONAL(ENABLE_OWTCL, test "${ENABLE_OWTCL}" = "true")
AC_DEFUN([ACX_EXPAND], [
EXP_VAR=[$1]
FROM_VAR=[$2]
dnl first expand prefix and exec_prefix if necessary
prefix_save=$prefix
exec_prefix_save=$exec_prefix
dnl if no prefix given, then use /usr/local, the default prefix
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix
fi
dnl if no exec_prefix given, then use prefix
if test "x$exec_prefix" = "xNONE"; then
exec_prefix=$prefix
fi
full_var="$FROM_VAR"
dnl loop until it doesnt change anymore
while true; do
new_full_var="`eval echo $full_var`"
if test "x$new_full_var"="x$full_var"; then break; fi
full_var=$new_full_var
done
dnl clean up
full_var=$new_full_var
AC_SUBST([$1], "$full_var")
dnl restore prefix and exec_prefix
prefix=$prefix_save
exec_prefix=$exec_prefix_save
]) dnl ACX_EXPAND
ACX_EXPAND(LIBDIR, $libdir)
ACX_EXPAND(BINDIR, $bindir)
ACX_EXPAND(DATADIR, $datadir)
EXTRACFLAGS="-D_FILE_OFFSET_BITS=64"
AC_MSG_CHECKING([if cflag _XOPEN_SOURCE is required])
case "${host_cpu}-${host_os}" in
*-aix* | *solaris* | *-osf* | *-hpux*)
CFLAGS="$CFLAGS -D_XOPEN_SOURCE=500"
EXTRACFLAGS="$EXTRACFLAGS -D_XOPEN_SOURCE=500"
AC_MSG_RESULT([-D_XOPEN_SOURCE=500])
;;
*-darwin* | *-netbsd*)
AC_MSG_RESULT([no])
;;
*-freebsd* | *)
# have to add this to support pthread_rwlock_t
CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
EXTRACFLAGS="$EXTRACFLAGS -D_XOPEN_SOURCE=600"
AC_MSG_RESULT([-D_XOPEN_SOURCE=600])
;;
esac
AC_MSG_CHECKING([if cflag _BSD_SOURCE is required])
case "${host_cpu}-${host_os}" in
*-netbsd*)
CFLAGS="$CFLAGS -D_NETBSD_SOURCE=1"
EXTRACFLAGS="$EXTRACFLAGS -D_NETBSD_SOURCE=1"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: -D_NETBSD_SOURCE=1" >&5 $as_echo "-D_NETBSD_SOURCE=1" >&6; }
;;
*)
# have to add -D_BSD_SOURCE=1 to support major() in sys/sysmacros.h
# have to add -D_ISOC99_SOURCE=1 to support lrint() in bits/mathcalls.h
# have to add -D_POSIX_C_SOURCE=200112L for sem_timedwait
# have to add -D_POSIX_C_SOURCE=199309L for clock_gettime()
CFLAGS="$CFLAGS -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L"
EXTRACFLAGS="$EXTRACFLAGS -D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L"
AC_MSG_RESULT([-D_BSD_SOURCE=1 -D_ISOC99_SOURCE=1 -D_POSIX_C_SOURCE=200112L])
;;
esac
# should perhaps add _GNU_SOURCE=1 instead of the two defines above...
# That would define _BSD_SOURCE, _SVID_SOURCE, _LARGEFILE64_SOURCE,
# _XOPEN_SOURCE=600, _POSIX_C_SOURCE, _POSIX_SOURCE, _ISOC99_SOURCE
# Check if extra libs are needed. Should perhaps test if they are available too
# instead of hardcoding the libraries.
EXTRALIBS=""
AC_MSG_CHECKING([if extra libs are required])
case "${host_cpu}-${host_os}" in
*-darwin*)
# This will actually be duplicates if libusb is used.
OSLIBS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation"
EXTRALIBS=""
AC_MSG_RESULT([${OSLIBS}])
;;
*-solaris*)
OSLIBS=""
EXTRALIBS=" -lsocket -lnsl "
LIBS="$LIBS -lsocket -lnsl"
AC_MSG_RESULT([${EXTRALIBS}])
;;
*)
OSLIBS=""
EXTRALIBS=""
AC_MSG_RESULT([${EXTRALIBS}])
;;
esac
#Check for profiling
AC_MSG_CHECKING(if profiling is enabled)
ENABLE_PROFILING="false"
AC_ARG_ENABLE(profiling,
[ --enable-profiling Enable profiling (default false)],
[
AC_MSG_RESULT([$enableval])
if test "$enableval" = "yes" ; then
ENABLE_PROFILING=true
EXTRALIBS="$EXTRALIBS -pg"
EXTRACFLAGS="$EXTRACFLAGS -pg"
fi
],
[
AC_MSG_RESULT([no (default)])
])
AC_SUBST(EXTRACFLAGS)
AC_SUBST(ENABLE_PROFILING)
AM_CONDITIONAL(ENABLE_PROFILING, test "${ENABLE_PROFILING}" = "true")
ACX_EXPAND(LD_EXTRALIBS, $EXTRALIBS)
AC_SUBST(LD_EXTRALIBS)
AC_SUBST(OSLIBS)
AC_MSG_WARN([LD_EXTRALIBS=${LD_EXTRALIBS} OSLIBS=${OSLIBS}])
AC_ARG_WITH(fuseinclude,
[ --with-fuseinclude=DIR FUSE-include from @<:@/usr/local/include@:>@],
[fuse_include_path=$withval],
[fuse_include_path='/usr/local/include'])
AC_SUBST(fuse_include_path)
AC_ARG_WITH(fuselib,
[ --with-fuselib=DIR FUSE-lib from @<:@/usr/local/lib@:>@],
[fuse_lib_path=$withval],
[fuse_lib_path='/usr/local/lib'])
AC_SUBST(fuse_lib_path)
#Check owfs
AC_MSG_CHECKING([if owfs is enabled])
ENABLE_OWFS="auto"
AC_ARG_ENABLE(owfs,
[ --enable-owfs Enable owfs module (default auto)],
[
AC_MSG_RESULT([$enableval])
if test "$enableval" = "yes" ; then
ENABLE_OWFS="true"
fi
if test "$enableval" = "no" ; then
ENABLE_OWFS="false"
fi
],
[
AC_MSG_RESULT([auto (default)])
])
# We need fuse only if OWFS is enabled
if test "${ENABLE_OWFS}" != "false" ; then
save_LD_EXTRALIBS="$LD_EXTRALIBS"
save_CPPFLAGS="$CPPFLAGS"
save_LDFLAGS="$LDFLAGS"
FUSE_FLAGS="-DFUSE_USE_VERSION=26"
FUSE_INCLUDES="-I${fuse_include_path}"
FUSE_LIBS="-L${fuse_lib_path}"
LD_EXTRALIBS="$save_LD_EXTRALIBS "
CPPFLAGS="$save_CPPFLAGS -D_FILE_OFFSET_BITS=64 $FUSE_FLAGS $FUSE_INCLUDES"
LDFLAGS="$save_LDFLAGS $FUSE_LIBS"
AC_CHECK_HEADER(fuse.h,,[
AC_MSG_WARN([
Cannot find fuse.h - Add the search path with --with-fuseinclude])
FUSE_FLAGS=""
FUSE_INCLUDES=""
FUSE_LIBS=""
LD_EXTRALIBS="$save_LD_EXTRALIBS"
CPPFLAGS="$save_CPPFLAGS -D_FILE_OFFSET_BITS=64"