File: configure.ac

package info (click to toggle)
avfs 1.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,864 kB
  • sloc: ansic: 31,321; sh: 6,482; perl: 1,916; makefile: 351
file content (514 lines) | stat: -rw-r--r-- 14,470 bytes parent folder | download
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
dnl Process this file with autoconf to produce a configure script.

define(AVFS_MAJOR,[1])
define(AVFS_MINOR,[2])
define(AVFS_PATCH,[0])
define(AVFS_COMMENT,[])

define(AVFS_VERSION,AVFS_MAJOR[.]AVFS_MINOR[.]AVFS_PATCH[]AVFS_COMMENT)
define(AVFS_NUMVERSION,m4_eval(AVFS_MAJOR*100+AVFS_MINOR*10+AVFS_PATCH))

AC_PREREQ([2.50])
AC_INIT([avfs], AVFS_VERSION)
AC_CONFIG_SRCDIR([include/avfs.h])
AM_INIT_AUTOMAKE

AC_CONFIG_HEADER(include/config.h:config.h.in)
AC_PREFIX_DEFAULT(/usr)
AC_CONFIG_MACRO_DIR([macros])

dnl Check if on the same host if reconfiguring

AC_CANONICAL_HOST

AC_MSG_CHECKING([if configuration is valid])
AC_CACHE_VAL(szm_cv_host_system, [szm_cv_host_system=$host])
if test "$host" = "$szm_cv_host_system"; then
  validstring="valid"
else
  validstring="invalid"
fi
AC_MSG_RESULT([$validstring])
if test "$validstring" = invalid; then
  AC_MSG_ERROR([type 'make realclean' before running configure])
fi

VERSION=AVFS_VERSION
AC_SUBST(VERSION)

NUMVERSION=AVFS_NUMVERSION
AC_SUBST(NUMVERSION)

os=`uname -s`
kernver=`uname -r | sed -n 's/\([[0-9]]\+\)\.\([[0-9]]\+\)\..*/\1\2/p'`
if test -z "$kernver"; then
  kernver="0"
fi

AC_MSG_CHECKING([whether to build shared library and/or fuse daemon])

dnl here come the default values
shared=yes
if test "$os" = "Linux"; then
    fuse=yes
fi

AC_ARG_ENABLE([library],
              AC_HELP_STRING([--enable-library],[Compile avfs as a shared or static library]),
              [if test "$enableval" = yes; then shared=yes; else shared=no; fi])

AC_ARG_ENABLE([fuse],
              AC_HELP_STRING([--enable-fuse],[Compile avfsd for fuse]),
              [if test "$enableval" = yes; then fuse=yes; else fuse=no; fi])

shared_build=no
fuse_build=no
build_result=

if test "$shared" = yes; then
   shared_build=yes
   if test -z "$build_result"; then
      build_result=shared
   else
      build_result="$build_result shared"
   fi
fi
if test "$fuse" = yes; then
   fuse_build=yes
   if test -z "$build_result"; then
      build_result=fuse
   else
      build_result="$build_result fuse"
   fi
fi

AC_MSG_RESULT([$build_result])

AC_MSG_CHECKING([whether debugging is enabled])
AC_ARG_ENABLE(debug,
[  --enable-debug          Compile in debug information
  --disable-debug         Do not compile in debug information],
[if test "$enableval" = yes; then debugmode=yes; else debugmode=no; fi],
debugmode=yes)
AC_MSG_RESULT([$debugmode])

AC_MSG_CHECKING([whether building the dav module is enabled])
AC_ARG_ENABLE(dav,
[  --enable-dav            Compile the dav module (requires libneon)],
[if test "$enableval" = yes; then dav=yes; else dav=no; fi],
dav=yes)
AC_MSG_RESULT([$dav])

AC_ARG_WITH(system-zlib,
            AC_HELP_STRING([--with-system-zlib],[Use system zlib instead of builtin]),
            [if test "$withval" = yes; then use_system_zlib=yes; else use_system_zlib=no; fi],
            [use_system_zlib=no])
AM_CONDITIONAL(USE_SYSTEM_ZLIB,[test x$use_system_zlib = xyes])
if test x$use_system_zlib = xyes; then
    AC_DEFINE(USE_SYSTEM_ZLIB, 1, [Define if you want to use system zlib library])
    LIBZ=-lz
    ZLIB_INCLUDE=
else
    LIBZ=../zlib/libzlib.la
    ZLIB_INCLUDE='-I$(top_srcdir)/zlib'
fi
AC_SUBST(LIBZ)
AC_SUBST(ZLIB_INCLUDE)

AC_ARG_WITH(system-bzlib,
            AC_HELP_STRING([--with-system-bzlib],[Use system bzlib instead of builtin]),
            [if test "$withval" = yes; then use_system_bzlib=yes; else use_system_bzlib=no; fi],
            [use_system_bzlib=no])
AM_CONDITIONAL(USE_SYSTEM_BZLIB,[test x$use_system_bzlib = xyes])
if test x$use_system_bzlib = xyes; then
    AC_DEFINE(USE_SYSTEM_BZLIB, 1, [Define if you want to use system bzlib library])
    LIBBZ2=-lbz2
    BZLIB_INCLUDE=
else
    LIBBZ2=../bzlib/libbz.la
    BZLIB_INCLUDE='-I$(top_srcdir)/bzlib'
fi
AC_SUBST(LIBBZ2)
AC_SUBST(BZLIB_INCLUDE)

AC_ARG_WITH(pkgconfigdir,
            AC_HELP_STRING([--with-pkgconfigdir=DIR],[pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@]),
            [pkgconfigdir=$withval],
            [pkgconfigdir='${libdir}/pkgconfig'])
AC_SUBST(pkgconfigdir)

dnl Checks for programs.
cflags="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LIBTOOL

PKG_PROG_PKG_CONFIG

AC_SYS_LARGEFILE


fob_set=no
if test "x$ac_cv_sys_file_offset_bits" != x -a "$ac_cv_sys_file_offset_bits" != no; then
  CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
  fob_set=yes
fi
if test "x$ac_cv_sys_large_files" != x -a "$ac_cv_sys_large_files" != no; then
  CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
fi

if test "$enable_largefile" != no -a "$fob_set" != "yes" -a "$fuse_build" = "yes"; then
  dnl FIXME this is kind of a hack to force the flag _FILE_OFFSET_BITS
  dnl if large file support was requested but the macro decided not to
  dnl use it (for example if arch doesn't need it)
  dnl This is currently required because fuse refuses to work without it
  CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64"
  fob_set=yes
fi

if test -z "$cflags"; then
   if test "$GCC" = yes; then
      if test "$debugmode" = yes; then
         CFLAGS="-Wall -g"
      else 
         CFLAGS="-Wall -O3"
      fi
      ZLIB_CFLAGS="-Wall -O3"
   else
      if test "$debugmode" = yes; then
         CFLAGS="-g"
      else
         CFLAGS="-O"
      fi
      ZLIB_CFLAGS="-O"
   fi
fi

AC_SUBST(ZLIB_CFLAGS)

CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_GNU_SOURCE"

if test -z "$LD"; then
	AC_CHECK_PROG(LD, ld, [ld -r], [$CC -Wl,-r -nostdlib])
else
	LD="$LD -r"
	AC_SUBST(LD)
fi

AC_CHECK_FUNCS(vsnprintf strncasecmp strcasecmp mkdtemp)
AC_CHECK_FUNCS(getpwuid_r getpwnam_r getgrgid_r getgrnam_r)
AC_CHECK_FUNCS(atoll)
AC_HEADER_MAJOR

dnl For zlib
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(sys/statvfs.h)

AC_CACHE_CHECK([for d_type in struct dirent], my_cv_struct_d_type,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <dirent.h>], [struct dirent d; d.d_type;],
my_cv_struct_d_type=yes, my_cv_struct_d_type=no)])
if test $my_cv_struct_d_type = yes; then
  AC_DEFINE(HAVE_D_TYPE, 1, [Define if your struct direntry has d_type])
fi

AC_CACHE_CHECK([for d_off in struct dirent], my_cv_struct_d_off,
[AC_TRY_COMPILE([#include <sys/types.h>
#include <dirent.h>], [struct dirent d; d.d_off;],
my_cv_struct_d_off=yes, my_cv_struct_d_off=no)])
if test $my_cv_struct_d_off = yes; then
  AC_DEFINE(HAVE_D_OFF, 1, [Define if your struct direntry has d_off])
fi

AC_SEARCH_LIBS(nanosleep, posix4)
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket inet)
AC_SEARCH_LIBS(__atomic_fetch_add_8, atomic)

neon_found=no
if test "$dav" = yes; then
  PKG_CHECK_EXISTS([neon],[
                   PKG_CHECK_MODULES([LIBNEON],[neon >= 0.27.0],
                                     [neon_found=yes],[neon_found=no])
                   ])
  if test "$neon_found" = "yes"; then
      AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if your system has libneon installed])
      CPPFLAGS="$CPPFLAGS $LIBNEON_CFLAGS"
      LIBS="$LIBS $LIBNEON_LIBS"
      DAV=dav.c
      DAV_LS=dav_ls.c
  else
    DAV=
    DAV_LS=
  fi
else
  DAV=
  DAV_LS=
  LIBDAV=
fi

AC_CHECK_HEADERS(iconv.h)
AC_CHECK_HEADERS(langinfo.h)
AC_CHECK_FUNCS(iconv)
AC_CHECK_FUNCS(nl_langinfo)

AM_CONDITIONAL(BUILD_DAVSUPPORT, test x$neon_found = xyes)

AC_SUBST(DAV)
AC_SUBST(DAV_LS)
AC_SUBST(LIBDAV)

AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(pthread, pthread_create)
if test -z "`echo "$LIBS"|grep pthread`"; then
	LIBS="$LIBS -pthread"
fi

moduledir='${datarootdir}/avfs'

AC_SUBST(moduledir)

install_scriptcomps=

MC_EXTFS_CHECKS

install_fuse=no

dnl ================================================================
dnl == Now comes the stuff for fuse                               ==
dnl ================================================================

run_fuse_test=yes
AC_ARG_ENABLE([fuse-test],
              AC_HELP_STRING([--disable-fuse-test],[Disable test for fuse version]),
              [if test "$enableval" = yes; then run_fuse_test=yes; else run_fuse_test=no; fi])

if test $fuse_build = yes; then
  if test $run_fuse_test = yes; then
    AC_MSG_CHECKING([whether fuse is new enough])

    pkg-config --atleast-version=2.6.0 fuse >/dev/null 2>/dev/null

    if test $? != 0; then
      dnl too old fuse or no fuse or no pkg-config
      dnl in any case disable fuse_build
      AC_MSG_RESULT([no])
      fuse_build=no
    else
      AC_MSG_RESULT([yes])
    fi
  fi
fi

if test $fuse_build = yes; then
    fuse_pkg_found=no
    PKG_CHECK_EXISTS([fuse],[
                     PKG_CHECK_MODULES([LIBFUSE],[fuse],
                                       [fuse_pkg_found=yes])
                     ])

    if test "$fuse_pkg_found" = "yes" -o "$run_fuse_test" = "no"; then
        AC_DEFINE(HAVE_LIBFUSE, 1, [Define to 1 if your system has libfuse installed])
        CPPFLAGS="$CPPFLAGS $LIBFUSE_CFLAGS"
        FUSELIBS="$LIBFUSE_LIBS"
        AC_SUBST(FUSELIBS)
        install_fuse=yes
        install_scriptcomps="$install_scriptcomps mountavfs umountavfs"
    else
        fuse_build=no
    fi

dnl  AC_CHECK_LIB(fuse, fuse_main,[fuse_found=yes],[fuse_found=false])
dnl  if test x$fuse_found == xyes; then
dnl    FUSELIBS="-lfuse"
dnl    AC_SUBST(FUSELIBS)
dnl    install_fuse=yes
dnl    install_scriptcomps="$install_scriptcomps mountavfs umountavfs"
dnl  else
dnl    fuse_build=no
dnl  fi
fi


dnl ================================================================
dnl == check for liblzma                                          ==
dnl ================================================================

have_liblzma=no
use_liblzma=no
AC_ARG_WITH(xz,AC_HELP_STRING([--with-xz],[use xz (default is YES, force to always enable)]),
            ac_cv_use_xz=$withval, ac_cv_use_xz=yes)
if test "$ac_cv_use_xz" = "yes" -o "$ac_cv_use_xz" = "force"; then
    PKG_CHECK_EXISTS([liblzma],[
                     PKG_CHECK_MODULES([LIBLZMA],[liblzma],
                                       [have_liblzma=yes])
                     ])

    dnl AC_MSG_CHECKING(for liblzma)
    if test "$have_liblzma" = "yes" -o "$ac_cv_use_xz" = "force"; then
        AC_DEFINE(HAVE_LIBLZMA, 1, [Define to 1 if your system has liblzma installed])
        CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
        LIBS="$LIBS $LIBLZMA_LIBS"
        use_liblzma=yes
    fi
    dnl AC_MSG_RESULT($have_liblzma)
fi

dnl ================================================================
dnl == check for libzstd                                          ==
dnl ================================================================

have_libzstd=no
use_libzstd=no
AC_ARG_WITH(zstd,AC_HELP_STRING([--with-zstd],[use zstd (default is YES)]),
            ac_cv_use_zstd=$withval, ac_cv_use_zstd=yes)
if test "$ac_cv_use_zstd" = "yes"; then
    PKG_CHECK_EXISTS([libzstd],[
                     PKG_CHECK_MODULES([LIBZSTD],[libzstd],
                                       [have_libzstd=yes])
                     ])

    dnl AC_MSG_CHECKING(for libzstd)
    if test "$have_libzstd" = "yes"; then
        AC_DEFINE(HAVE_LIBZSTD, 1, [Define to 1 if your system has libzstd installed])
        CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS"
        LIBS="$LIBS $LIBZSTD_LIBS"
        use_libzstd=yes
    fi
    dnl AC_MSG_RESULT($have_libzstd)
fi

dnl ================================================================
dnl == check for liblzip                                          ==
dnl ================================================================

use_liblzip=no
AC_ARG_WITH(lzip,AC_HELP_STRING([--with-lzip],[use lzip (default is YES)]),
            ac_cv_use_lzip=$withval, ac_cv_use_lzip=yes)
if test "$ac_cv_use_lzip" = "yes"; then
    AC_CHECK_HEADERS(lzlib.h, [AC_CHECK_LIB(lz, LZ_decompress_open,
        [LIBS="$LIBS -llz"
         AC_DEFINE(HAVE_LIBLZIP, 1, [Define to 1 if your system has liblzip installed])
        use_liblzip=yes])])
fi

AM_CONDITIONAL(USE_LIBLZMA, test x$use_liblzma = xyes)
AM_CONDITIONAL(USE_LIBZSTD, test x$use_libzstd = xyes)
AM_CONDITIONAL(USE_LIBLZIP, test x$use_liblzip = xyes)
AM_CONDITIONAL(INSTALL_FUSE, test x$install_fuse = xyes)

dnl ================================================================
dnl == Now comes the stuff that is only for shared                ==
dnl ================================================================

if test $shared_build = yes; then
	install_scriptcomps="$install_scriptcomps avfs-config"
fi
AM_CONDITIONAL(BUILD_SHARED, test x$shared_build = xyes)

dnl Test whether linker supports symbol versioning 

CHECK_LD_VERSIONSCRIPT

AC_SUBST(install_scriptcomps)
AC_SUBST(shared_build)

AC_CONFIG_FILES([pkgconfig/avfs.pc])

AC_OUTPUT([
Makefile
src/Makefile
modules/Makefile
zlib/Makefile
bzlib/Makefile
lib/Makefile
include/Makefile
extfs/Makefile
scripts/Makefile
test/Makefile
spec/Makefile
macros/Makefile
patch/Makefile
doc/Makefile
fuse/Makefile
pkgconfig/Makefile

scripts/avfs-config

extfs/a
extfs/apt
extfs/audio
extfs/deb
extfs/deba
extfs/debd
extfs/dpkg
extfs/hp48
extfs/iso9660
extfs/lslR
extfs/mailfs
extfs/patchfs
extfs/rpms
extfs/u7z
extfs/uace
extfs/uar
extfs/uarj
extfs/uc1541
extfs/uha
extfs/ulha
extfs/upp
extfs/uextrar
extfs/uxdms
extfs/uxpk
extfs/uzip
extfs/uzoo

include/version.h
], [chmod +x scripts/avfs-config])

echo ""
echo "Configuration details:"
if test "$shared_build" = "yes"; then
  echo "  Building library        : yes"
else
  echo "  Building library        : no"
fi
if test "$fuse_build" = "yes"; then
  echo "  Building avfsd for fuse : yes"
else
  echo "  Building avfsd for fuse : no"
fi
echo ""
if test "x$use_system_zlib" = "xyes"; then
  echo "  Use zlib                : system (not recommended, slower random access)"
else
  echo "  Use zlib                : internal (recommended, faster random access)"
fi
if test "x$use_system_bzlib" = "xyes"; then
  echo "  Use bzlib               : system (not recommended, slower random access)"
else
  echo "  Use bzlib               : internal (recommended, faster random access)"
fi
if test "x$use_liblzma" = "xyes"; then
  echo "  Use liblzma             : yes"
else
  echo "  Use liblzma             : no"
fi
if test "x$use_libzstd" = "xyes"; then
  echo "  Use libzstd             : yes"
else
  echo "  Use libzstd             : no"
fi
if test "x$dav" = "xyes" -a "x$neon_found" = "xyes"; then
  echo "  WebDAV support          : yes"
else
  echo "  WebDAV support          : no"
fi
if test "x$use_liblzip" = "xyes"; then
  echo "  Use liblzip             : yes"
else
  echo "  Use liblzip             : no"
fi
echo ""
echo "  Installation prefix     : $prefix"
echo ""