2007-10-29 22:38:52 +01:00
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
2011-06-17 07:55:45 +02:00
AC_PREREQ([2.59])
2019-07-09 19:28:33 +02:00
AC_INIT([testdisk],[7.2-WIP],[grenier@cgsecurity.org])
2015-04-11 13:46:21 +02:00
AC_LANG(C)
2009-01-04 19:37:13 +01:00
sinclude(acx_pthread.m4)
2016-04-11 18:34:27 +02:00
sinclude(mkdir.m4)
2021-05-12 16:19:44 +02:00
TESTDISKDATE="May 2021"
2007-10-29 22:38:52 +01:00
AC_SUBST(TESTDISKDATE)
AC_DEFINE_UNQUOTED([TESTDISKDATE],"$TESTDISKDATE",[Date of release])
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_HOST([])
AC_CANONICAL_TARGET([])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
2016-02-24 20:27:08 +01:00
AM_INIT_AUTOMAKE([-Wall foreign])
2014-10-11 09:40:19 +02:00
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
2007-10-29 22:38:52 +01:00
AC_DEFINE([_GNU_SOURCE], 1, [Enable GNU extensions])
AH_TEMPLATE([TARGET_LINUX], [Define for LINUX target])
AH_TEMPLATE([TARGET_BSD], [Define for BSD target])
AH_TEMPLATE([TARGET_SOLARIS], [Define for SOLARIS target])
# This is required to get past a stupid configure bug when making the rpm.
# Basically it is broken to specify the host as a command line argument to
# configure on its own, i.e. without giving --host=. It is supposed to work
# but doesn't. So this sets host and erases nonopt effectively moving the
# standalone command line option into the --host= form.
if test "x$nonopt" != "xNONE"; then
host="$nonopt"
nonopt="NONE"
fi
# Command-line options.
2007-11-16 09:07:02 +01:00
AC_ARG_WITH([ncurses],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--without-ncurses],[disabled use of the curses/ncurses/pdcurses/curses library (default is NO)]))
2007-11-16 09:07:02 +01:00
AC_ARG_WITH(ncurses-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ncurses-lib=DIR],[location of the ncurses library]),
2008-06-23 19:08:19 +02:00
[ ncurses_lib_dir="${withval}"
2007-11-16 09:07:02 +01:00
LDFLAGS="${LDFLAGS} -L${withval}" ])
AC_ARG_WITH(ncurses-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ncurses-includes=DIR],[location of the ncurses includes files]),
2007-11-16 09:07:02 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH([ext2fs],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--without-ext2fs],[disabled use of the ext2fs library (default is NO)]))
2007-10-29 22:38:52 +01:00
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(ext2fs-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ext2fs-lib=DIR],[location of the ext2fs library]),
2007-10-29 22:38:52 +01:00
[ ext2fs_lib_a="${withval}/libext2fs.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(ext2fs-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ext2fs-includes=DIR],[location of the ext2fs includes files]),
2007-10-29 22:38:52 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2007-12-28 18:41:22 +01:00
AC_ARG_WITH(com_err-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-com_err-lib=DIR],[location of the com_err library]),
2007-12-28 18:41:22 +01:00
[ com_err_lib_a="${withval}/libcom_err.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
AC_ARG_WITH(com_err-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-com_err-includes=DIR],[location of the com_err includes files]),
2007-12-28 18:41:22 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH([jpeg],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--without-jpeg],[disabled use of the jpeg library (default is NO)]))
2007-10-29 22:38:52 +01:00
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(jpeg-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-jpeg-lib=DIR],[location of the jpeg library]),
2007-11-07 08:02:54 +01:00
[ jpeg_lib_a="${withval}/libjpeg.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
2007-10-29 22:38:52 +01:00
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(jpeg-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-jpeg-includes=DIR],[location of the jpeg includes files]),
2007-11-07 08:02:54 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2007-10-29 22:38:52 +01:00
2015-05-15 18:15:29 +02:00
AC_ARG_WITH([ntfs],
AS_HELP_STRING([--without-ntfs],[disabled use of the ntfs library (default is NO)]))
2007-10-29 22:38:52 +01:00
2019-04-14 17:26:25 +02:00
AC_ARG_WITH([coverity-fix],
AS_HELP_STRING([--with-coverity-fix],[Enable a coverity bug workaround]),
[CFLAGS="${CFLAGS} -D_Float128=__uint128_t -D_Float32x=int -D_Float32=int -D_Float64x=long -D_Float64=long"])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(ntfs-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ntfs-lib=DIR],[location of the ntfs library]),
2007-10-29 22:38:52 +01:00
[ ntfs_lib_a="${withval}/libntfs.a"
LDFLAGS="${LDFLAGS} -L${withval}"
])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(ntfs-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ntfs-includes=DIR],[location of the ntfs includes files]),
2007-10-29 22:38:52 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2015-05-15 18:15:29 +02:00
AC_ARG_WITH([ntfs3g],
AS_HELP_STRING([--without-ntfs3g],[disabled use of the ntfs3g library (default is NO)]))
2011-04-06 09:08:26 +02:00
AC_ARG_WITH(ntfs3g-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ntfs3g-lib=DIR],[location of the ntfs3g library]),
2011-04-06 09:08:26 +02:00
[ ntfs3g_lib_a="${withval}/libntfs-3g.a"
LDFLAGS="${LDFLAGS} -L${withval}"
])
AC_ARG_WITH(ntfs3g-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ntfs3g-includes=DIR],[location of the ntfs3g includes files]),
2011-04-06 09:08:26 +02:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(dal-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-dal-lib=DIR],[location of the dal library]),
2007-10-29 22:38:52 +01:00
[ LDFLAGS="${LDFLAGS} -L${withval}" ])
2015-05-15 18:15:29 +02:00
AC_ARG_WITH([reiserfs],
AS_HELP_STRING([--without-reiserfs],[disabled use of the reiserfs library (default is NO)]))
2007-10-29 22:38:52 +01:00
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(reiserfs-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-reiserfs-lib=DIR],[location of the reiserfs library]),
2007-10-29 22:38:52 +01:00
[ reiserfs_lib_a="${withval}/libreiserfs.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(reiserfs-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-reiserfs-includes=DIR],[location of the reiserfs includes files]),
2007-10-29 22:38:52 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2015-05-15 18:15:29 +02:00
AC_ARG_WITH([ewf],
AS_HELP_STRING([--without-ewf],[disabled use of the ewf library (default is NO)]))
2007-10-29 22:38:52 +01:00
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(ewf-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ewf-lib=DIR],[location of the ewf library]),
2007-10-29 22:38:52 +01:00
[ ewf_lib_a="${withval}/libewf.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(ewf-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-ewf-includes=DIR],[location of the ewf includes files]),
2007-11-06 16:40:46 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2015-05-15 18:15:29 +02:00
AC_ARG_WITH([iconv],
AS_HELP_STRING([--without-iconv],[disabled use of the iconv library (default is NO)]))
2007-11-06 16:40:46 +01:00
AC_ARG_WITH(iconv-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-iconv-lib=DIR],[location of the iconv library]),
2007-11-06 16:40:46 +01:00
[ iconv_lib_a="${withval}/libiconv.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
AC_ARG_WITH(iconv-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-iconv-includes=DIR],[location of the iconv includes files]),
2007-11-06 16:40:46 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
AC_ARG_WITH(giconv-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-giconv-lib=DIR],[location of the giconv library]),
2007-11-06 16:40:46 +01:00
[ iconv_lib_a="${withval}/libgiconv.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
AC_ARG_WITH(giconv-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-giconv-includes=DIR],[location of the giconv includes files]),
2007-10-29 22:38:52 +01:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2015-05-15 18:15:29 +02:00
AC_ARG_WITH([zlib],
AS_HELP_STRING([--without-zlib],[disabled use of the zlib library (default is NO)]))
2014-03-16 19:22:19 +01:00
2015-05-15 18:15:29 +02:00
AC_ARG_WITH([uuid],
AS_HELP_STRING([--without-uuid],[disabled use of the uuid library]))
2008-08-25 23:12:49 +02:00
2014-03-29 11:22:29 +01:00
AC_ARG_ENABLE([assert],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--enable-assert],[enable compilation of assert code (default is YES)]),
2014-03-29 11:22:29 +01:00
[case "${enableval}" in
yes) use_assert=true ;;
no) use_assert=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-assert]) ;;
esac],
[use_assert=true])
2008-04-02 23:47:50 +02:00
AC_ARG_ENABLE([sudo],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--enable-sudo],[enable use of sudo (default is NO)]),
2008-04-02 23:47:50 +02:00
[case "${enableval}" in
yes) use_sudo=true ;;
no) use_sudo=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-sudo]) ;;
esac],
[use_sudo=false])
2007-11-28 22:42:36 +01:00
AC_ARG_WITH(sudo-bin,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-sudo-bin=PROG],[location of the sudo binary]),
2007-11-28 22:42:36 +01:00
[SUDO_BIN="${withval}"])
2012-05-01 17:26:44 +02:00
AC_ARG_WITH(uuid-lib,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-uuid-lib=DIR],[location of the uuid library]),
2012-05-01 17:26:44 +02:00
[ uuid_lib_a="${withval}/libuuid.a"
LDFLAGS="${LDFLAGS} -L${withval}" ])
AC_ARG_WITH(uuid-includes,
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--with-uuid-includes=DIR],[location of the uuid includes files]),
2012-05-01 17:26:44 +02:00
[CPPFLAGS="${CPPFLAGS} -I${withval}"])
2008-04-02 23:47:50 +02:00
AC_ARG_ENABLE([missing-uuid-ok],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--enable-missing-uuid-ok], [force compilation even if both uuidgen and uuid_generate are missing, for developpement only (default is NO)]),
2008-04-02 23:47:50 +02:00
[case "${enableval}" in
yes) missing_uuid_ok=true ;;
no) missing_uuid_ok=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-missing_uuid_ok]) ;;
esac],
[missing_uuid_ok=false])
2008-03-24 15:55:19 +01:00
2009-01-14 22:19:06 +01:00
AC_ARG_ENABLE([qt],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--enable-qt],[enable use of qt (default is YES)]),
2009-01-14 22:19:06 +01:00
[case "${enableval}" in
yes) use_qt=true ;;
no) use_qt=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-qt]) ;;
esac],
2013-10-20 12:26:19 +02:00
[use_qt=true])
2009-01-14 22:19:06 +01:00
2010-09-11 18:53:59 +02:00
AC_ARG_ENABLE([ncmouse],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--enable-ncmouse],[enable use of mouse in ncurses(default is NO)]),
2010-09-11 18:53:59 +02:00
[case "${enableval}" in
yes) use_ncmouse=true ;;
no) use_ncmouse=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-mouse]) ;;
esac],
[use_ncmouse=false])
2011-11-15 07:16:09 +01:00
AC_ARG_ENABLE([dfxml],
2015-05-15 18:15:29 +02:00
AS_HELP_STRING([--disable-dfxml]),
2011-11-15 07:16:09 +01:00
[case "${enableval}" in
yes) AC_DEFINE([ENABLE_DFXML],1,[Define to 1 if DFXML log is enabled]) ;;
no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-dfxml]) ;;
esac],
[AC_DEFINE([ENABLE_DFXML],1,[Define to 1 if DFXML log is enabled])])
2012-12-23 16:56:17 +01:00
# Enable code coverage collection
AC_ARG_ENABLE(coverage,
[ --enable-coverage[=LEVEL]
enable compiler's code coverage collection.
Use to measure compiler performance and locate
unused parts of the compiler. With LEVEL, specify
optimization. Values are opt, noopt,
default is noopt],
[case "${enableval}" in
yes|noopt)
coverage_flags="--coverage -frandom-seed=\$@ -O0"
;;
opt)
coverage_flags="--coverage -frandom-seed=\$@ -O2"
;;
no)
# a.k.a. --disable-coverage
coverage_flags=""
;;
*)
AC_MSG_ERROR(unknown coverage setting $enableval)
;;
esac],
[coverage_flags=""])
2014-10-05 21:05:44 +02:00
AC_ARG_ENABLE(gprof,
AS_HELP_STRING([--enable-gprof],
[Produce gprof profiling data in 'gmon.out' (GCC only).]),
[if test "$enableval" = "yes" ; then
coverage_flags="$coverage_flags -pg"
fi])
2015-04-11 13:47:31 +02:00
# Determine if stack protection is disabled
AC_ARG_ENABLE([stack-protector],
AS_HELP_STRING([--disable-stack-protector],
[Disable the use of -fstack-protector-strong]))
AS_IF([test "x$enable_stack_protector" = "xno"],
[stackProtector=0],
[stackProtector=1]
)
2015-05-15 18:19:22 +02:00
AC_ARG_ENABLE([record-compilation-date],
AS_HELP_STRING([--enable-record-compilation-date],[record compilation date (default is NO)]),
[case "${enableval}" in
yes) AC_DEFINE([RECORD_COMPILATION_DATE],1,[Define to 1 to record compilation date]) ;;
no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-record-compilation-date]) ;;
esac]
)
2007-10-29 22:38:52 +01:00
use_icon=no
case "$target" in
*-*-*cygwin*)
use_icon=yes
2014-11-02 15:22:45 +01:00
win_target=yes
2007-10-29 22:38:52 +01:00
;;
*-*-*mingw*)
use_icon=yes
2014-11-02 15:22:45 +01:00
win_target=yes
2007-10-29 22:38:52 +01:00
;;
*-*-*djgpp)
if test -z "$CC" ; then CC=gcc; fi
2015-04-11 13:47:31 +02:00
stackProtector=0
2007-10-29 22:38:52 +01:00
;;
*-*-*bsd*)
AC_DEFINE([TARGET_BSD], 1)
;;
*-*-linux*)
AC_DEFINE([TARGET_LINUX], 1)
;;
*-*-solaris*)
AC_DEFINE([TARGET_SOLARIS], 1)
;;
esac
# freebsd 4.X doesn't have stdint.h
# progsreiserfs header check for this variable to avoid this file inclusion
# IMOO progsreiserfs need to check for headers file presence instead
case "$target" in
*freebsd4)
AC_DEFINE([__freebsd__], 1,[Define for freebsd4 target and progsreiserfs compatibility])
;;
esac
AM_CONDITIONAL(USEICON, test "$use_icon" = yes)
# Checks for programs.
AC_PROG_CC
2009-01-14 22:19:06 +01:00
AC_PROG_CXX
2007-10-29 22:38:52 +01:00
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
2016-04-09 17:06:23 +02:00
AC_PROG_MKDIR_P
2009-01-14 22:19:06 +01:00
PKG_PROG_PKG_CONFIG
2007-10-29 22:38:52 +01:00
AC_ARG_VAR(WINDRES, [Windows Resource compiler tool path])
2009-01-04 19:37:13 +01:00
AC_PATH_TOOL(WINDRES,windres,)
2007-10-29 22:38:52 +01:00
AC_SUBST(WINDRES)
2009-01-04 19:37:13 +01:00
if test -z "$WINDRES"; then
AC_MSG_WARN(Could not find a windres tool in your PATH.)
fi
2007-10-29 22:38:52 +01:00
# Enable large file support.
AC_SYS_LARGEFILE
# Checks for header files.
AC_HEADER_STDC
#AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h stdint.h unistd.h])
AC_HEADER_SYS_WAIT
2012-01-27 08:37:29 +01:00
AC_CHECK_HEADERS([byteswap.h curses.h cygwin/fs.h cygwin/version.h dal/file_dal.h dal/file.h ddk/ntddstor.h dirent.h endian.h errno.h fcntl.h features.h giconv.h glob.h iconv.h io.h libgen.h limits.h linux/fs.h linux/hdreg.h linux/types.h locale.h machine/endian.h malloc.h ncurses.h ncurses/curses.h ncurses/ncurses.h ncursesw/curses.h ncursesw/ncurses.h ntfs/version.h pwd.h scsi/scsi.h scsi/scsi_ioctl.h scsi/sg.h setjmp.h signal.h stdarg.h sys/cygwin.h sys/disk.h sys/disklabel.h sys/dkio.h sys/endian.h sys/ioctl.h sys/param.h sys/select.h sys/time.h sys/utsname.h sys/vtoc.h time.h utime.h w32api/ddk/ntdddisk.h windef.h windows.h zlib.h])
2007-11-06 16:40:46 +01:00
#--------------------------------------------------------------------
# Check for iconv support (for Unicode conversion).
#--------------------------------------------------------------------
#
# We need to find an iconv library that matches the installed iconv.h header
# (if any). It is important to check header/library compatibility. It's
# fairly common to have iconv support both in libc and from libiconv. In that
# case, a naive check that iconv() is in libc will succeed, but if we use
# libiconv's iconv.h, it will redefine iconv() to functions that exist
# only in libiconv, and we'll get link errors.
#
# First, check if there's a working iconv in libc (ie. if the test program
# compiles and links without any extra flags).
2015-05-15 18:15:29 +02:00
if test "x$with_iconv" != "xno"; then
2007-11-06 16:40:46 +01:00
AC_MSG_CHECKING(iconv support)
2011-06-17 07:55:45 +02:00
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <iconv.h>
int main(int argc,char **argv) { iconv_open("foo","bar"); }])]
2007-11-06 16:40:46 +01:00
,
# libc has a working iconv.
AC_DEFINE(HAVE_ICONV,1, [Define if you have this function])
AC_MSG_RESULT([[yes, in libc]])
2015-05-15 18:15:29 +02:00
have_iconv=yes
2007-11-06 16:40:46 +01:00
)
2015-05-15 18:15:29 +02:00
if test "x$have_iconv" != "xyes" ; then
2007-11-06 16:40:46 +01:00
# libc doesn't have a working iconv. Try adding -liconv and any user
# supplied directory.
old_LIBS="$LIBS"
if test "${iconv_lib_a}" = ""; then
2016-08-16 20:19:18 +02:00
LIBS="-liconv $LIBS"
2007-11-06 16:40:46 +01:00
else
2016-08-16 20:19:18 +02:00
LIBS="${iconv_lib_a} $LIBS"
2007-11-06 16:40:46 +01:00
fi
2011-06-17 07:55:45 +02:00
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <iconv.h>
int main(int argc,char **argv) { iconv_open("foo","bar"); }])]
2007-11-06 16:40:46 +01:00
,
# -liconv works.
AC_DEFINE(HAVE_ICONV,1, [Define if you have this function])
AC_MSG_RESULT([[yes, -liconv]])
2015-05-15 18:15:29 +02:00
have_iconv=yes
2007-11-06 16:40:46 +01:00
,
LIBS="$old_LIBS"
)
fi
2015-05-15 18:15:29 +02:00
if test "x$have_iconv" != "xyes" ; then
2007-11-06 16:40:46 +01:00
# -liconv didn't work. Try giconv.h and -lgiconv.
# BSDs install this lib as libgiconv.
old_LIBS="$LIBS"
if test "${giconv_lib_a}" = ""; then
2016-08-16 20:19:18 +02:00
LIBS="-lgiconv $LIBS"
2007-11-06 16:40:46 +01:00
else
2016-08-16 20:19:18 +02:00
LIBS="${giconv_lib_a} $LIBS"
2007-11-06 16:40:46 +01:00
fi
2011-06-17 07:55:45 +02:00
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <giconv.h>
int main(int argc,char **argv) { iconv_open("foo","bar"); }])]
2007-11-06 16:40:46 +01:00
,
AC_DEFINE(HAVE_ICONV,1, [Define if you have this function])
AC_DEFINE(HAVE_GICONV,1, [Define if you have this function])
AC_MSG_RESULT([[yes, -lgiconv]])
,
AC_MSG_RESULT([[no]])
LIBS="$old_LIBS"
)
fi
else
AC_MSG_WARN(Use of iconv function disabled)
fi
2015-05-15 18:15:29 +02:00
if test "x$have_iconv" != "xyes"; then
if test "x$with_iconv" = "xyes"; then
AC_MSG_ERROR([iconv requested but not found])
fi
fi
2007-10-29 22:38:52 +01:00
AC_CHECK_HEADERS(sys/mount.h,,,
[[
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]])
AC_CHECK_HEADERS([winbase.h],,,
[[
#ifdef HAVE_WINDEF_H
#include <windef.h>
#endif
#include <stdarg.h>
]])
AC_CHECK_HEADERS([winioctl.h],,,
[[
#ifdef HAVE_WINDEF_H
#include <windef.h>
#endif
]])
2015-07-18 14:06:38 +02:00
AC_CHECK_HEADERS([w32api/winioctl.h],,,
[[
#ifdef HAVE_WINDEF_H
#include <windef.h>
#endif
]])
2007-10-29 22:38:52 +01:00
2008-10-06 20:20:45 +02:00
AC_CHECK_HEADERS([ext2fs/ext2_fs.h],,,
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
]])
AC_CHECK_HEADERS([ext2fs/ext2fs.h],,
2007-10-29 22:38:52 +01:00
use_ext2fs=no
2008-10-06 20:20:45 +02:00
AC_MSG_WARN(Disable use of ext2fs library),
[[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
]])
2009-02-03 09:23:02 +01:00
# libewf checks HAVE_OFF64_T, so defines it
AC_CHECK_TYPE(
[off64_t],
[AC_DEFINE( [HAVE_OFF64_T], [1], [Define to 1 if off64_t is available])],
2015-05-15 18:15:29 +02:00
[AC_DEFINE( [HAVE_OFF64_T], [0], [Define to 0 if off64_t is not available])])
2007-10-29 22:38:52 +01:00
AC_CHECK_HEADERS([libewf.h],,
use_ewf=no
AC_MSG_WARN(Disable use of ewf library))
2010-09-11 18:38:19 +02:00
AC_CHECK_HEADERS([jpeglib.h], use_jpeg_header=ok)
if test -z "${use_jpeg_header}"; then
use_jpeg=no
AC_MSG_WARN(Disable use of jpeg library)
fi
2007-10-29 22:38:52 +01:00
AC_CHECK_HEADERS([ntfs/attrib.h ntfs/volume.h],,
use_ntfs=no
AC_MSG_WARN(Disable use of ntfs library))
2011-04-06 09:08:26 +02:00
AC_CHECK_HEADERS([ntfs-3g/attrib.h ntfs-3g/volume.h],,
use_ntfs3g=no
AC_MSG_WARN(Disable use of ntfs3g library))
2007-10-29 22:38:52 +01:00
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_BIGENDIAN(,
[AC_DEFINE([TESTDISK_LSB], 1,
[Define to 1 if your processor stores words with the least significant
byte first (like Intel and VAX, unlike Motorola and SPARC).])]
,)
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLOCKS
AC_STRUCT_TM
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_CHECK_MEMBERS([dal_t.block_size],,,[#include <dal/dal.h>])
AC_CHECK_MEMBERS([dal_t.error],,,[#include <dal/dal.h>])
AC_CHECK_MEMBERS([dal_t.entity],,,[#include <dal/dal.h>])
AC_CHECK_MEMBERS([dal_t.name],,,[#include <dal/dal.h>])
AC_CHECK_MEMBERS([struct dal_ops.dev],,,[#include <dal/dal.h>])
2013-09-12 12:19:21 +02:00
AC_CHECK_MEMBERS([struct struct_io_manager.set_option,
struct struct_io_manager.read_blk64,
struct struct_io_manager.write_blk64],,,[
2008-10-06 20:20:45 +02:00
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_EXT2FS_EXT2_FS_H
#include <ext2fs/ext2_fs.h>
#endif
#ifdef HAVE_EXT2FS_EXT2FS_H
#include <ext2fs/ext2fs.h>
#endif
])
2007-10-29 22:38:52 +01:00
AC_CHECK_MEMBERS([struct tm.tm_gmtoff])
# Checks for library functions.
AC_PROG_GCC_TRADITIONAL
# As no alternate function is provided,
# these checks should not be used if we want to cross-compile the programs
#AC_FUNC_MEMCMP
#AC_FUNC_STAT
#AC_FUNC_VPRINTF
#AC_FUNC_MALLOC
# Checks for libraries.
2015-05-15 18:15:29 +02:00
if test "x$with_ncurses" != "xno"; then
2008-06-23 19:08:19 +02:00
AC_CHECK_LIB(ncursesw, initscr, [ ncurses_lib="ncursesw" ])
if test -z "${ncurses_lib}"; then
AC_CHECK_LIB( ncurses, initscr, [ ncurses_lib="ncurses" ])
fi
if test -z "${ncurses_lib}"; then
AC_CHECK_LIB(pdcurses, initscr, [ ncurses_lib="pdcurses" ])
fi
if test -z "${ncurses_lib}"; then
AC_CHECK_LIB(curses, initscr, [ ncurses_lib="curses" ])
fi
if test -z "${ncurses_lib}"; then
AC_MSG_ERROR(At least one of ncursesw/ncurses/pdcurses/curses library must be present)
fi
AC_DEFINE([HAVE_NCURSES],1,[Define to 1 if you have one of the ncursesw/ncurses/pdcurses/curses library.])
if test "${ncurses_lib_dir}" != "" -a -e "${ncurses_lib_dir}/lib${ncurses_lib}.a"; then
2009-01-14 22:19:06 +01:00
testdisk_LDADD="$testdisk_LDADD ${ncurses_lib_dir}/lib${ncurses_lib}.a"
photorec_LDADD="$photorec_LDADD ${ncurses_lib_dir}/lib${ncurses_lib}.a"
2008-06-23 19:08:19 +02:00
else
2009-01-14 22:19:06 +01:00
testdisk_LDADD="$testdisk_LDADD -l${ncurses_lib}"
photorec_LDADD="$photorec_LDADD -l${ncurses_lib}"
2008-06-23 19:08:19 +02:00
fi
2018-09-22 09:46:41 +02:00
if test "${ncurses_lib}" = "ncursesw"; then
AC_CHECK_LIB(tinfow,keypad, [ tinfo_lib="tinfow" ])
2018-09-22 11:58:24 +02:00
fi
if test -z "${tinfo_lib}"; then
2018-09-22 09:46:41 +02:00
AC_CHECK_LIB(tinfo,keypad, [ tinfo_lib="tinfo" ])
fi
if test "${tinfo_lib}" != ""; then
2008-06-23 19:08:19 +02:00
AC_DEFINE([HAVE_TINFO],1,[Define to 1 if you have the tinfo library (-ltinfo).])
2018-09-22 09:46:41 +02:00
# if lib${ncurses_lib}.a is present, try to use libtinfo.a
if test "${ncurses_lib_dir}" != "" -a -e "${ncurses_lib_dir}/lib${ncurses_lib}.a";
then
if test -e "${ncurses_lib_dir}/lib${tinfo_lib}.a"; then
testdisk_LDADD="$testdisk_LDADD ${ncurses_lib_dir}/lib${tinfo_lib}.a"
photorec_LDADD="$photorec_LDADD ${ncurses_lib_dir}/lib${tinfo_lib}.a"
fi
else
testdisk_LDADD="$testdisk_LDADD -l${tinfo_lib}"
photorec_LDADD="$photorec_LDADD -l${tinfo_lib}"
2008-06-23 19:08:19 +02:00
fi
fi
2010-09-11 18:53:59 +02:00
if test "$use_ncmouse" = "true";
then
ac_save_LIBS="$LIBS"
LIBS="$LIBS $photorec_LDADD"
AC_CHECK_FUNCS(mousemask)
LIBS="$ac_save_LIBS"
if test "$ac_cv_func_mousemask" = "yes";
then
AC_DEFINE([ENABLE_MOUSE],1,[Define to 1 if the ncurses mouse interface is enabled])
fi
fi
2013-10-20 12:26:19 +02:00
ac_save_LIBS="$LIBS"
LIBS="$LIBS $photorec_LDADD"
AC_CHECK_FUNCS([assume_default_colors])
LIBS="$ac_save_LIBS"
2007-10-29 22:38:52 +01:00
else
AC_MSG_WARN(Use of ncurses library disabled)
fi
2015-05-15 18:15:29 +02:00
if test "x$use_ext2fs" != "xno"; then
if test "x$with_ext2fs" != "xno"; then
2008-06-23 19:08:19 +02:00
AC_CHECK_LIB(com_err,com_err,[
2008-10-06 20:20:45 +02:00
AC_DEFINE([HAVE_LIBCOMM_ERR],1,[Define to 1 if you have the com_err library (-lcom_err).])
2007-12-28 18:41:22 +01:00
if test "${com_err_lib_a}" = ""; then
2016-08-16 20:19:18 +02:00
LIBS="-lcom_err $LIBS"
2007-12-28 18:41:22 +01:00
else
2016-08-16 20:19:18 +02:00
LIBS="${com_err_lib_a} $LIBS"
2007-12-28 18:41:22 +01:00
fi
2015-05-15 18:15:29 +02:00
have_com_err=yes
2008-10-06 20:20:45 +02:00
], AC_MSG_WARN(No com_err library detected))
2016-08-16 20:19:18 +02:00
AC_CHECK_LIB(ext2fs,ext2fs_open,[
AC_DEFINE([HAVE_LIBEXT2FS],1,[Define to 1 if you have the ext2fs library (-lext2fs).])
if test "${ext2fs_lib_a}" = ""; then
LIBS="-lext2fs $LIBS"
else
LIBS="${ext2fs_lib_a} $LIBS"
fi
have_ext2fs=yes
],AC_MSG_WARN(No ext2fs library detected))
2008-02-10 19:57:03 +01:00
AC_CHECK_FUNCS([ext2fs_get_generic_bitmap_start])
2007-10-29 22:38:52 +01:00
else
AC_MSG_WARN(Use of ext2fs library disabled)
fi
2015-05-15 18:15:29 +02:00
fi
2007-10-29 22:38:52 +01:00
2015-05-15 18:15:29 +02:00
if test "x$have_ext2fs" != "xyes"; then
if test "x$with_ext2fs" = "xyes"; then
AC_MSG_ERROR([ext2fs requested but not found])
fi
fi
if test "x$use_jpeg" != "xno"; then
if test "x$with_jpeg" != "xno"; then
2007-10-29 22:38:52 +01:00
AC_CHECK_LIB(jpeg,jpeg_std_error,[
AC_DEFINE([HAVE_LIBJPEG],1,[Define to 1 if you have the jpeg library (-ljpeg).])
if test "${jpeg_lib_a}" = ""; then
photorec_LDADD="$photorec_LDADD -ljpeg"
2009-01-14 22:19:06 +01:00
qphotorec_LDADD="$qphotorec_LDADD -ljpeg"
2009-01-18 15:05:04 +01:00
fidentify_LDADD="$fidentify_LDADD -ljpeg"
2007-10-29 22:38:52 +01:00
else
photorec_LDADD="$photorec_LDADD ${jpeg_lib_a}"
2009-01-14 22:19:06 +01:00
qphotorec_LDADD="$qphotorec_LDADD ${jpeg_lib_a}"
2018-03-17 13:33:04 +01:00
fidentify_LDADD="$fidentify_LDADD ${jpeg_lib_a}"
2007-10-29 22:38:52 +01:00
fi
2015-05-15 18:15:29 +02:00
have_jpeg=yes
2007-10-29 22:38:52 +01:00
],AC_MSG_WARN(No jpeg library detected))
# )
else
AC_MSG_WARN(Use of jpeg library disabled)
fi
2015-05-15 18:15:29 +02:00
fi
2007-10-29 22:38:52 +01:00
2015-05-15 18:15:29 +02:00
if test "x$have_jpeg" != "xyes"; then
if test "x$with_jpeg" = "xyes"; then
AC_MSG_ERROR([jpeg requested but not found])
fi
fi
if test "x$use_ntfs3g" != "xno"; then
if test "x$with_ntfs3g" != "xno"; then
2011-04-06 09:08:26 +02:00
AC_CHECK_LIB(ntfs-3g,ntfs_device_mount,
[
AC_DEFINE([HAVE_LIBNTFS3G],1,[Define to 1 if you have the ntfs3g library (-lntfs3g).])
if test "${ntfs3g_lib_a}" = ""; then
LIBS="-lntfs-3g $LIBS"
else
LIBS="${ntfs3g_lib_a} $LIBS"
fi
2015-05-15 18:15:29 +02:00
have_ntfs3g=yes
2011-04-06 09:08:26 +02:00
use_ntfs=no
],
AC_MSG_WARN(No ntfs-3g library detected)
)
else
AC_MSG_WARN(Use of ntfs3g library disabled)
fi
2015-05-15 18:15:29 +02:00
fi
2011-04-06 09:08:26 +02:00
2015-05-15 18:15:29 +02:00
if test "x$have_ntfs-3g" != "xyes"; then
if test "x$with_ntfs-3g" = "xyes"; then
AC_MSG_ERROR([ntfs-3g requested but not found])
fi
fi
if test "x$use_ntfs" != "xno"; then
if test "x$with_ntfs" != "xno"; then
2007-10-29 22:38:52 +01:00
AC_CHECK_LIB(ntfs,ntfs_device_mount,
[
AC_DEFINE([HAVE_LIBNTFS],1,[Define to 1 if you have the ntfs library (-lntfs).])
if test "${ntfs_lib_a}" = ""; then
LIBS="-lntfs $LIBS"
else
LIBS="${ntfs_lib_a} $LIBS"
fi
2015-05-15 18:15:29 +02:00
have_ntfs=yes
2007-10-29 22:38:52 +01:00
],
AC_CHECK_LIB(ntfs,ntfs_libntfs_version,
[
AC_DEFINE([HAVE_LIBNTFS],1,[Define to 1 if you have the ntfs library (-lntfs).])
if test "${ntfs_lib_a}" = ""; then
2016-08-16 20:19:18 +02:00
LIBS="-lntfs $LIBS"
2007-10-29 22:38:52 +01:00
else
2016-08-16 20:19:18 +02:00
LIBS="${ntfs_lib_a} $LIBS"
2007-10-29 22:38:52 +01:00
fi
2015-05-15 18:15:29 +02:00
have_ntfs=yes
2007-10-29 22:38:52 +01:00
],AC_MSG_WARN(No ntfs library detected))
)
else
AC_MSG_WARN(Use of ntfs library disabled)
fi
2015-05-15 18:15:29 +02:00
fi
if test "x$have_ntfs" != "xyes"; then
if test "x$with_ntfs" = "xyes"; then
AC_MSG_ERROR([ntfs requested but not found])
fi
fi
2007-10-29 22:38:52 +01:00
2011-10-17 07:59:33 +02:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_LIBNTFS
#include <ntfs/volume.h>
#include <ntfs/attrib.h>
#endif
#ifdef HAVE_LIBNTFS3G
#include <ntfs-3g/volume.h>
#include <ntfs-3g/attrib.h>
#endif
]],
[[ ntfs_mbstoucs(NULL,NULL); ]])],
[ac_cv_c_ntfs_mbstoucs_have_two_arguments=yes],
[ac_cv_c_ntfs_mbstoucs_have_two_arguments=no])
if test "${ac_cv_c_ntfs_mbstoucs_have_two_arguments}" != "no"; then
AC_DEFINE([NTFS_MBSTOUCS_HAVE_TWO_ARGUMENTS], 1, [Define if ntfs_mbstoucs takes two parameters.])
fi
2015-05-15 18:15:29 +02:00
if test "x$use_reiserfs" != "xno"; then
if test "x$with_reiserfs" != "xno"; then
2007-10-29 22:38:52 +01:00
AC_CHECK_LIB(reiserfs,libreiserfs_get_version,[
AC_DEFINE([HAVE_LIBREISERFS],1,[Define to 1 if you have the reiserfs library (-lreiserfs).])
if test "${reiserfs_lib_a}" = ""; then
testdisk_LDADD="$testdisk_LDADD -lreiserfs"
else
testdisk_LDADD="$testdisk_LDADD ${reiserfs_lib_a}"
fi
2015-05-15 18:15:29 +02:00
have_reiserfs=yes
2007-10-29 22:38:52 +01:00
],AC_MSG_WARN(No reiserfs library detected),[-ldal])
else
AC_MSG_WARN(Use of reiserfs library disabled)
fi
2015-05-15 18:15:29 +02:00
fi
2008-08-25 23:12:49 +02:00
2015-05-15 18:15:29 +02:00
if test "x$have_reiserfs" != "xyes"; then
if test "x$with_reiserfs" = "xyes"; then
AC_MSG_ERROR([reiserfs requested but not found])
fi
fi
2008-08-25 23:12:49 +02:00
2008-05-18 23:58:29 +02:00
# Check for UUID functions
AC_CHECK_HEADERS([sys/uuid.h uuid/uuid.h uuid.h])
found_uuid_function=yes
AC_CHECK_FUNCS([uuidgen],,[found_uuid_function=no])
2015-05-15 18:15:29 +02:00
if test "x$with_uuid" != "xno"; then
2014-03-16 19:22:19 +01:00
if test "${found_uuid_function}" = "no";
then
found_uuid_function=yes
AC_SEARCH_LIBS(uuid_generate, uuid, , [ found_uuid_function=no ])
fi
2007-10-29 22:38:52 +01:00
2014-03-16 19:22:19 +01:00
if test "${found_uuid_function}" = "no";
then
found_uuid_function=yes
AC_SEARCH_LIBS(uuid_create, uuid, , [found_uuid_function=no])
fi
2011-07-31 10:38:21 +02:00
fi
if test "${found_uuid_function}" = "yes";
then
AC_CHECK_FUNCS([uuid_create])
AC_CHECK_FUNCS([uuid_generate])
2008-05-18 23:58:29 +02:00
fi
if test "${found_uuid_function}" = "no";
then
if test "${missing_uuid_ok}" = "true";
then
AC_MSG_WARN(No uuid_create or uuid_generate function in library libuuid or uuidgen function present)
else
AC_MSG_ERROR(No uuid_create or uuid_generate function in library libuuid or uuidgen function present)
fi
fi
2007-10-29 22:38:52 +01:00
2015-05-15 18:15:29 +02:00
if test "x$use_zlib" != "xno"; then
if test "x$with_zlib" != "xno"; then
AC_CHECK_LIB(z, compress2, [
AC_DEFINE([HAVE_LIBZ],1,[Define to 1 if you have the z library (-lz).])
have_zlib=yes
LIBS="-lz $LIBS"
], AC_MSG_WARN(Missing function: compress2 in library zlib))
fi
fi
if test "x$have_zlib" != "xyes"; then
if test "x$with_zlib" = "xyes"; then
AC_MSG_ERROR([zlib requested but not found])
fi
2014-03-16 19:22:19 +01:00
fi
2008-05-18 23:58:29 +02:00
#
2015-05-15 18:15:29 +02:00
if test "x$use_ewf" != "xno"; then
if test "x$with_ewf" != "xno"; then
2007-10-29 22:38:52 +01:00
AC_CHECK_LIB(ewf,libewf_check_file_signature,[
AC_DEFINE([HAVE_LIBEWF],1,[Define to 1 if you have the ewf library (-lewf).])
if test "${ewf_lib_a}" = ""; then
LIBS="-lewf $LIBS"
else
LIBS="${ewf_lib_a} $LIBS"
fi
2015-05-15 18:15:29 +02:00
have_ewf=yes
2009-06-21 19:30:36 +02:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libewf.h>]],
[[ libewf_get_bytes_per_sector(NULL,NULL); ]])],
[ac_cv_c_libewf_get_bytes_per_sector_have_two_arguments=yes],
[ac_cv_c_libewf_get_bytes_per_sector_have_two_arguments=no])
2008-03-14 08:57:10 +01:00
if test "${ac_cv_c_libewf_get_bytes_per_sector_have_two_arguments}" != "no"; then
AC_DEFINE([LIBEWF_GET_BYTES_PER_SECTOR_HAVE_TWO_ARGUMENTS], 1, [Define if libewf_get_bytes_per_sector takes two parameters.])
fi
2009-06-21 19:30:36 +02:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libewf.h>]],
[[ libewf_get_media_size(NULL,NULL); ]])],
[ac_cv_c_libewf_get_media_size_have_two_arguments=yes],
[ac_cv_c_libewf_get_media_size_have_two_arguments=no])
2008-03-14 08:57:10 +01:00
if test "${ac_cv_c_libewf_get_media_size_have_two_arguments}" != "no"; then
AC_DEFINE([LIBEWF_GET_MEDIA_SIZE_HAVE_TWO_ARGUMENTS], 1, [Define if libewf_get_media_size takes two parameters.])
fi
2011-03-19 13:58:05 +01:00
AC_CHECK_TYPE(
[libewf_handle_t],
[AC_DEFINE( [HAVE_LIBEWF_HANDLE_T], [1], [Define to 1 if libewf_handle_t is available])],,
[#include <libewf.h>])
2007-10-29 22:38:52 +01:00
],[
AC_MSG_WARN(No ewf library detected)
],[])
else
AC_MSG_WARN(Use of ewf library disabled)
fi
2015-05-15 18:15:29 +02:00
fi
2007-10-29 22:38:52 +01:00
2015-05-15 18:15:29 +02:00
if test "x$have_ewf" != "xyes"; then
if test "x$with_ewf" = "xyes"; then
AC_MSG_ERROR([ewf requested but not found])
fi
fi
2013-05-19 11:05:58 +02:00
#-Wconversion -Wmissing-noreturn -ffunction-sections -Wl,--gc-sections -Wl,--print-gc-sections
2019-05-22 10:34:04 +02:00
for option in -Wdeclaration-after-statement -Wall -Wextra -MD -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wwrite-strings -W -Wcast-align -Waggregate-return -Wbad-function-cast -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wnested-externs -Winline -Wdisabled-optimization -Wfloat-equal -Wmissing-format-attribute -Wmultichar -Wc++-compat -Wformat=2 -Wunreachable-code -Wvla
2008-06-23 19:28:58 +02:00
do
2007-10-29 22:38:52 +01:00
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
2008-06-23 19:28:58 +02:00
AC_MSG_CHECKING([whether gcc understands $option])
2009-06-21 19:30:36 +02:00
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[has_option=yes],
[has_option=no; CFLAGS="$SAVE_CFLAGS"])
2008-06-23 19:28:58 +02:00
AC_MSG_RESULT($has_option)
2007-10-29 22:38:52 +01:00
unset has_option
unset SAVE_CFLAGS
2008-06-23 19:28:58 +02:00
done
unset option
2007-10-29 22:38:52 +01:00
2015-04-11 13:46:21 +02:00
AC_LANG_PUSH([C++])
2018-03-15 10:08:04 +01:00
for option in -Wall -MD -Wpointer-arith -Wmissing-declarations -Wshadow -Wwrite-strings -W -Wcast-align -Wcast-qual -Wundef -Wredundant-decls -Wsign-compare -Wdisabled-optimization -Wmissing-format-attribute -Wmultichar -Wformat=2 -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -Wvla
2012-05-18 21:08:25 +02:00
do
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $option"
AC_MSG_CHECKING([whether g++ understands $option])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[has_option=yes],
[has_option=no; CXXFLAGS="$SAVE_CXXFLAGS"])
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CXXFLAGS
done
unset option
2015-04-11 13:46:21 +02:00
AC_LANG_POP([C++])
2012-05-18 21:08:25 +02:00
2009-11-01 11:10:47 +01:00
#if defined __GNUC__ && !defined _FORTIFY_SOURCE
AC_DEFINE([_FORTIFY_SOURCE], 2, [enable compile-time and run-time bounds-checking, and some warnings])
#endif
2007-10-29 22:38:52 +01:00
case "$target" in
*hpux*)
;;
*)
2015-05-15 18:15:29 +02:00
AC_CHECK_FUNCS(pread)
2007-10-29 22:38:52 +01:00
;;
esac
2017-04-15 12:00:24 +02:00
AC_CHECK_FUNCS([ atexit atoll chdir chmod delscreen dirname dup2 execv fdatasync fseeko fsync ftello ftruncate getcwd geteuid getpwuid libewf_handle_read_buffer_at_offset libewf_handle_write_buffer_at_offset localtime_r lstat memalign memchr memset mkdir posix_fadvise posix_memalign pwrite readlink setenv setlocale sigaction signal sleep snprintf strcasecmp strcasestr strchr strdup strerror strncasecmp strptime strrchr strstr strtol strtoul strtoull touchwin uname utime vsnprintf wctomb ])
2007-11-28 22:42:36 +01:00
if test "$ac_cv_func_mkdir" = "no"; then
2007-11-16 09:07:02 +01:00
AC_MSG_ERROR(No mkdir function detected)
fi
2007-11-28 22:42:36 +01:00
2008-04-02 23:47:50 +02:00
if test "$ac_cv_func_execv" = "yes" -a "$use_sudo" = "true";
2007-11-28 22:42:36 +01:00
then
if test -z "$SUDO_BIN"; then
AC_PATH_PROG([SUDO], [sudo], [AC_MSG_ERROR([sudo requested but not found])])
SUDO_BIN="$SUDO"
fi
AC_DEFINE_UNQUOTED([SUDO_BIN], "$SUDO_BIN", [Path to sudo for privileged operations])
fi
2014-03-29 11:22:29 +01:00
if test "$use_assert" = "false";
then
AC_DEFINE(NDEBUG, 1, [Disable the assert error checking])
fi
2007-10-29 22:38:52 +01:00
#reiserfs_fs_open_fast may not been detected because of lack of -ldal
OLDLIBS="$LIBS"
2007-11-28 22:42:36 +01:00
LIBS="$OLDLIBS $testdisk_LDADD -ldal"
2007-10-29 22:38:52 +01:00
AC_CHECK_FUNCS([reiserfs_fs_open_fast])
LIBS="$OLDLIBS"
2007-11-28 22:42:36 +01:00
AC_CHECK_FUNCS([ntfs_libntfs_version ntfs_volume_startup])
2007-10-29 22:38:52 +01:00
2016-11-13 18:29:40 +01:00
export QT_SELECT=qt5
2009-01-14 22:19:06 +01:00
if test "$use_qt" = "true";
then
2018-06-29 13:05:30 +02:00
PKG_CHECK_MODULES(QT5GUI, [Qt5Gui >= 5.0.0],,use_qt=false)
PKG_CHECK_MODULES(QT5WIDGETS, [Qt5Widgets >= 5.0.0],,use_qt=false)
AC_MSG_CHECKING([whether Qt5 is using --std=c++14])
qt_config=`$PKG_CONFIG --variable=qt_config Qt5Core | grep "c++14"`
if test "x$qt_config" != "x" ;
then
AC_MSG_RESULT([[yes]])
2018-09-22 11:58:24 +02:00
AC_LANG_PUSH([C++])
option="--std=c++14"
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $option"
AC_MSG_CHECKING([whether g++ understands $option])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[has_option=yes],
[has_option=no; CXXFLAGS="$SAVE_CXXFLAGS"])
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CXXFLAGS
unset option
AC_LANG_POP([C++])
2018-06-29 13:05:30 +02:00
else
AC_MSG_RESULT([[no]])
AC_MSG_CHECKING([whether Qt5 is using --std=c++11])
qt_config=`$PKG_CONFIG --variable=qt_config Qt5Core | grep "c++11"`
if test "x$qt_config" != "x" ;
then
AC_MSG_RESULT([[yes]])
2018-09-22 11:58:24 +02:00
AC_LANG_PUSH([C++])
option="--std=c++11"
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $option"
AC_MSG_CHECKING([whether g++ understands $option])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[has_option=yes],
[has_option=no; CXXFLAGS="$SAVE_CXXFLAGS"])
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CXXFLAGS
unset option
AC_LANG_POP([C++])
2018-06-29 13:05:30 +02:00
else
AC_MSG_RESULT([[no]])
fi
fi
2016-02-22 10:14:22 +01:00
AC_CHECK_TOOLS(MOC,[moc-qt5 moc],)
2012-06-09 15:35:56 +02:00
if test x$MOC = x ; then
2016-02-22 10:14:22 +01:00
AC_MSG_WARN(Could not find a moc-qt5 or moc tool in your PATH.)
2013-10-20 12:26:19 +02:00
use_qt=false
2015-05-15 18:15:29 +02:00
fi
2016-02-22 10:14:22 +01:00
AC_CHECK_TOOLS(RCC,[rcc-qt5 rcc],)
2013-05-15 18:24:10 +02:00
if test x$RCC = x ; then
2016-02-22 10:14:22 +01:00
AC_MSG_WARN(Could not find a rcc-qt5 or rcc tool in your PATH.)
2013-10-20 12:26:19 +02:00
use_qt=false
2015-05-15 18:15:29 +02:00
fi
2016-04-09 17:06:23 +02:00
AC_CHECK_TOOLS(LRELEASE,[lrelease-qt5 lrelease],)
if test x$LRELEASE = x ; then
AC_MSG_WARN(Could not find a lrelease-qt5 or lrelease tool in your PATH.)
use_qt=false
fi
2018-06-29 13:05:30 +02:00
qphotorec_LDADD="$qphotorec_LDADD $QT5GUI_LIBS $QT5WIDGETS_LIBS"
qphotorec_CXXFLAGS="$qphotorec_CXXFLAGS $QT5GUI_CFLAGS $QT5WIDGETS_CFLAGS"
2009-01-14 22:19:06 +01:00
fi
2014-10-28 11:35:34 +01:00
AM_CONDITIONAL(USEQT, test "$use_qt" = true)
2014-11-02 15:22:45 +01:00
if test "$win_target" = yes;
then
qphotorec_LDADD="$qphotorec_LDADD -mwindows"
fi
2009-01-14 22:19:06 +01:00
2009-01-04 19:37:13 +01:00
# e2fsprogs may be using pthread
# checks for pthreads
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -static"
ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
CFLAGS="$SAVE_CFLAGS"
2015-04-11 13:47:31 +02:00
# If using stack protection, try -fstack-protector-strong, if not try to fallback to -fstack-protector-all
2016-04-10 19:16:16 +02:00
if test $stackProtector = 1;
then
AC_MSG_CHECKING([whether stack protection works with gcc])
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$SAVE_CFLAGS -fstack-protector-strong"
AC_COMPILE_IFELSE(
2015-04-11 13:47:31 +02:00
[AC_LANG_PROGRAM([])],
[has_option=yes],
[CFLAGS="$SAVE_CFLAGS -fstack-protector-all"]
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([])],
[has_option=yes],
[has_option=no; CFLAGS="$SAVE_CFLAGS"]
[AC_MSG_WARN([Cannot configure with stack protection])]
)]
2016-04-10 19:16:16 +02:00
)
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CFLAGS
fi
if test $stackProtector = 1;
then
AC_MSG_CHECKING([whether stack protection works with g++])
AC_LANG_PUSH([C++])
SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$SAVE_CXXFLAGS -fstack-protector-strong"
AC_COMPILE_IFELSE(
2015-04-11 13:47:31 +02:00
[AC_LANG_PROGRAM([])],
[has_option=yes],
[CXXFLAGS="$SAVE_CXXFLAGS -fstack-protector-all"]
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([])],
[has_option=yes],
[has_option=no]
[CXXFLAGS="$SAVE_CXXFLAGS"]
[AC_MSG_WARN([Cannot configure with stack protection])]
)]
2016-04-10 19:16:16 +02:00
)
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CXXFLAGS
AC_LANG_POP([C++])
fi
2015-04-11 13:47:31 +02:00
2010-04-27 09:11:27 +02:00
photorecf_LDADD=$photorec_LDADD
2018-12-08 08:33:30 +01:00
fuzzerfidentify_LDADD="-fsanitize=fuzzer $fidentify_LDADD"
2012-12-23 16:56:17 +01:00
CFLAGS="$CFLAGS $coverage_flags"
2014-03-16 09:49:28 +01:00
CXXFLAGS="$CXXFLAGS $coverage_flags"
CPPFLAGS="$CPPFLAGS $coverage_flags"
2007-10-29 22:38:52 +01:00
AC_SUBST(CFLAGS)
2009-01-14 22:19:06 +01:00
AC_SUBST(CXXFLAGS)
2007-10-29 22:38:52 +01:00
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
2012-05-21 08:41:50 +02:00
AC_SUBST(MOC)
2016-04-09 17:06:23 +02:00
AC_SUBST(LRELEASE)
2016-11-13 18:29:40 +01:00
AC_SUBST(QT_SELECT)
2012-06-18 23:00:12 +02:00
AC_SUBST(fidentify_LDADD)
2018-12-08 08:33:30 +01:00
AC_SUBST(fuzzerfidentify_LDADD)
2007-10-29 22:38:52 +01:00
AC_SUBST(testdisk_LDADD)
AC_SUBST(photorec_LDADD)
2010-04-27 09:11:27 +02:00
AC_SUBST(photorecf_LDADD)
2009-01-14 22:19:06 +01:00
AC_SUBST(qphotorec_LDADD)
2012-06-18 23:00:12 +02:00
AC_SUBST(qphotorec_CXXFLAGS)
2014-10-12 16:51:07 +02:00
AC_CONFIG_FILES([
Makefile
2014-11-02 15:50:08 +01:00
icons/Makefile
2014-10-12 16:51:07 +02:00
src/Makefile
man/Makefile
2014-11-02 15:28:43 +01:00
man/testdisk.8 man/photorec.8 man/qphotorec.8 man/fidentify.8
2014-10-12 16:51:07 +02:00
man/zh_CN/Makefile
2014-11-02 15:28:43 +01:00
man/zh_CN/testdisk.8 man/zh_CN/photorec.8 man/zh_CN/qphotorec.8 man/zh_CN/fidentify.8
2014-10-12 16:51:07 +02:00
linux/testdisk.spec
])
2007-10-29 22:38:52 +01:00
AC_OUTPUT