-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.in
818 lines (711 loc) · 23.9 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
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
dnl # -*- Sh -*-
dnl # Copyright (C) 1999-2001, Andrew Arensburger.
dnl # You may distribute this file under the terms of the Artistic
dnl # License, as specified in the README file.
dnl #
dnl # $Id$
dnl #
dnl # XXX - Check for strtoul(). If nonexistent, try using atol() in palment.c
dnl # XXX - Test for MAXHOSTNAMELEN, MAXPATHLEN
dnl # XXX - If "tar --version" exits with zero status and contains the
dnl # string "GNU", then it's GNU tar, and we can use
dnl # GZIP="--best" ${TAR} chozf ${TARBALL} ${DISTDIR}
dnl # Otherwise, fall back on that old stand-by
dnl # tar cf ${TARBALL} ${DISTDIR}
dnl # ${COMPRESS} ${TARBALL}
dnl # So also check for 'gzip'; if it doesn't exist, fall back on
dnl # 'compress'
dnl # XXX - Might want to check for socket(), <netinet/in.h> etc., and
dnl # turn off NetSync if they don't exist.
dnl # XXX - Check for setvbuf(). Not sure what to do if it doesn't
dnl # exist, though. #define setvbuf() out of existence and hope for
dnl # the best?
dnl # XXX - It should be possible to specify the syslog facility.
AC_INIT(src/coldsync.c)
dnl # Automake does this, but only after all of the variables have
dnl # been defined, which is too late to put the path variables in an
dnl # autogenerated .h file.
test "x$prefix" = xNONE && prefix=${ac_default_prefix}
EXIT_STATUS=0
PACKAGE="coldsync"
VERSION="3.0"
dnl # Autoconf 2.13 or higher required for the three-argument version
dnl # of AC_DEFINE_UNQUOTED
AC_PREREQ(2.13)
AC_DEFINE_UNQUOTED(PACKAGE,["$PACKAGE"],[Name of package])
AC_DEFINE_UNQUOTED(VERSION,["$VERSION"],[Version number of package])
if test x"$EDITION" = x ; then
EDITION="$VERSION"
fi
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_SUBST(EDITION)
# This is almost certainly a Good Thing
# But if the user wants to install in /usr, then gcc can get confused
# as to which include files are system ones and which are local.
if test x"${prefix}" != x"/usr"; then
: ${LDFLAGS="-L${prefix}/lib"}
: ${CPPFLAGS="-I${prefix}/include"}
fi
## Checks for programs.
AC_PROG_CC
# Pedantic compilation. Enabled by default if using gcc.
AC_ARG_ENABLE(pedantic,dnl
[ --disable-pedantic Turn off pedantic error-checking during compilation.],dnl
cs_cv_pedantic=no,
AC_CACHE_VAL(cs_cv_pedantic,
cs_cv_pedantic=yes
)
)
if test x"$cs_cv_pedantic" = xyes; then
# I know how to be pedantic with gcc. Other compilers, I'm not sure.
if test x"$GCC" = x"yes" ; then
CFLAGS="-Wall -ansi -pedantic $CFLAGS"
CXXFLAGS="-Wall -ansi -pedantic $CXXFLAGS"
else
AC_MSG_RESULT(dnl
[ You don't seem to be using gcc, so various anal retentive
compiler options won't be turned on. If you know what they
are for your compiler, you may wish to turn them on, e.g.
CFLAGS=\"-Wall -ansi -pedantic\" ./configure
CXXFLAGS=\"-Wall -ansi -pedantic\" ./configure])
fi
fi
AC_SUBST(CFLAGS)
# AIX sucks so bad, it requires its own special check.
AC_AIX
AC_PROG_CXX
## Test C++ compiler characteristics
dnl # Save the current language
AC_LANG_SAVE
dnl # Make C++ the current language for testing programs
AC_LANG_CPLUSPLUS
# Make sure C++ compiler understands 'bool' (yes, I've gotten mail
# from someone who complained that his compiler didn't understand it).
AC_MSG_CHECKING([whether the C++ compiler understands 'bool'])
AC_TRY_COMPILE([],
[bool foo; foo = true;],
AC_MSG_RESULT(yes),
AC_MSG_WARN([
Hrung! C++ compiler no understand 'bool' keyword.
You make ftp magic[,] install new version[,] make spirits happy.
(Translation: you seem to be using an ancient C++ compiler that
doesn't understand the 'bool' keyword. You need to upgrade to a
newer compiler.)])
EXIT_STATUS=1)
dnl #'
# Make sure C++ compiler understands new-style casts
# ("static_cast<int>(foo)" rather than "(int) foo").
AC_MSG_CHECKING([whether the C++ compiler understands new-style casts])
AC_TRY_COMPILE([],
[int i; char c = 3; i = static_cast<int>(c);],
AC_MSG_RESULT(yes),
AC_MSG_WARN([
Alack! This venerable compiler doth not understand the sweet
'static_cast'[,] of which the poet Meyers doth sing. An you heed
my advice[,] gentle[,] hie to the land of GNU[,] to fetch the compiler
thereof[,] and much merriment shall ensue.
(Translation: you need to install a C++ compiler that understands
new-style casts such as \"static_cast<int>(foo)\")])
EXIT_STATUS=1)
dnl # Restore the old language
AC_LANG_RESTORE
AC_PROG_RANLIB
AC_PROG_INSTALL
dnl # This is basically the same as AC_PROG_LEX, but it uses
dnl # AC_CHECK_PROGS to make sure that there's a working 'lex'.
dnl # XXX - If $LEX isn't set, ought to check $FLEX
AC_CHECK_PROGS(LEX, flex)
if test -z "$LEX"; then
AC_MSG_WARN([
flex could be found. Please install it, then run configure again.])
LEX=true # Just in case the bozo tries to build anyway
EXIT_STATUS=1
fi
if test -z "$LEXLIB"
then
AC_CHECK_LIB(fl, yywrap, LEXLIB="-lfl")
fi
AC_SUBST(LEXLIB)
AC_SUBST(LEXARGS) # Not defined by 'configure'. Just a hook.
# I18N (optional, enabled by default)
AC_ARG_WITH(i18n,dnl
[ --without-i18n Turn off internationalization support.],dnl
:,dnl
with_i18n=yes
)
# The above just checked whether the user asked for --with-i18n, and
# set a default. Now we look for -lintl and the various catalog-making
# utilities.
# Solaris's 'xgettext' is unsuitable, since it only looks for
# gettext("some string")
# and can't be told to look for
# _("some string")
# Hence, look for the GNU version of 'xgettext'.
if test x"$with_i18n" = x"no"; then
# Do-nothing defaults, in case the user doesn't want i18n.
XGETTEXT=true
GETTEXT=true
MSGMERGE=true
MSGFMT=true
INSTALL_I18N=no
else
INSTALL_I18N=yes
# Under Redhat Linux, gettext() is in libc. On other systems,
# it's in libintl. The following looks for it in both places,
# and defines HAVE_GETTEXT if gettext() is defined anywhere.
AC_CHECK_LIB(intl, gettext)
if test "$ac_cv_lib_intl_gettext" = yes; then
AC_DEFINE_UNQUOTED(HAVE_GETTEXT)
else
AC_CHECK_FUNCS(gettext)
fi
# I18n-related utilities
# Since the GNU utilities have quite useful extensions, we
# check to see whether these programs are GNU or not.
CS_CHECK_GNU_PROGS(XGETTEXT, xgettext, true)
if test "$ac_cv_have_gnu_xgettext" = no; then
AC_MSG_WARN([
The $XGETTEXT program is not GNU xgettext. This isn't critical,
but it means that if you add strings to the source, they will not
be added to the message catalog.
(If this message didn't make sense, ignore it)])
XGETTEXT=true
fi
CS_CHECK_GNU_PROGS(GETTEXT, gettext, true)
CS_CHECK_GNU_PROGS(MSGMERGE, msgmerge, true)
dnl # XXX - /usr/imports/bin/X11/msgfmt on nomad (DU) does something
dnl # unexpected. This is the wrong msgfmt
CS_CHECK_GNU_PROGS(MSGFMT, msgfmt, true)
if test "$MSGFMT" = "true"; then
INSTALL_I18N=no
fi
if test "$ac_cv_have_gnu_msgfmt" = yes; then
EXTRA_MSGFMT_ARGS="--statistics --strict"
else
EXTRA_MSGFMT_ARGS=""
fi
fi
AC_SUBST(INSTALL_I18N)
AC_SUBST(XGETTEXT)
AC_SUBST(GETTEXT)
AC_SUBST(MSGMERGE)
AC_SUBST(MSGFMT)
AC_SUBST(EXTRA_MSGFMT_ARGS)
# See if the user specified a $LOCALEDIR. If not, use the default.
if test -z "${LOCALEDIR}"; then
LOCALEDIR="`eval echo \"${datadir}/locale\"`"
fi
AC_DEFINE_UNQUOTED(LOCALEDIR, "${LOCALEDIR}")
# IPv6 support. Enabled by default, but I haven't managed to get this
# to compile properly under Solaris, so let's make it optional.
AC_ARG_WITH(ipv6,dnl
[ --without-ipv6 Turn off experimental IPv6 support.],dnl
with_ipv6=no,
with_ipv6=yes)
# I'm not using AC_PROG_YACC here because that doesn't actually make
# sure that there is a working yacc.
AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc)
AC_SUBST(YACCARGS) # Not defined by 'configure'. Just a hook.
if test -z "$YACC"; then
AC_MSG_WARN([
Neither yacc nor bison could be found. Please install them, then
run configure again.])
YACC=true # Just in case the bozo tries to build anyway
EXIT_STATUS=1
fi
AC_PATH_PROG(PERL, perl)
AC_PATH_PROGS(POD2MAN, pod2man, true)
AC_PATH_PROG(SED, sed)
AC_CHECK_PROGS(DATE, date)
AC_CHECK_PROGS(MKDEP,[mkdep makedepend], true)
AC_CHECK_PROGS(MKID, mkid, true)
AC_CHECK_PROGS(TAR,[gtar tar])
AC_CHECK_PROGS(GZIP,[gzip compress])
AC_CHECK_PROGS(LINT,lint)
if test -z "$LINTARGS"; then
LINTARGS="-hxFH"
fi
AC_SUBST(LINTARGS)
# There are other programs called 'makeinfo' out there. We want the
# GNU one.
CS_CHECK_GNU_PROGS(MAKEINFO, makeinfo, true)
if test "$ac_cv_have_gnu_makeinfo" = no; then
ac_cv_prog_MEKEINFO=true
fi
if test -z "$ac_cv_prog_MAKEINFO" -o x"$ac_cv_prog_MAKEINFO" = x"true"; then
AC_MSG_WARN([
The makeinfo program could not be found. This isn't critical,
but it means that you won't be able to create releases with
\"make dist\".])
fi
AC_CHECK_PROGS(TEXI2DVI, [texi2dvi tex], true)
if test -z "$ac_cv_prog_TEXI2DVI" -o x"$ac_cv_prog_TEXI2DVI" = x"true"; then
AC_MSG_WARN([
The texi2dvi program could not be found. This isn't critical,
but it means that you won't be able to create releases with
\"make dist\".])
fi
AC_CHECK_PROGS(DVIPS, dvips, true)
if test -z "$ac_cv_prog_DVIPS" -o x"$ac_cv_prog_DVIPS" = x"true"; then
AC_MSG_WARN([
The dvips program could not be found. This isn't critical,
but it means that you won't be able to create releases with
\"make dist\".])
fi
AC_CHECK_PROGS(TEXI2HTML, texi2html, true)
if test -z "$ac_cv_prog_TEXI2HTML" -o x"$ac_cv_prog_TEXI2HTML" = x"true"; then
AC_MSG_WARN([
The texi2html program could not be found. This isn't critical,
but it means that you won't be able to create releases with
\"make dist\".])
fi
## Checks for libraries.
AC_CHECK_LIB(y, yyerror, LIBYACC="-ly")
AC_SUBST(LIBYACC)
## Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
CS_DIRENT_TYPE
AC_CHECK_HEADERS([\
fcntl.h \
libintl.h \
locale.h \
strings.h \
stropts.h \
termios.h \
unistd.h \
arpa/nameser.h \
sys/select.h \
sys/sockio.h \
sys/time.h \
sys/types.h \
sys/param.h \
sys/socket.h \
netinet/in.h
])
# Under FreeBSD at least, resolv.h requires netinet/in.h to be included
# first. And autoconf 2.59 actually checks for this, so when testing
# for resolv.h, include <netinet/in.h> first.
AC_CHECK_HEADER(resolv.h, [AC_DEFINE_UNQUOTED(HAVE_RESOLV_H)], [],
[#if HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif])
#echo "ac_cv_header_blah_h == <$ac_cv_header_blah_h>" # <>
#echo "ac_cv_header_fcntl_h == <$ac_cv_header_fcntl_h>" # <yes>
## Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_C_CONST
if test x"$cs_cv_pedantic" = xno; then
# ANSI C does not support "long long"
AC_CHECK_SIZEOF(long long, 8)
fi
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_HEADER_TIME
dnl AC_STRUCT_TM
AC_STRUCT_TIMEZONE
# socklen_t is defined (if it's defined) in <sys/socket.h>, so can't
# use AC_CHECK_TYPE.
CS_CHECK_TYPE(socklen_t,size_t,[#include <sys/socket.h>])
# Check for existence of struct sockaddr.sa_len (4.4BSD).
AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_struct_sockaddr_sa_len,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/socket.h>],dnl
[struct sockaddr sa; sa.sa_len;],
ac_cv_struct_sockaddr_sa_len=yes,
ac_cv_struct_sockaddr_sa_len=no)])
if test $ac_cv_struct_sockaddr_sa_len = yes; then
AC_DEFINE(HAVE_SOCKADDR_SA_LEN)
fi
# XXX - Add "--disable-ipv6", for Suns and other machines where it's
# just too painful to get it working right.
# Check for existence of struct sockaddr_in6
AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_struct_sockaddr6,
[AC_TRY_COMPILE(dnl
[#include <sys/types.h>
#include <netinet/in.h>],dnl
[int s; s = sizeof(struct sockaddr_in6);],
ac_cv_struct_sockaddr6=yes,
ac_cv_struct_sockaddr6=no)])
if test $ac_cv_struct_sockaddr6 = yes; then
AC_DEFINE(HAVE_SOCKADDR6)
fi
## Checks for library functions.
AC_CHECK_FUNCS(access \
fpurge \
getopt \
memcpy \
memset \
bcopy \
bzero \
mkstemp \
select \
rename \
strchr \
strncpy \
cfmakeraw \
socketpair \
usleep \
strcasecmp \
strncasecmp \
snprintf \
vfprintf \
vsnprintf
)
# Look for inet_pton(). If it's not found, we'll use inet_aton() instead
if test x"$with_ipv6" != x"no"; then
AC_SEARCH_LIBS(inet_pton, resolv, AC_DEFINE_UNQUOTED(HAVE_INET_PTON))
fi
AC_SEARCH_LIBS(inet_aton, resolv, AC_DEFINE_UNQUOTED(HAVE_INET_ATON))
if test x"$ac_cv_search_inet_pton" = xno; then
if test x"$ac_cv_search_inet_aton" = xno; then
AC_MSG_WARN([
Gah! You have neither inet_pton() nor inet_aton()! You need to
install a better OS. I bet this one won't even run BLAZEMONGER,
and that runs on Amigas, toasters, and even dead rodents!])
EXIT_STATUS=1
fi
fi
#'
# Look for inet_ntop(). If it's not found, we'll use inet_ntoa() instead.
# XXX - Solaris has this, but the header files <arpa/nameser.h> and
# <resolv.h> cause problems. It'd be nice to check for this as well.
if test x"$with_ipv6" != x"no"; then
AC_SEARCH_LIBS(inet_ntop, resolv, AC_DEFINE_UNQUOTED(HAVE_INET_NTOP))
fi
AC_SEARCH_LIBS(inet_ntoa, nsl, AC_DEFINE_UNQUOTED(HAVE_INET_NTOA))
if test x"$ac_cv_search_inet_ntop" = xno; then
if test x"$ac_cv_search_inet_ntoa" = xno; then
AC_MSG_WARN([
Gah! You have neither inet_ntop() nor inet_ntoa()! You need to
install a better OS. I bet this one won't even run BLAZEMONGER,
and that runs on Amigas, toasters, and even dead rodents!])
EXIT_STATUS=1
fi
fi
#'
# Look for gethostbyname2(). If it doesn't exist, we'll use
# gethostbyname() instead.
#
# RedHat 6.0 has gethostbyname() in libnsl, but also has it in
# libc.
# Under UnixWare 7.1.0, gethostbyname() is in libsocket.
if test x"$with_ipv6" != x"no"; then
AC_SEARCH_LIBS(gethostbyname2, resolv nsl socket,dnl
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME2))
fi
AC_SEARCH_LIBS(gethostbyname, resolv nsl socket,dnl
AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME))
if test x"$ac_cv_search_gethostbyname2" = xno; then
if test x"$ac_cv_search_gethostbyname" = xno; then
AC_MSG_WARN([
Furrfu! You have neither gethostbyname2() nor gethostbyname().
Here's a nickel, kid. Get yourself a better OS.])
EXIT_STATUS=1
fi
fi
#'
# getopt_long() support (optional, enabled by default).
AC_ARG_WITH(getopt_long,dnl
[ --without-getopt_long Turn off getopt_long() support.],dnl
with_getopt_long=no,
with_getopt_long=yes)
if test x"$with_getopt_long" != x"no"; then
AC_SEARCH_LIBS(getopt_long, gnugetopt, AC_DEFINE_UNQUOTED(HAVE_GETOPT_LONG))
fi
# linux capability support.
AC_CHECK_LIB(cap, cap_set_proc)
AC_MSG_CHECKING([whether use of capabilities is requested])
AC_ARG_WITH(capabilities,
[ --with-capabilities Use linux capabilities (libcap).],
[use_capabilities="$withval"],
[use_capabilities=$ac_cv_lib_cap_cap_set_proc])
AC_MSG_RESULT($use_capabilities)
if test x"$use_capabilities" = x"yes"; then
if test x"$ac_cv_lib_cap_cap_set_proc"; then
AC_DEFINE(USE_CAPABILITIES)
else
AC_MSG_WARN([
libcap missing
])
EXIT_STATUS=1
fi
fi
# libusb support.
AC_CHECK_LIB(usb, usb_init)
AC_MSG_CHECKING([whether use of libusb is requested])
AC_ARG_WITH(libusb,
[ --with-libusb Use libusb.],
[with_libusb="$withval"],
[with_libusb=$ac_cv_lib_usb_usb_init])
AC_MSG_RESULT($with_libusb)
if test x"$with_libusb" = x"yes"; then
if test x"$ac_cv_lib_usb_usb_init"; then
AC_DEFINE(WITH_LIBUSB)
else
AC_MSG_WARN([
libusb missing
])
EXIT_STATUS=1
fi
fi
# Check for ENODEV error code, for Linux.
AC_CACHE_CHECK([whether ENODEV is defined], ac_cv_enodev,
[AC_TRY_COMPILE(dnl
[#include <errno.h>],dnl
[int e; e = ENODEV;],
ac_cv_enodev=yes,
ac_cv_enodev=no)])
if test $ac_cv_enodev = yes; then
AC_DEFINE(HAVE_ENODEV)
fi
# Check whether O_BINARY is defined. It's known to exist under Windows
# (NT); not sure whether it's universal or if it's specific to Cygwin,
# but I don't really care.
AC_MSG_CHECKING([whether O_BINARY is defined])
AC_TRY_COMPILE(
[#include <fcntl.h>],
[int fd; open("dummy", O_RDONLY | O_BINARY);],
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(HAVE_O_BINARY),
AC_MSG_RESULT(no))
# Optional USB support
# (Only works under FreeBSD 4.x, for now)
# The --with(out)-usb option only indicates the user's desire. Even if
# it's turned on, 'configure' still checks to see whether it's
# possible to use the USB code. IOW, "--without-i18n" allows the user
# to turn off USB under *BSD, but that's it.
#
# Note the way this is set up: if "--with(out)-usb" was specified, then
# 'cs_cv_usb' is unconditionally set to whatever the user said. Only if
# "--with(out)-usb" _wasn't_ specified do we check the cache.
AC_ARG_WITH(usb,dnl
[ --without-usb Disable USB support (FreeBSD 4.x only).],
[
cs_cv_usb="$withval"
if test x"$cs_cv_usb" != xno; then
# This is a kludge to give something like a section
# header. We won't know whether USB is supported
# until after we perform the other tests in the
# following block.
AC_MSG_CHECKING([for USB support])
AC_MSG_RESULT()
fi
],dnl
[AC_CACHE_CHECK([for USB support],cs_cv_usb,:)])
if test x"$cs_cv_usb" != xno; then
# This code snippet checks several things:
# 1) <dev/usb/usb.h> exists
# 2) It contains 'struct usb_device_info'
# 3a) That struct contains a 'vendorNo' field, or
# 3b) That struct contains a 'udi_vendorNo' field.
# All three conditions must be true for USB support to be enabled
#
# Note that this code is ugly because it tries to Do The Right
# Thing in trying circumstances: we don't want to perform more
# time-consuming tests than we need to (i.e., if it's known that
# 'udi.udi_vendorNo' works, don't check for 'udi.vendorNo'), so the
# results are cached. But even if the results are cached, we should
# still print the results.
if test "${cs_cv_udi_prefix+set}" = set; then
# This is a kludge. $cs_cv_udi_prefix is really a three-way
# test: whether USB is supported, and which structure
# fields it requires. This if-clause is just here to print
# messages when the values are already known and cached.
AC_MSG_CHECKING([for udi_vendorNo in struct usb_device_info])
AC_MSG_RESULT([(cached) $cs_cv_udi_prefix])
if test x"$cs_cv_udi_prefix" = xno; then
AC_MSG_CHECKING([for vendorNo in struct usb_device_info])
AC_MSG_RESULT([(cached) yes])
fi
else
AC_MSG_CHECKING([for udi_vendorNo in struct usb_device_info])
AC_TRY_COMPILE(dnl
[#include <dev/usb/usb.h>],dnl
[struct usb_device_info udi;
udi.udi_vendorNo = 0x082d;],dnl
[AC_MSG_RESULT(yes)
cs_cv_usb="yes"
cs_cv_udi_prefix="yes"],
[AC_MSG_RESULT(no)
AC_MSG_CHECKING([for vendorNo in struct usb_device_info])
AC_TRY_COMPILE(dnl
[#include <dev/usb/usb.h>],dnl
[struct usb_device_info udi;
udi.vendorNo = 0x082d;],dnl
[AC_MSG_RESULT(yes)
cs_cv_usb="yes"
cs_cv_udi_prefix="no"],
[AC_MSG_RESULT(no)
cs_cv_usb="no"])])
fi
# Now define the results we've just discovered
if test x"$cs_cv_usb" = xyes; then
AC_DEFINE_UNQUOTED(WITH_USB)
if test x"$cs_cv_udi_prefix" = xyes; then
AC_DEFINE_UNQUOTED(WITH_UDI_PREFIX)
fi
fi
fi
# Don't build the Perl stuff
AC_ARG_WITH(perl,dnl
[ --without-perl Don't build the ColdSync Perl modules.],dnl
[WITH_PERL="$withval"],[WITH_PERL="yes"])
#'
if test x"$WITH_PERL" != xno; then
# Name of Perl subdirectory
PERLDIR=perl
else
PERLDIR=""
fi
AC_SUBST(PERLDIR)
# Put the Perl stuff someplace other than ${PREFIX}
# This is mainly for Red Hat, since their Perl doesn't look in
# /usr/local. Dumbasses.
#
# The idea is as follows: we want to be able to
# ./configure --prefix=/usr/local
# make install PREFIX=/pkg/coldsync
# and have everything be installed in /pkg/coldsync, but with paths
# that refer to /usr/local.
# Unfortunately, Perl doesn't easily allow you to do this. So the Perl
# Makefile does naughty things to make its paths use "${PREFIX}"
# instead of hardcoded values.
# Now on top of everything else, Red Hat's perl doesn't look in
# /usr/local like a good Perl should. So we introduce this ugly
# workaround. If you specify "--with-perl-prefix=/foo", then the Perl
# Makefile will strip "/foo" from the beginning of its built-in path,
# and replaces it with the string "${PREFIX}", so that you can specify
# a different PREFIX at install-time.
# Acceptable values are:
# [no --with-perl-prefix option] ${PREFIX}
# --with-perl-prefix=no ${PREFIX}
# --without-perl-prefix ${PREFIX}
# --with-perl-perfix Whatever Perl wants
# --with-perl-prefix=yes Whatever Perl wants
# --with-perl-prefix=/foo /foo
PERL_PREFIX='${PREFIX}'
AC_ARG_WITH(perl-prefix,dnl
[ --with-perl-prefix[=DIR]
Put Perl modules in DIR. Defaults to whatever
Perl wants.],dnl
[PERL_PREFIX="$withval"])
if test x"$PERL_PREFIX" = xyes; then
perl_prefix=""
PERL_PREFIX=""
elif test x"$PERL_PREFIX" = xno; then
perl_prefix="${prefix}"
PERL_PREFIX='${PREFIX}'
fi
AC_SUBST(PERL_PREFIX)
# Specify location where conduits are installed.
CONDUITDIR=\${LIBEXECDIR}/coldsync
AC_ARG_WITH(conduits,
[ --with-conduits=DIR Conduit installation directory [LIBEXECDIR/coldsync]],
CONDUITDIR=$with_conduits)
AC_SUBST(CONDUITDIR)
AC_DEFINE_UNQUOTED(CONDUITDIR, "${CONDUITDIR}")
AC_MSG_CHECKING([for socks behind the sofa])
AC_MSG_RESULT([no])
## Developer-only options
# The string "Options for developers", below, isn't properly speaking part
# of the help string for "--with-efence", but rather a heading for the
# output of './configure --help'.
# Unfortunately, the way this was done for autoconf 2.13 broke under
# autoconf 2.53, so we revert to a simpler, albeit uglier hack. This
# heading must remain with the first developer option.
# ElectricFence (optional)
AC_ARG_WITH(efence,dnl
Options for developers:
--with-efence Use Electric Fence memory checking library],dnl
[if test x"$withval" != xno; then
AC_CHECK_LIB(efence,malloc)
if test "$ac_cv_lib_efence_malloc" = yes; then
AC_DEFINE_UNQUOTED(WITH_EFENCE)
else
AC_MSG_WARN([Can\'t find ElectricFence library!])
dnl #' # For Emacs
fi
fi])
# Primitive memory leak detection
AC_ARG_WITH(leak-detection,dnl
[ --with-leak-detection Enable (very primitive) memory leak detection],dnl
AC_DEFINE_UNQUOTED(WITH_LEAK_DETECTION)
)
# Print error messages for various required bits that couldn't be found.
if test -z "$ac_cv_func_getopt" -o x"$ac_cv_func_getopt" = x"no" ; then
AC_MSG_WARN([
The getopt() function could not be found. This package
may not compile properly])
EXIT_STATUS=1
fi
if test -z "$ac_cv_func_select" -o x"$ac_cv_func_select" = x"no" ; then
AC_MSG_WARN([
The select() function could not be found. This package
may not compile properly])
EXIT_STATUS=1
fi
if test -z "$ac_cv_func_rename" -o x"$ac_cv_func_rename" = x"no" ; then
AC_MSG_WARN([
The rename() function could not be found. This package
may not compile properly])
EXIT_STATUS=1
fi
if test -z "$ac_cv_func_strncpy" -o x"$ac_cv_func_strncpy" = x"no" ; then
AC_MSG_WARN([
The strncpy() function could not be found. This package
may not compile properly])
EXIT_STATUS=1
fi
# XXX - If this machine doesn't have socketpair(), would it be worth
# checking to see if it has bidirectional pipe()s? See Stevens for a
# test program.
HAVE_SOCKETPAIR="$ac_cv_func_socketpair"
if test x"$HAVE_SOCKETPAIR" != x"yes"; then
# If socketpair() wasn't found (in libc), look for it in
# libsocket; that's where Solaris puts it.
AC_CHECK_LIB(socket, socketpair,
LIBS="$LIBS -lsocket"
HAVE_SOCKETPAIR=yes)
fi
if test x"$HAVE_SOCKETPAIR" != x"yes"; then
# socketpair() wasn't found anywhere
AC_MSG_WARN([
The socketpair() function could not be found. This package
may not compile properly])
EXIT_STATUS=1
fi
AC_DEFINE_UNQUOTED(SYSCONFDIR,"`eval echo \"${sysconfdir}\"/coldsync`")
AC_CONFIG_HEADER(config.h)
AC_OUTPUT([Make.rules
doc/version.texi])
if test x"$EXIT_STATUS" != x0; then
AC_MSG_WARN([
There were problems during configuration. This package may not
build properly. Please correct the errors reported above and
try again.])
fi
dnl #'
# Create the Makefile for the Perl module(s)
# If PREFIX is given, the Makefile.PL will strip off the given value
# of PREFIX, and replace it with the literal string '${PREFIX}' in the
# Makefile
(cd perl/ColdSync && ${PERL} Makefile.PL PREFIX="${prefix}")
AC_OUTPUT_COMMANDS([cd perl/ColdSync && ${PERL} Makefile.PL PREFIX="${prefix}"])
# XXX - I'm not sure this is working quite right everywhere just yet
# AC_MSG_RESULT(dnl
# [
# Don't forget to run \"make depend\"
# ])
dnl #' # For Emacs
exit "$EXIT_STATUS"
# This is for Emacs's benefit:
# Local Variables: ***
# mode: sh ***
# fill-column: 75 ***
# End: ***