Debian Codegraph @

configure.ac

raw ◀ ▶
1 Debian patch touch this file
1 AC_INIT([dump],[0.4b55],[https://dump.sourceforge.io])
2 AC_PREREQ([2.71])
3 AM_INIT_AUTOMAKE
4 AM_SILENT_RULES([no])
5 AC_CONFIG_MACRO_DIR([m4])
6
7 AC_CONFIG_HEADERS([config.h])
8
9 dnl
10 dnl Check for programs
11 dnl
12 AC_PROG_MAKE_SET
13 AC_PROG_LN_S
14 PKG_PROG_PKG_CONFIG
15 AC_PROG_CC
16 AC_PROG_CXX
17 AC_PROG_INSTALL
18
19 AC_USE_SYSTEM_EXTENSIONS
20 AC_SYS_LARGEFILE
21 AC_CANONICAL_HOST
22
23 dnl Has to be after AC_PROG_CC and other core compiler checks.
24 LT_INIT
25
26 AC_CHECK_HEADERS([sys/types.h])
27 AC_CONFIG_FILES([
28 dump.lsm
29 Makefile
30 common/Makefile
31 compat/lib/Makefile
32 dump/Makefile
33 restore/Makefile
34 rmt/Makefile
35 faketape/Makefile
36 ])
37
38 dnl Used when generating the man pages. Should refresh for each release.
39 AC_SUBST([DATE], ["10 Jun 2026"])
40
41 CPPFLAGS="${CPPFLAGS} -D_USE_BSD_SIGNAL "'-D_PATH_DUMPDATES=\"$(DUMPDATESPATH)\" -D_DUMP_VERSION=\"$(VERSION)\"'
42
•43 # az [2026-08-18 Tue 18:32]
44 # doesn't survive gcc16/glibc2.43 with -Wdiscarded-qualifiers and w/o the
45 # two -wno-error=format... exceptions
46 CFLAGS="${CFLAGS} -W -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -Wcast-qual -Wno-error=discarded-qualifiers -Wwrite-strings -Wno-error=format= -Wno-error=format-security"
47 CXXFLAGS="${CXXFLAGS} -W -Wall -std=c++20"
48
•49
50 dnl
51 dnl Handle --disable-werror
52 dnl
53 AC_MSG_CHECKING([whether to disable werror])
54 AC_ARG_ENABLE([werror], [AS_HELP_STRING([--enable-werror],[Use Werror during compilation @<:@default=no@:>@])])
55 if test "$enable_werror" = "no"
56 then
57 WERROR_FLAGS=""
58 AC_MSG_RESULT([yes])
59 else
60 WERROR_FLAGS="-Werror"
61 AC_MSG_RESULT([no])
62 fi
63 AC_SUBST([WERROR_FLAGS])
64
65 dnl
66 dnl Handle --enable-static-progs
67 dnl
68 AC_MSG_CHECKING([whether to build static binaries])
69 AC_ARG_ENABLE([static-progs], [AS_HELP_STRING([--enable-static-progs],[link dump and restore statically @<:@default=no@:>@])])
70 if test "$enable_static_progs" = "yes"
71 then
72 LDFLAGS="$LDFLAGS -static"
73 PKG_CONFIG="$PKG_CONFIG --static"
74 AC_MSG_RESULT([yes])
75 else
76 AC_MSG_RESULT([no])
77 fi
78
79 dnl
80 dnl Handle --enable-rmt
81 dnl
82 AC_MSG_CHECKING([whether to build rmt])
83 BUILD_RMT=yes
84 AC_ARG_ENABLE([rmt], [AS_HELP_STRING([--enable-rmt],[compile and install rmt @<:@default=yes@:>@])])
85 if test "$enable_rmt" = "no"; then
86 BUILD_RMT=no
87 fi
88 AM_CONDITIONAL([BUILD_RMT], [test "$BUILD_RMT" = "yes"])
89 AC_MSG_RESULT([$BUILD_RMT])
90
91 dnl
92 dnl Handle --enable-ermt
93 dnl
94 AC_MSG_CHECKING([whether to build ermt])
95 BUILD_ERMT=no
96 AC_ARG_ENABLE([ermt], [AS_HELP_STRING([--enable-ermt],[compile ermt, an encrypting version of rmt @<:@default=no@:>@])])
97 if test "$enable_ermt" = "yes"; then
98 if test "$BUILD_RMT" != "yes"; then
99 AC_MSG_ERROR([ermt requires --enable-rmt])
100 fi
101 BUILD_ERMT=yes
102 fi
103 AM_CONDITIONAL([BUILD_ERMT], [test "$BUILD_ERMT" = "yes"])
104 AC_MSG_RESULT([$BUILD_ERMT])
105
106 dnl
107 dnl Handle --enable-readline
108 dnl
109 AC_ARG_ENABLE([readline], [AS_HELP_STRING([--enable-readline],[enable readline support in restore @<:@default=yes@:>@])],
110 if test "$enableval" = "no"
111 then
112 READLINE=""
113 echo "Not including readline support"
114 else
115 READLINE="yes"
116 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
117 echo "Including readline support"
118 fi
119 ,
120 READLINE="yes"
121 AC_DEFINE([HAVE_READLINE],1,[Define if you want to include readline support.])
122 echo "Including readline support by default"
123 )
124
125 dnl
126 dnl Handle --enable-qfa
127 dnl
128 AC_ARG_ENABLE([qfa], [AS_HELP_STRING([--enable-qfa],[enable Quick File Access support @<:@default=yes@:>@])],
129 if test "$enableval" = "yes"
130 then
131 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
132 echo "Enabling Quick File Access support"
133 else
134 echo "Not enabling Quick File Access support"
135 fi
136 ,
137 AC_DEFINE([USE_QFA],1,[Define this if you want Quick File Access support.])
138 echo "Enabling Quick File Access support by default"
139 )
140
141 dnl
142 dnl Handle --enable-macosx
143 dnl
144 AC_ARG_ENABLE([macosx], [AS_HELP_STRING([--enable-macosx],[include Mac OSX restore compatibility @<:@default=no@:>@])],
145 if test "$enableval" = "yes"
146 then
147 AC_DEFINE([DUMP_MACOSX],1,[Define this if you want to include Mac OSX restore compatibility.])
148 echo "Including Mac OSX restore compatibility code"
149 else
150 echo "Not including Mac OSX restore compatibility code"
151 fi
152 ,
153 echo "Not including Mac OSX restore compatibility code by default"
154 )
155
156 dnl
157 dnl Handle --enable-selinux
158 dnl
159 AC_ARG_ENABLE([selinux], [AS_HELP_STRING([--enable-selinux],[restore can translate SELinux EAs @<:@default=auto@:>@])])
160 if test "$enable_selinux" != "no"; then
161 found_selinux="yes"
162 PKG_CHECK_MODULES([SELINUX], [libselinux], [], [
163 found_selinux="no"
164 if test "$enable_selinux" = "yes"; then
165 AC_MSG_ERROR([SELinux support requested, but not found])
166 fi
167 ])
168 if test "$found_selinux" != "no"; then
169 AC_DEFINE([TRANSSELINUX], 1, [Support SELinux labels])
170 fi
171 fi
172
173 dnl
174 dnl set $(DUMPDATESPATH) from --with-dumpdatespath
175 dnl
176 AC_ARG_WITH([dumpdatespath], [AS_HELP_STRING([--with-dumpdatespath=PATH],[select path for dumpdates file])],
177 AC_MSG_RESULT(DUMPDATESPATH is $withval)
178 DUMPDATESPATH=$withval,
179 DUMPDATESPATH="${sysconfdir}/dumpdates"
180 echo "DUMPDATESPATH defaults to $DUMPDATESPATH"
181 )dnl
182 AC_SUBST(DUMPDATESPATH)
183
184 dnl
185 dnl set _PATH_RMT from --with-rmtpath
186 dnl
187 AC_ARG_WITH([rmtpath], [AS_HELP_STRING([--with-rmtpath=PATH],[select path for rmt program])],
188 RMTPATH=$withval,
189 RMTPATH='/etc/rmt')
190 AC_SUBST(RMTPATH)
191 CPPFLAGS="${CPPFLAGS} "'-D_PATH_RMT=\"$(RMTPATH)\"'
192
193 dnl
194 dnl Check for Ext2fs headers and libraries
195 dnl
196 PKG_CHECK_MODULES(EXT2FS, [ext2fs])
197 PKG_CHECK_MODULES(COM_ERR, [com_err])
198
199 dnl
200 dnl Check for ext2fs_read_inode_full
201 dnl
202 AC_CHECK_LIB(ext2fs, ext2fs_read_inode_full, [rif=yes], [rif=no])
203 if test "$rif" = yes; then
204 AC_DEFINE([HAVE_EXT2FS_READ_INODE_FULL],1,[Define this if your ext2fs libs have the ext2fs_read_inode_full function.])
205 fi
206
207 dnl
208 dnl Try to use ext2_fs.h header from libext2fs instead of from the kernel
209 dnl
210 AC_CHECK_HEADERS([ext2fs/ext2_fs.h])
211
212 dnl
213 dnl Check for ext2_ino_t type
214 dnl
215 AC_MSG_CHECKING(for ext2_ino_t type in libext2fs headers)
216 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
217 #ifdef HAVE_EXT2FS_EXT2_FS_H
218 #include <ext2fs/ext2_fs.h>
219 #else
220 #include <linux/ext2_fs.h>
221 #endif
222 #include <ext2fs/ext2fs.h>]], [[ext2_ino_t ino = 0;]])],[AC_DEFINE([HAVE_EXT2_INO_T],1,[Define if we have the ext2_ino_t type (from e2fsprogs 1.20+).])
223 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
224
225 dnl
226 dnl Check for s_journal_inum field in ext2_super_block struct
227 dnl
228 AC_MSG_CHECKING(for s_journal_inum field in ext2_super_block struct)
229 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
230 #ifdef HAVE_EXT2FS_EXT2_FS_H
231 #include <ext2fs/ext2_fs.h>
232 #else
233 #include <linux/ext2_fs.h>
234 #endif
235 #include <ext2fs/ext2fs.h>]], [[struct ext2_super_block es; es.s_journal_inum = 0;]])],[AC_DEFINE([HAVE_EXT2_JOURNAL_INUM],1,[Define if we have the s_journal_inum field in struct ext2_super_block.])
236 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
237
238 dnl
239 dnl Check if SEEK_HOLE and SEEK_DATA is supported by lseek
240 dnl
241 AC_MSG_CHECKING(if SEEK_HOLE and SEEK_DATA is supported by lseek)
242 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
243 [[int sh = SEEK_HOLE; int sd = SEEK_DATA;]])],[AC_DEFINE([HAVE_SEEK_HOLE],1,[Define if SEEK_HOLE and SEEK_DATA are supported by lseek.])
244 AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
245
246 dnl
247 dnl Check for blkid headers libraries
248 dnl blkid should always be available on linux so require it unless explicitly disabled
249 dnl
250 AC_ARG_ENABLE([blkid], [AS_HELP_STRING([--disable-blkid],[enable blkid support])],[enable_blkid=$enableval],[
251 case "$host_os" in
252 linux*)
253 enable_blkid=yes
254 ;;
255 *)
256 enable_blkid=
257 ;;
258 esac
259 ])
260 if test "$enable_blkid" != "no"; then
261 PKG_CHECK_MODULES([BLKID], [blkid], [], [
262 found_blkid="no"
263 if test "$enable_blkid" = "yes"; then
264 AC_MSG_ERROR([blkid support requested, but not found])
265 fi
266 ])
267 if test "$found_blkid" != "no"; then
268 AC_DEFINE([HAVE_BLKID], 1, [Define this if you have the blkid library.])
269 fi
270 fi
271
272 AC_ARG_ENABLE([uuid], [AS_HELP_STRING([--disable-uuid],[enable uuid support])])
273 if test "$enable_uuid" != "no"; then
274 PKG_CHECK_MODULES([UUID], [uuid], [], [
275 found_uuid="no"
276 if test "$enable_uuid" = "yes"; then
277 AC_MSG_ERROR([uuid support requested, but not found])
278 fi
279 ])
280 if test "$found_uuid" != "no"; then
281 AC_DEFINE([HAVE_UUID], 1, [Define this if you have the uuid library.])
282 fi
283 fi
284
285 dnl
286 dnl Check for ncurses or termcap libraries
287 dnl
288 AC_CHECK_LIB(ncurses, tgetent, [ncurses_lib=yes], [ncurses_lib=no])
289 AC_CHECK_LIB(termcap, tgetent, [termcap_lib=yes], [termcap_lib=no])
290 AC_CHECK_LIB(tinfo, tgetent, [tinfo_lib=yes], [tinfo_lib=no])
291
292 if test "$ncurses_lib" = no -a "$termcap_lib" = no -a "$tinfo_lib" = no; then
293 if test "$READLINE" = "yes"; then
294 AC_MSG_ERROR(You need to install the ncurses or termcap library or configure without --enable-readline)
295 fi
296 fi
297 if test "$tinfo_lib" = yes; then
298 rdllib="-ltinfo"
299 elif test "$ncurses_lib" = yes; then
300 rdllib="-lncurses"
301 elif test "$termcap_lib" = yes; then
302 rdllib="-ltermcap"
303 fi
304
305 dnl
306 dnl Check for readline headers and libraries
307 dnl
308 AC_CHECK_HEADER(readline/readline.h, [readline_h=yes], [readline_h=no])
309 AC_CHECK_LIB(readline, readline, [readline_lib=yes], [readline_lib=no], $rdllib)
310 if test "$readline_h" = no -o "$readline_lib" = no; then
311 if test "$READLINE" = "yes"; then
312 AC_MSG_ERROR(You need to install the GNU readline library or configure without --enable-readline)
313 fi
314 fi
315 if test "$READLINE" = yes; then
316 READLINE="-lreadline $rdllib"
317 fi
318 AC_SUBST(READLINE)
319
320 dnl
321 dnl Check for rl_completion_matches
322 dnl
323 AC_CHECK_LIB(readline, rl_completion_matches, [rlcm=yes], [rlcm=no], [$rdllib])
324 if test "$rlcm" = yes; then
325 AC_DEFINE([HAVE_READLINE_RLCM],1,[Define this if your readline libs have the rl_completion_matches library.])
326 fi
327
328 dnl
329 dnl Check for rl_completion_append_character
330 dnl
331 AC_CHECK_LIB(readline, rl_completion_append_character, [rcac=yes], [rcac=no], [$rdllib])
332 if test "$rcac" = yes; then
333 AC_DEFINE([HAVE_READLINE_CAC],1,[Define this if your readline libs have the rl_completion_append_character variable.])
334 fi
335
336 dnl
337 dnl Check for zlib headers and libraries
338 dnl
339 AC_ARG_ENABLE([zlib], [AS_HELP_STRING([--disable-zlib],[enable zlib compression support])])
340 if test "$enable_zlib" != "no"; then
341 PKG_CHECK_MODULES([ZLIB], [zlib], [], [
342 found_zlib="no"
343 if test "$enable_zlib" = "yes"; then
344 AC_MSG_ERROR([zlib support requested, but not found])
345 fi
346 ])
347 if test "$found_zlib" != "no"; then
348 AC_DEFINE([HAVE_ZLIB], 1, [Include zlib support])
349 fi
350 fi
351
352 dnl
353 dnl Check for bzlib headers and libraries
354 dnl
355 AC_ARG_ENABLE([bzip2], [AS_HELP_STRING([--disable-bzip2],[enable bzip2 compression support])])
356 BZLIB=
357 if test "$enable_bzip2" != "no"; then
358 AC_CHECK_HEADER(bzlib.h, [bzlib_h=yes], [bzlib_h=no])
359 AC_CHECK_LIB(bz2, BZ2_bzBuffToBuffCompress, [bzlib_lib=yes], [bzlib_lib=no])
360
361 if test "$bzlib_h" = yes -a "$bzlib_lib" = yes; then
362 BZLIB="-lbz2"
363 AC_DEFINE([HAVE_BZLIB], 1, [Define this if you have bzlib compression library.])
364 elif test "$enable_bzip2" = "yes"; then
365 AC_MSG_ERROR([bzip2 support requested, but not found])
366 fi
367 fi
368 AC_SUBST(BZLIB)
369
370 dnl
371 dnl Check for lzo headers and libraries
372 dnl
373 AC_ARG_ENABLE([lzo], [AS_HELP_STRING([--disable-lzo],[enable lzo compression support])])
374 LZOLIB=
375 if test "$enable_lzo" != "no"; then
376 AC_CHECK_HEADER(lzo/lzo1x.h, [lzo_h=yes], [lzo_h=no])
377 AC_CHECK_LIB(lzo2, lzo1x_1_compress, [lzo_lib=yes], [lzo_lib=no])
378
379 if test "$lzo_h" = yes -a "$lzo_lib" = yes; then
380 LZOLIB="-llzo2"
381 AC_DEFINE([HAVE_LZO], 1, [Define this if you have lzo compression library.])
382 elif test "$enable_lzo" = "yes"; then
383 AC_MSG_ERROR([lzo support requested, but not found])
384 fi
385 fi
386 AC_SUBST(LZOLIB)
387
388 dnl
389 dnl Check for sqlite3 headers and libraries
390 dnl
391 AC_ARG_ENABLE([sqlite], [AS_HELP_STRING([--disable-sqlite],[disable sqlite indexing support])])
392 SQLITE3=
393 if test "$enable_sqlite" != "no"; then
394 AC_CHECK_HEADER(sqlite3.h, [sqlite3_h=yes], [sqlite3_h=no])
395 AC_CHECK_LIB(sqlite3, sqlite3_initialize, [sqlite3_lib=yes], [sqlite3_lib=no])
396 if test "$sqlite3_h" = yes -a "$sqlite3_lib" = yes; then
397 SQLITE3="-lsqlite3"
398 AC_DEFINE([HAVE_SQLITE3],1,[Define this if you have sqlite3 library.])
399 elif test "$enable_sqlite" = "yes"; then
400 AC_MSG_ERROR([sqlite support requested, but not found])
401 fi
402 fi
403 AC_SUBST(SQLITE3)
404
405 dnl
406 dnl Check for library functions
407 dnl
408 AC_CHECK_FUNCS(err errx verr verrx vwarn vwarnx warn warnx realpath lchown utimensat)
409 AC_CHECK_FUNC(glob)
410
411 dnl
412 dnl Check for GLOB_ALTDIRFUNC
413 dnl
414 AC_MSG_CHECKING(for extended glob routines)
415 if test "$ac_cv_func_glob" = "yes"; then
416 AC_EGREP_CPP(yes,
417 [
418 # include <glob.h>
419 # ifdef GLOB_ALTDIRFUNC
420 yes
421 # endif
422 ],
423 [
424 AC_DEFINE([HAVE_GLOB],1,[Define if you have the glob function.])
425 AC_MSG_RESULT(yes)
426 ],
427 [
428 AC_MSG_RESULT(no)
429 echo "Your system does not support extended glob, will use the internal routines"
430 ])
431 fi
432
433 dnl
434 dnl Check for OpenSSL, for ermt
435 dnl
436 AC_ARG_ENABLE([ssl], [AS_HELP_STRING([--disable-ssl],[disable ssl support])])
437 if test "$enable_ssl" != "no"; then
438 PKG_CHECK_MODULES([SSL], [openssl], [], [
439 found_ssl="no"
440 if test "$enable_ssl" = "yes"; then
441 AC_MSG_ERROR([OpenSSL support requested, but not found])
442 fi
443 ])
444 if test "$found_ssl" != "no"; then
445 AC_DEFINE([HAVE_OPENSSL], 1, [Include OpenSSL support])
446 fi
447 fi
448 if test "$ERMT" != "" -a -z "$SSL_LIBS"; then
449 AC_MSG_ERROR([You need to install the OpenSSL library (version 0.9.7a or later), or configure without --enable-ermt])
450 fi
451
452 dnl
453 dnl Check for types
454 dnl
455 AC_TYPE_INT64_T
456 AC_TYPE_UINT64_T
457
458 AC_OUTPUT