File: configure.ac

package info (click to toggle)
schroot 1.6.10-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 7,396 kB
  • ctags: 2,584
  • sloc: cpp: 20,961; sh: 12,849; makefile: 858; ansic: 231; sed: 16
file content (817 lines) | stat: -rw-r--r-- 33,252 bytes parent folder | download | duplicates (4)
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
#                                                              -*- Autoconf -*-
# Copyright © 2004-2009  Roger Leigh <rleigh@debian.org>
#
# schroot is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# schroot is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see
# <http://www.gnu.org/licenses/>.
#
#####################################################################
#
# Process this file with autoconf to produce a configure script.
#
#####################################################################
dnl MAKING RELEASES (a step-by-step guide!)
dnl ===============
dnl
dnl Since the last release:
dnl 1. if only source code (not the interface) has changed, set
dnl      SBUILD_MICRO_VERSION += 1;
dnl      SBUILD_INTERFACE_AGE += 1;
dnl 2. if any functions have been added, removed, or changed, set
dnl      SBUILD_INTERFACE_AGE = 0;
dnl      SBUILD_CURRENT_INTERFACE += 1;
dnl 3. if interfaces have been added, set
dnl      SBUILD_BINARY_AGE += 1;
dnl 4. if interfaces have been removed, set
dnl      SBUILD_BINARY_AGE = 0;
dnl
dnl For more detailed information, see the libtool info documentation.
dnl
dnl m4 magic from Eric Blake <ebb9@byu.net>, prior to automake inclusion
m4_define([sbuild_m4_chomp],
[m4_format([[%.*s]], m4_bregexp(m4_translit([$1], [
]]m4_dquote(_m4_defn([m4_cr_all]))[, [/]]m4_format([%255s], [])[),
  [/*$]), [$1])])
m4_define([sbuild_m4_esyscmd_s],
[sbuild_m4_chomp(m4_esyscmd([$1]))])
AC_PREREQ(2.59)
dnl Quoting the first argument results in a bizarrely corrupted package tarname
AC_INIT(sbuild_m4_esyscmd_s([sed -ne '/^Package:/{s/Package:[[:space:]][[:space:]]*//p;q}' VERSION]),
        [sbuild_m4_esyscmd_s([sed -ne '/^Version:/{s/Version:[[:space:]][[:space:]]*//p;q}' VERSION])],
        [buildd-tools-devel@lists.alioth.debian.org])
pushdef([SBUILD_CURRENT_INTERFACE], [1])
pushdef([SBUILD_INTERFACE_AGE],     [0])
pushdef([SBUILD_BINARY_AGE],        [0])
dnl For safety, check we are in the right directory by
dnl checking for a known unique file.
AC_CONFIG_SRCDIR([sbuild/sbuild-session.cc])
dnl Place auxilliary scripts here.
AC_CONFIG_AUX_DIR([scripts])
dnl Add config headers.
AC_CONFIG_HEADER([config.h])
AC_CONFIG_HEADER([sbuild/sbuild-config.h])

AC_COPYRIGHT(
[
Copyright © 2004-2009  Roger Leigh <rleigh@debian.org>

Parts of this configure script come from the 'configure.ac' file, and
are not based on freely-redistributable m4 macros; you can
redistribute it and/or modify it under the terms of the GNU General
Public License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
])

[SBUILD_CURRENT_INTERFACE]=SBUILD_CURRENT_INTERFACE
[SBUILD_INTERFACE_AGE]=SBUILD_INTERFACE_AGE
[SBUILD_BINARY_AGE]=SBUILD_BINARY_AGE
popdef([SBUILD_CURRENT_INTERFACE])
popdef([SBUILD_INTERFACE_AGE])
popdef([SBUILD_BINARY_AGE])

AC_SUBST([SBUILD_CURRENT_INTERFACE])
AC_SUBST([SBUILD_INTERFACE_AGE])
AC_SUBST([SBUILD_BINARY_AGE])

dnl Initialise automake stuff.
AM_INIT_AUTOMAKE([1.10 gnu -Wno-portability check-news dist-xz no-dist-gzip tar-pax])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
RELEASE_DATE='sbuild_m4_esyscmd_s(date --date='sbuild_m4_esyscmd_s([sed -ne '/^Release-Date:/{s/Release-Date:[[:space:]][[:space:]]*//p;q}' VERSION])' '+%s')'
RELEASE_DATE_S='sbuild_m4_esyscmd_s([sed -ne '/^Release-Date:/{s/Release-Date:[[:space:]][[:space:]]*//p;q}' VERSION])'
AC_DEFINE_UNQUOTED([RELEASE_DATE_S], ["$RELEASE_DATE_S"], [Package release date (string).])
AC_DEFINE_UNQUOTED([RELEASE_DATE], [$RELEASE_DATE], [Package release date (integer).])
AC_SUBST([RELEASE_DATE])
AC_SUBST([RELEASE_DATE_S])

AC_MSG_CHECKING([whether to enable dchroot compatibility])
AC_ARG_ENABLE([dchroot], [AS_HELP_STRING([--enable-dchroot], [Enable dchroot compatibility])],
              [ case "${enableval}" in
                yes) enable_dchroot_compat="yes" ;;
                no)  enable_dchroot_compat="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-dchroot]) ;;
                esac ],
              [ enable_dchroot_compat="no" ])
AC_MSG_RESULT([$enable_dchroot_compat])
AM_CONDITIONAL([BUILD_DCHROOT], [test "$enable_dchroot_compat" = "yes"])

AC_MSG_CHECKING([whether to enable dchroot-dsa compatibility])
AC_ARG_ENABLE([dchroot-dsa], [AS_HELP_STRING([--enable-dchroot-dsa], [Enable dchroot-dsa compatibility])],
              [ case "${enableval}" in
                yes) enable_dchroot_dsa_compat="yes" ;;
                no)  enable_dchroot_dsa_compat="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-dchroot-dsa]) ;;
                esac ],
              [ enable_dchroot_dsa_compat="no" ])
AC_MSG_RESULT([$enable_dchroot_dsa_compat])
AM_CONDITIONAL([BUILD_DCHROOT_DSA], [test "$enable_dchroot_dsa_compat" = "yes"])
AM_CONDITIONAL([BUILD_LIBDCHROOT], [test "$enable_dchroot_compat" = "yes" || test "$enable_dchroot_dsa_compat" = "yes"])

AC_MSG_CHECKING([whether to enable csbuild])
AC_ARG_ENABLE([csbuild], [AS_HELP_STRING([--enable-csbuild], [Enable csbuild])],
              [ case "${enableval}" in
                yes) enable_csbuild_compat="yes" ;;
                no)  enable_csbuild_compat="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-csbuild]) ;;
                esac ],
              [ enable_csbuild_compat="no" ])

AC_MSG_RESULT([$enable_csbuild_compat])
AM_CONDITIONAL([BUILD_CSBUILD], [test "$enable_csbuild_compat" = "yes"])

AC_MSG_CHECKING([whether to enable debugging messages])
AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Enable debugging messages])],
              [ case "${enableval}" in
                yes) enable_debug="yes" ;;
                no)  enable_debug="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
                esac ],
              [ enable_debug="no" ])
AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" = "yes"; then
  AC_DEFINE_UNQUOTED([SBUILD_DEBUG], [1], [Enable debugging])
fi

default_environment_filter='^(BASH_ENV|CDPATH|ENV|HOSTALIASES|IFS|KRB5_CONFIG|KRBCONFDIR|KRBTKFILE|KRB_CONF|LD_.*|LOCALDOMAIN|NLSPATH|PATH_LOCALE|RES_OPTIONS|TERMINFO|TERMINFO_DIRS|TERMPATH)$'

AC_MSG_CHECKING([whether to enable environment filtering regex])
AC_ARG_ENABLE([environment-filter], [AS_HELP_STRING([--enable-environment-filter], [Enable default environment filtering (regex)])],
              [ case "${enableval}" in
                yes) enable_environment_filter="$default_environment_filter" ;;
                no)  enable_environment_filter="" ;;
                *) enable_environment_filter="${enableval}" ;;
                esac ],
              [ enable_environment_filter="$default_environment_filter" ])
AC_MSG_RESULT([$enable_environment_filter])
AH_TEMPLATE(SBUILD_DEFAULT_ENVIRONMENT_FILTER, [Default regular expression used to filter user environment])
AC_DEFINE_UNQUOTED([SBUILD_DEFAULT_ENVIRONMENT_FILTER], ["$enable_environment_filter"])

AC_MSG_CHECKING([whether to enable support for PAM authentication])
AC_ARG_ENABLE([pam], [AS_HELP_STRING([--enable-pam], [Enable support for PAM authentication (requires libpam)])],
              [ case "${enableval}" in
                yes) enable_pam="yes" ;;
                no)  enable_pam="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-pam]) ;;
                esac],
              [enable_pam="auto"])
AC_MSG_RESULT([$enable_pam])

AC_MSG_CHECKING([whether to enable support for block devices])
AC_ARG_ENABLE([block-device], [AS_HELP_STRING([--enable-block-device], [Enable support for block devices])],
              [ case "${enableval}" in
                yes) enable_blockdev="yes" ;;
                no)  enable_blockdev="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-blockdev]) ;;
                esac],
              [enable_blockdev="auto"])
AC_MSG_RESULT([$enable_blockdev])

AC_MSG_CHECKING([whether to enable support for LVM snapshots])
AC_ARG_ENABLE([lvm-snapshot], [AS_HELP_STRING([--enable-lvm-snapshot], [Enable support for LVM snapshots (requires LVM)])],
              [ case "${enableval}" in
                yes) enable_lvmsnapshot="yes"
                     enable_blockdev="yes" ;;
                no)  enable_lvmsnapshot="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-lvm-snapshot]) ;;
                esac],
              [enable_lvmsnapshot="auto"])
AC_MSG_RESULT([$enable_lvmsnapshot])

AC_MSG_CHECKING([whether to enable support for BTRFS snapshots])
AC_ARG_ENABLE([btrfs-snapshot], [AS_HELP_STRING([--enable-btrfs-snapshot], [Enable support for btrfs snapshots (requires btrfs)])],
              [ case "${enableval}" in
                yes) enable_btrfssnapshot="yes"
                     enable_blockdev="yes" ;;
                no)  enable_btrfssnapshot="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-btrfs-snapshot]) ;;
                esac],
              [enable_btrfssnapshot="auto"])
AC_MSG_RESULT([$enable_btrfssnapshot])

AC_MSG_CHECKING([whether to enable support for loopback mounts])
AC_ARG_ENABLE([loopback], [AS_HELP_STRING([--enable-loopback], [Enable support for loopback mounts])],
              [ case "${enableval}" in
                yes) enable_loopback="yes" ;;
                no)  enable_loopback="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-loopback]) ;;
                esac],
              [enable_loopback="auto"])
AC_MSG_RESULT([$enable_loopback])

AC_MSG_CHECKING([whether to enable support for UUIDs in session names])
AC_ARG_ENABLE([uuid], [AS_HELP_STRING([--enable-uuid], [Enable support for UUIDs])],
              [ case "${enableval}" in
                yes) enable_uuid="yes" ;;
                no)  enable_uuid="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-uuid]) ;;
                esac],
              [enable_uuid="auto"])
AC_MSG_RESULT([$enable_uuid])

AC_MSG_CHECKING([whether to enable support for union mounts])
AC_ARG_ENABLE([union], [AS_HELP_STRING([--enable-union], [Enable support for union mounts])],
              [ case "${enableval}" in
                yes) enable_union="yes" ;;
                no)  enable_union="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-union]) ;;
                esac],
              [enable_union="auto"])
AC_MSG_RESULT([$enable_union])

AC_MSG_CHECKING([whether to enable doxygen documentation])
AC_ARG_ENABLE([doxygen], [AS_HELP_STRING([--enable-doxygen], [Enable doxygen documentation])],
              [ case "${enableval}" in
                yes) enable_doxygen="yes" ;;
                no)  enable_doxygen="no" ;;
                *) AC_MSG_RESULT([unknown])
                   AC_MSG_ERROR([bad value ${enableval} for --enable-doxygen]) ;;
                esac],
              [ enable_doxygen="auto" ])
AC_MSG_RESULT([$enable_doxygen])

AC_MSG_CHECKING([for bash completion directory])
bashcompletiondir='${sysconfdir}/bash_completion.d'
AC_ARG_WITH([bash-completion-dir], [AS_HELP_STRING([--with-bash-completion-dir], [bash shell completion directory])],
              [bashcompletiondir="${withval}"])
AC_MSG_RESULT([$bashcompletiondir])
AC_SUBST([bashcompletiondir])

# Checks for programs.
AC_PROG_CXX
AC_LANG([C++])
ACX_PTHREAD([], [AC_MSG_ERROR([POSIX thread support is required for correct std::tr1::shared_ptr operation])])
AC_CANONICAL_HOST
AC_DISABLE_SHARED
AC_ENABLE_STATIC
AC_PROG_LIBTOOL
AM_GNU_GETTEXT_VERSION([0.16])
AM_GNU_GETTEXT([external])
AC_PATH_PROG([PO4A], [po4a])
AC_PATH_PROG([SOELIM], [soelim])
AC_PATH_PROG([FIND], [find])
AC_PATH_PROG([XARGS], [xargs])
HAVE_DOXYGEN="yes"
AC_PATH_PROG([DOXYGEN], [doxygen])
if test -z "$DOXYGEN"; then
  HAVE_DOXYGEN="no"
fi
HAVE_LVM="yes"
AC_PATH_PROG([LVCREATE], [lvcreate], [], [$PATH:/sbin:/usr/sbin])
AC_PATH_PROG([LVREMOVE], [lvremove], [], [$PATH:/sbin:/usr/sbin])
if test -z "$LVCREATE" || test -z "$LVREMOVE"; then
  HAVE_LVM="no"
fi
HAVE_BTRFS="yes"
AC_PATH_PROG([BTRFS], [btrfs], [], [$PATH:/sbin:/usr/sbin])
AC_PATH_PROG([BTRFSCTL], [btrfsctl], [], [$PATH:/sbin:/usr/sbin])
if test -z "$BTRFS" || test -z "$BTRFSCTL"; then
  HAVE_BTRFS="no"
fi
HAVE_LOOPBACK="yes"
AC_PATH_PROG([LOSETUP], [losetup], [], [$PATH:/sbin:/usr/sbin])
if test -z "$LOSETUP"; then
  HAVE_LOOPBACK="no"
fi


# Check for host platform
AC_MSG_CHECKING([for supported host platform type])
PLATFORM="generic"
case $host_os in
    linux*):
        PLATFORM="linux";;
    freebsd* | k*bsd*-gnu) :
        PLATFORM="freebsd";;
esac
AC_MSG_RESULT([$PLATFORM])
AC_SUBST([PLATFORM], [$PLATFORM])

AM_CONDITIONAL([PLATFORM_GENERIC], [test "$PLATFORM" = "generic"])
AM_CONDITIONAL([PLATFORM_LINUX], [test "$PLATFORM" = "linux"])
AM_CONDITIONAL([PLATFORM_FREEBSD], [test "$PLATFORM" = "freebsd"])

AH_TEMPLATE(SBUILD_PLATFORM, [Platform type, used to modify run-time platform-specific behaviour])
AC_DEFINE_UNQUOTED(SBUILD_PLATFORM, ["$PLATFORM"])

AH_TEMPLATE(SBUILD_HOST, [Host GNU architecture triplet])
AH_TEMPLATE(SBUILD_HOST_OS, [Host OS])
AH_TEMPLATE(SBUILD_HOST_VENDOR, [Host vendor])
AH_TEMPLATE(SBUILD_HOST_CPU, [Host CPU])
AC_DEFINE_UNQUOTED(SBUILD_HOST, ["$host"])
AC_DEFINE_UNQUOTED(SBUILD_HOST_OS, ["$host_os"])
AC_DEFINE_UNQUOTED(SBUILD_HOST_VENDOR, ["$host_vendor"])
AC_DEFINE_UNQUOTED(SBUILD_HOST_CPU, ["$host_cpu"])


# Checks for libraries.
PKG_CHECK_MODULES([UUID], [uuid],
                  [HAVE_UUID=yes],
                  [HAVE_UUID=no])

AM_PATH_CPPUNIT([1.10.0], [HAVE_CPPUNIT=yes])
AM_CONDITIONAL([USE_UNIT_TESTS], [test -n "$HAVE_CPPUNIT"])

SCHROOT_CFLAGS="$UUID_CFLAGS"
AC_SUBST([SCHROOT_CFLAGS])

# Checks for header files.
AC_CHECK_HEADERS([tr1/memory])

AC_CHECK_HEADERS([boost/shared_ptr.hpp],, [
  if test $ac_cv_header_tr1_memory = yes; then
    :
  else
    AC_MSG_ERROR([Boost.shared_ptr (Boost C++ Libraries) is not installed, but is required by schroot])
  fi])

AC_CHECK_HEADERS([tuple])
AC_CHECK_HEADERS([tr1/tuple])

AC_CHECK_HEADERS([boost/tuple/tuple.hpp],, [
  if test $ac_cv_header_tr1_memory = yes; then
    :
  else
    AC_MSG_ERROR([Boost.Tuple (Boost C++ Libraries) is not installed, but is required by schroot])
  fi])

AC_CHECK_HEADERS([boost/format.hpp],, [AC_MSG_ERROR([Boost.Format (Boost C++ Libraries) is not installed, but is required by schroot])])
AC_CHECK_HEADERS([boost/iostreams/device/file_descriptor.hpp],, [AC_MSG_ERROR([Boost.Iostreams (Boost C++ Libraries) is not installed, but is required by schroot])])
AC_CHECK_HEADERS([boost/program_options.hpp],, [AC_MSG_ERROR([Boost.Program_options (Boost C++ Libraries) is not installed, but is required by schroot])])
AC_CHECK_HEADERS([boost/type_traits.hpp],, [AC_MSG_ERROR([Boost.TypeTraits (Boost C++ Libraries) is not installed, but is required by schroot])])


AC_CHECK_HEADERS([sched.h],
                 [UNSHARE_HEADER="yes"],
                 [UNSHARE_HEADER="no"])

AC_CHECK_HEADERS([sys/personality.h],
                 [PERSONALITY_HEADER="yes"],
                 [PERSONALITY_HEADER="no"])

AC_CHECK_HEADERS([security/pam_appl.h],
                 [PAM_HEADER="yes"],
                 [PAM_HEADER="no"])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_MSG_CHECKING([for std::shared_ptr])
define([testprog], [AC_LANG_PROGRAM([#include <memory>
],
                                   [ std::shared_ptr<int> intptr;])])
AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                HAVE_MEMORY_SHARED_PTR=yes],
               [AC_MSG_RESULT([no])
                HAVE_MEMORY_SHARED_PTR=no])
AH_TEMPLATE(HAVE_MEMORY_SHARED_PTR, [Set if the <memory> header file includes std::shared_ptr])
if test "$HAVE_MEMORY_SHARED_PTR" = "yes"; then
  AC_DEFINE(HAVE_MEMORY_SHARED_PTR, 1)
fi


AC_CHECK_LIB([pam], [pam_authenticate],
             [PAM_LIBS="-lpam"
              PAM_FUNC="yes"],
             [PAM_LIBS=""
              PAM_FUNC="no"])
AC_SUBST([PAM_LIBS])

AC_CHECK_FUNC([unshare],
              [UNSHARE_FUNC="yes"],
              [UNSHARE_FUNC="no"])

# Determine which features to enable.
AC_MSG_CHECKING([whether to build NLS support])
BUILD_NLS="yes"
if test "$USE_NLS" = "no"; then
  BUILD_NLS="no"
fi
AC_MSG_RESULT([$BUILD_NLS])

AM_CONDITIONAL([BUILD_NLS], [test "$BUILD_NLS" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_NLS, [Set if NLS support is present])
if test "$BUILD_NLS" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_NLS, 1)
fi

AC_MSG_CHECKING([whether to build unshare support])
BUILD_UNSHARE="yes"
if test "$UNSHARE_HEADER" = "no"; then
  BUILD_UNSHARE="no"
fi
if test "$UNSHARE_FUNC" = "no"; then
  BUILD_UNSHARE="no"
fi
AC_MSG_RESULT([$BUILD_UNSHARE])

AM_CONDITIONAL([BUILD_UNSHARE], [test "$BUILD_UNSHARE" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_UNSHARE, [Set if unshare support is present])
if test "$BUILD_UNSHARE" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_UNSHARE, 1)
fi

AC_CHECK_FUNC([personality],
              [PERSONALITY_FUNC="yes"],
              [PERSONALITY_FUNC="no"])

# Determine which features to enable.
AC_MSG_CHECKING([whether to build personality support])
BUILD_PERSONALITY="yes"
if test "$PERSONALITY_HEADER" = "no"; then
  BUILD_PERSONALITY="no"
fi
if test "$PERSONALITY_FUNC" = "no"; then
  BUILD_PERSONALITY="no"
fi
AC_MSG_RESULT([$BUILD_PERSONALITY])

AM_CONDITIONAL([BUILD_PERSONALITY], [test "$BUILD_PERSONALITY" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_PERSONALITY, [Set if personality support is present])
if test "$BUILD_PERSONALITY" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_PERSONALITY, 1)
fi

AC_MSG_CHECKING([whether to build UUID support])
BUILD_UUID="yes"
if test "$enable_uuid" = "no"; then
  BUILD_UUID="no"
elif test "$enable_uuid" = "yes"; then
  if test "$HAVE_UUID" = "no"; then
    AC_MSG_FAILURE([libuuid (e2fsprogs) is not installed, but is required by schroot])
  fi
elif test "$enable_uuid" = "auto"; then
  if test "$HAVE_UUID" = "no"; then
    BUILD_UUID="no"
  fi
fi
AC_MSG_RESULT([$BUILD_UUID])

AM_CONDITIONAL([BUILD_UUID], [test "$BUILD_UUID" = "yes"])
AH_TEMPLATE(SBUILD_USE_UUID, [Set if uuid support is present])
if test "$BUILD_UUID" = "yes"; then
  AC_DEFINE(SBUILD_USE_UUID, 1)
else
  UUID_LIBS=""
fi

AC_MSG_CHECKING([whether to build PAM support])
BUILD_PAM="yes"
if test "$enable_pam" = "yes"; then
  if test "$PAM_HEADER" = "no"; then
    BUILD_PAM="no"
    AC_MSG_FAILURE([libpam (Linux-PAM) is not installed, but is required by schroot])
  fi
  if test "$PAM_FUNC" = "no"; then
    BUILD_PAM="no"
    AC_MSG_FAILURE([libpam (Linux-PAM) is not installed, but is required by schroot])
  fi
elif test "$enable_pam" = "no"; then
    BUILD_PAM="no"
elif test "$enable_pam" = "auto"; then
  if test "$PAM_HEADER" = "no"; then
    BUILD_PAM="no"
  fi
  if test "$PAM_FUNC" = "no"; then
    BUILD_PAM="no"
  fi
fi
AC_MSG_RESULT([$BUILD_PAM])

AM_CONDITIONAL([BUILD_PAM], [test "$BUILD_PAM" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_PAM, [Set if PAM support is available])
if test "$BUILD_PAM" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_PAM, 1)
else
  PAM_LIBS=""
fi

AC_MSG_CHECKING([whether to build block-device support])
BUILD_BLOCKDEV="yes"
if test "$enable_blockdev" = "no"; then
    BUILD_BLOCKDEV="no"
fi
AC_MSG_RESULT([$BUILD_BLOCKDEV])

AM_CONDITIONAL([BUILD_BLOCKDEV], [test "$BUILD_BLOCKDEV" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_BLOCKDEV, [Set if the block-device chroot type is present])
if test "$BUILD_BLOCKDEV" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_BLOCKDEV, 1)
fi

AC_MSG_CHECKING([whether to build lvm-snapshot support])
BUILD_LVMSNAP="yes"
if test "$enable_lvmsnapshot" = "yes"; then
  if test "$HAVE_LVM" = "no"; then
    BUILD_LVMSNAP="no"
    AC_MSG_FAILURE([LVM (lvm) is not installed, but is required by schroot])
  fi
elif test "$enable_lvmsnapshot" = "no"; then
    BUILD_LVMSNAP="no"
elif test "$enable_lvmsnapshot" = "auto"; then
  if test "$HAVE_LVM" = "no"; then
    BUILD_LVMSNAP="no"
  fi
fi
AC_MSG_RESULT([$BUILD_LVMSNAP])

AM_CONDITIONAL([BUILD_LVMSNAP], [test "$BUILD_LVMSNAP" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_LVMSNAP, [Set if the lvm-snapshot chroot type is present])
if test "$BUILD_LVMSNAP" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_LVMSNAP, 1)
fi

AC_MSG_CHECKING([whether to build btrfs-snapshot support])
BUILD_BTRFSSNAP="yes"
if test "$enable_btrfssnapshot" = "yes"; then
  if test "$HAVE_BTRFS" = "no"; then
    BUILD_BTRFSSNAP="no"
    AC_MSG_FAILURE([BTRFS (btrfs) is not installed, but is required by schroot])
  fi
elif test "$enable_btrfssnapshot" = "no"; then
    BUILD_BTRFSSNAP="no"
elif test "$enable_btrfssnapshot" = "auto"; then
  if test "$HAVE_BTRFS" = "no"; then
    BUILD_BTRFSSNAP="no"
  fi
fi
AC_MSG_RESULT([$BUILD_BTRFSSNAP])

AM_CONDITIONAL([BUILD_BTRFSSNAP], [test "$BUILD_BTRFSSNAP" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_BTRFSSNAP, [Set if the btrfs-snapshot chroot type is present])
if test "$BUILD_BTRFSSNAP" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_BTRFSSNAP, 1)
fi

AC_MSG_CHECKING([whether to build loopback support])
BUILD_LOOPBACK="yes"
if test "$enable_loopbackshot" = "yes"; then
  if test "$HAVE_LOOPBACK" = "no"; then
    BUILD_LOOPBACK="no"
    AC_MSG_FAILURE([Loopback support is not avilable, but is required by schroot])
  fi
elif test "$enable_loopbackshot" = "no"; then
    BUILD_LOOPBACK="no"
elif test "$enable_loopbackshot" = "auto"; then
  if test "$HAVE_LOOPBACK" = "no"; then
    BUILD_LOOPBACK="no"
  fi
fi
AC_MSG_RESULT([$BUILD_LOOPBACK])

AM_CONDITIONAL([BUILD_LOOPBACK], [test "$BUILD_LOOPBACK" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_LOOPBACK, [Set if the loopback chroot type is present])
if test "$BUILD_LOOPBACK" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_LOOPBACK, 1)
fi

AC_MSG_CHECKING([whether to build union support])
BUILD_UNION="yes"
if test "$enable_union" = "yes"; then
  :
elif test "$enable_union" = "no"; then
  BUILD_UNION="no"
elif test "$enable_union" = "auto"; then
  BUILD_UNION="yes"
fi
AC_MSG_RESULT([$BUILD_UNION])

AM_CONDITIONAL([BUILD_UNION], [test "$BUILD_UNION" = "yes"])
AH_TEMPLATE(SBUILD_FEATURE_UNION, [Set if the union filesystem type is present])
if test "$BUILD_UNION" = "yes"; then
  AC_DEFINE(SBUILD_FEATURE_UNION, 1)
fi

AC_MSG_CHECKING([whether to build doxygen documentation])
BUILD_DOXYGEN="yes"
if test "$enable_doxygen" = "yes"; then
  :
elif test "$enable_doxygen" = "no"; then
  BUILD_DOXYGEN="no"
elif test "$enable_doxygen" = "auto"; then
  if test "$HAVE_DOXYGEN" = "no"; then
    BUILD_DOXYGEN="no"
  fi
fi
AC_MSG_RESULT([$BUILD_DOXYGEN])

AM_CONDITIONAL([BUILD_DOXYGEN], [test "$BUILD_DOXYGEN" = "yes"])

AC_MSG_CHECKING([for boost::program_options::variables_map in -lboost_program_options])
saved_LIBS="${LIBS}"
LIBS="${saved_LIBS} -lboost_program_options"
define([testprog], [AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
                                   [boost::program_options::variables_map dummy()])])
AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_LIBS="${BOOST_LIBS} -lboost_program_options"],
[LIBS="${saved_LIBS} -lboost_program_options-mt"
 AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_LIBS="${BOOST_LIBS} -lboost_program_options-mt"],
               [AC_MSG_RESULT([no])
                AC_MSG_FAILURE([libboost_program_options (Boost C++ Libraries) is not installed, but is required by schroot])])])
LIBS="${saved_LIBS}"

AC_MSG_CHECKING([for boost::program_options::options_description::options() in -lboost_program_options])
saved_LIBS="${LIBS}"
LIBS="${saved_LIBS} -lboost_program_options"
define([testprog], [AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
                                   [boost::program_options::options_description testgrp("test group");
                                    bool notused = testgrp.options().empty();
])])
AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_PROGRAM_OPTIONS_DESCRIPTION_METHODS="current"],
[LIBS="${saved_LIBS} -lboost_program_options-mt"
 AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_PROGRAM_OPTIONS_DESCRIPTION_METHODS="current"],
               [AC_MSG_RESULT([no])
                BOOST_PROGRAM_OPTIONS_DESCRIPTION_METHODS="old"])])
LIBS="${saved_LIBS}"
AH_TEMPLATE(BOOST_PROGRAM_OPTIONS_DESCRIPTION_OLD, [Set if boost::program_options::options_description::options() is not available])
if test "$BOOST_PROGRAM_OPTIONS_DESCRIPTION_METHODS" = "old"; then
  AC_DEFINE(BOOST_PROGRAM_OPTIONS_DESCRIPTION_OLD, 1)
fi

AC_MSG_CHECKING([for boost::program_options::validation_error in -lboost_program_options])
saved_LIBS="${LIBS}"
LIBS="${saved_LIBS} -lboost_program_options"
define([boost_error], [AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
                                   [boost::program_options::validation_error err(boost::program_options::validation_error::invalid_option, "error");
])])
define([boost_error_old], [AC_LANG_PROGRAM([#include <boost/program_options.hpp>],
                                   [boost::program_options::validation_error err("error");
])])
AC_LINK_IFELSE(boost_error,
               [AC_MSG_RESULT([yes (Boost >= 1.42)])
                BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR="current"],
[LIBS="${saved_LIBS} -lboost_program_options-mt"
AC_LINK_IFELSE(boost_error_old,
               [AC_MSG_RESULT([yes (Boost < 1.42)])
                BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR="old"],
               [AC_MSG_RESULT([no])
                AC_MSG_FAILURE([libboost_program_options (Boost C++ Libraries) is not installed, but is required by schroot])])])
LIBS="${saved_LIBS}"
AH_TEMPLATE(BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD, [Set if boost::program_options::validation error uses old construction semantics])
if test "$BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR" = "old"; then
  AC_DEFINE(BOOST_PROGRAM_OPTIONS_VALIDATION_ERROR_OLD, 1)
fi

dnl Note the use of quadrigraphs to quote [ and ] in regexes.
AH_TEMPLATE(HAVE_REGEX_REGEX, [Set if the <regex> header file includes std::regex])
AH_TEMPLATE(HAVE_BOOST_REGEX, [Set if the <boost/regex.hpp> header file includes boost::regex])
AC_MSG_CHECKING([for std::regex])
define([testprog], [AC_LANG_PROGRAM([#include <regex>],
                                   [std::regex foo("^foo@<:@bar@:>@$");
                                    std::regex bar("^foo@<:@bar@:>@$", std::regex::extended);
                                    std::regex check("^@<:@^:/,.@:>@@<:@^:/,@:>@*$", std::regex::extended);])])
AC_RUN_IFELSE(testprog,
  [AC_MSG_RESULT([yes])
   AC_DEFINE(HAVE_REGEX_REGEX, 1)],
  [dnl Check if std::regex is present but broken.
define([testprog], [AC_LANG_PROGRAM([#include <regex>],
                                   [std::regex foo("^foo@<:@bar@:>@$");
                                    std::regex bar("^foo@<:@bar@:>@$", std::regex::extended);])])
AC_LINK_IFELSE(testprog,
  [AC_MSG_RESULT([broken])],
  [AC_MSG_RESULT([no])])
   AC_MSG_CHECKING([for boost::regex in -lboost_regex])
   saved_LIBS="${LIBS}"
   LIBS="${saved_LIBS} -lboost_regex"
   define([testprog], [AC_LANG_PROGRAM([#include <boost/regex.hpp>],
                                   [boost::regex("^foo@<:@bar@:>@$");
                                    boost::regex bar("^foo@<:@bar@:>@$", boost::regex::extended);])])
   AC_LINK_IFELSE(testprog,
                  [AC_MSG_RESULT([yes])
                   AC_DEFINE(HAVE_BOOST_REGEX, 1)
                   BOOST_LIBS="${BOOST_LIBS} -lboost_regex"],
                  [LIBS="${saved_LIBS} -lboost_regex-mt"
                   AC_LINK_IFELSE(testprog,
                          [AC_MSG_RESULT([yes])
                           AC_DEFINE(HAVE_BOOST_REGEX, 1)
                           BOOST_LIBS="${BOOST_LIBS} -lboost_regex-mt"],
                          [AC_MSG_RESULT([no])
                    AC_MSG_FAILURE([libboost_regex (Boost C++ Libraries) is not installed, but is required by schroot])])])
   LIBS="${saved_LIBS}"
])

AC_MSG_CHECKING([for boost::iostreams in -lboost_iostreams])
saved_LIBS="${LIBS}"
LIBS="${saved_LIBS} -lboost_iostreams"
define([testprog], [AC_LANG_PROGRAM([#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
],
                                   [ boost::iostreams::stream<boost::iostreams::file_descriptor> fdstream;])])
AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_LIBS="${BOOST_LIBS} -lboost_iostreams"],
[LIBS="${saved_LIBS} -lboost_iostreams-mt"
 AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_LIBS="${BOOST_LIBS} -lboost_iostreams-mt"],
               [AC_MSG_RESULT([no])
                AC_MSG_FAILURE([libboost_iostreams (Boost C++ Libraries) is not installed, but is required by schroot])])])
LIBS="${saved_LIBS}"

AC_MSG_CHECKING([for boost::iostreams::file_descriptor_source in -lboost_iostreams])
saved_LIBS="${LIBS}"
LIBS="${saved_LIBS} -lboost_iostreams"
define([testprog], [AC_LANG_PROGRAM([#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
#include <unistd.h>],
                                   [boost::iostreams::file_descriptor_sink dummy(STDOUT_FILENO, boost::iostreams::close_handle)])])
AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes (Boost >= 1.44)])
               BOOST_IOSTREAMS_CLOSE_HANDLE="current"
                BOOST_LIBS="${BOOST_LIBS} -lboost_iostreams"],
[LIBS="${saved_LIBS} -lboost_iostreams-mt"
 AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes (Boost >= 1.44)])
               BOOST_IOSTREAMS_CLOSE_HANDLE="current"
                BOOST_LIBS="${BOOST_LIBS} -lboost_iostreams-mt"],
               [AC_MSG_RESULT([yes (Boost < 1.44)])
               BOOST_IOSTREAMS_CLOSE_HANDLE="old"])])
LIBS="${saved_LIBS}"
AH_TEMPLATE(BOOST_IOSTREAMS_CLOSE_HANDLE_OLD, [Set if boost::iostreams::file_descriptor close_handle is not available])
if test "$BOOST_IOSTREAMS_CLOSE_HANDLE" = "old"; then
  AC_DEFINE(BOOST_IOSTREAMS_CLOSE_HANDLE_OLD, 1)
fi

AC_MSG_CHECKING([for boost::filesystem in -lboost_filesystem])
saved_LIBS="${LIBS}"
LIBS="${saved_LIBS} -lboost_filesystem -lboost_system"
define([testprog], [AC_LANG_PROGRAM([#include <boost/filesystem.hpp>],
                                   [boost::filesystem::is_directory("/")])])
AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_FILESYSTEM_LIBS="-lboost_filesystem -lboost_system"],
[LIBS="${saved_LIBS} -lboost_filesystem-mt -lboost_system-mt"
 AC_LINK_IFELSE(testprog,
               [AC_MSG_RESULT([yes])
                BOOST_FILESYSTEM_LIBS="-lboost_filesystem-mt -lboost_system-mt"],
               [AC_MSG_RESULT([no])
                AC_MSG_FAILURE([libboost_filesystem (Boost C++ Libraries) is not installed, but is required by schroot])])])
LIBS="${saved_LIBS}"

AC_SUBST([BOOST_LIBS])
AC_SUBST([BOOST_FILESYSTEM_LIBS])

dnl Configure which files to generate.
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([doc/sbuild.dox])
AC_CONFIG_FILES([doc/schroot.dox])
AC_CONFIG_FILES([doc/historical/Makefile])
AC_CONFIG_FILES([po/Makefile.in])
AC_CONFIG_FILES([sbuild/Makefile])
AC_CONFIG_FILES([sbuild/sbuild.pc])
AC_CONFIG_FILES([bin/Makefile])
AC_CONFIG_FILES([bin/schroot-base/Makefile])
AC_CONFIG_FILES([bin/schroot/Makefile])
AC_CONFIG_FILES([bin/schroot-listmounts/Makefile])
AC_CONFIG_FILES([bin/schroot-mount/Makefile])
AC_CONFIG_FILES([bin/schroot-sbuild/Makefile])
AC_CONFIG_FILES([bin/dchroot/Makefile])
AC_CONFIG_FILES([bin/dchroot-dsa/Makefile])
AC_CONFIG_FILES([bin/csbuild/Makefile])
AC_CONFIG_FILES([contrib/Makefile])
AC_CONFIG_FILES([contrib/setup.d/Makefile])
AC_CONFIG_FILES([etc/Makefile])
AC_CONFIG_FILES([etc/pam/Makefile])
AC_CONFIG_FILES([etc/setup.d/Makefile])
AC_CONFIG_FILES([etc/bash_completion/Makefile])
AC_CONFIG_FILES([man/Makefile])
AC_CONFIG_FILES([scripts/po-notify])
AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([Makefile])
dnl Output the generated config.status script.
AC_OUTPUT