This repository has been archived by the owner on Feb 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
84 lines (69 loc) · 3.42 KB
/
configure.ac
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
AC_PREREQ([2.69])
AC_INIT([modern-rzip], [v0.9], [[email protected]])
AC_COPYRIGHT([Copyright (C) Kamila Szewczyk, 2022. Licensed under the terms of GPLv2 license.])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux])
AC_PROG_STRIP
AC_LANG([C])
AC_PROG_CC
if test -f ".version"; then
FULLVER=`sed -n '1p' < .version`
MRZIP_MAJOR=`sed -n '2p' < .version`
MRZIP_MINOR=`sed -n '3p' < .version`
MRZIP_PATCH=`sed -n '4p' < .version`
VERSION="-DMRZIP_MAJOR=$MRZIP_MAJOR -DMRZIP_MINOR=$MRZIP_MINOR -DMRZIP_PATCH=$MRZIP_PATCH"
AC_SUBST([VERSION])
AC_SUBST([FULLVER])
else
MRZIP_MAJOR=`git describe --tags --abbrev=0 | sed 's/v//' | cut -d. -f1`
MRZIP_MINOR=`git describe --tags --abbrev=0 | sed 's/v//' | cut -d. -f2`
MRZIP_PATCH=`git describe --tags --abbrev=0 | sed 's/v//' | cut -d. -f3`
FULLVER=`git describe --tags --abbrev=0 | sed 's/v//'`
VERSION="-DMRZIP_MAJOR=$MRZIP_MAJOR -DMRZIP_MINOR=$MRZIP_MINOR -DMRZIP_PATCH=$MRZIP_PATCH"
AC_SUBST([VERSION])
AC_SUBST([FULLVER])
fi
AC_CHECK_HEADER([windows.h], [AC_SUBST([WINDOWS], [1])], [AC_SUBST([WINDOWS], [0])])
AX_CHECK_COMPILE_FLAG([-msse2],
[CFLAGS="$CFLAGS -msse2"; AC_SUBST([ASOBJ], ["vendor/zstd/lib/decompress/huf_decompress_amd64.o"])],
[CFLAGS="$CFLAGS -DNOJIT -DZSTD_DISABLE_ASM"; AC_SUBST([ASOBJ], [])], [-Werror -Wall -Wextra])
AC_CHECK_SIZEOF(long long)
AS_IF([test $ac_cv_sizeof_long_long = 4], AC_MSG_ERROR([32-bit machines are not supported.]))
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([libpthread missing.]))
AC_CHECK_LIB(gcrypt, gcry_md_open, , AC_MSG_ERROR([libgcrypt-dev missing.]))
AC_CHECK_LIB(m, sqrt, , AC_MSG_ERROR([libm missing.]))
AC_CHECK_LIB(gpg-error, gpg_err_code_to_errno, , AC_MSG_ERROR([libgpg-error-dev missing.]))
AC_CHECK_LIB(intl, libintl_gettext, [AC_SUBST([LIBINTL], [-lintl])], [AC_SUBST([LIBINTL], [])])
AC_CHECK_LIB(iconv, libiconv, [AC_SUBST([LIBICONV], [-liconv])], [AC_SUBST([LIBICONV], [])])
AC_CHECK_FUNC([ffsll], [], [CFLAGS="$CFLAGS -DNO_FFSLL"])
AC_LANG([C++])
AC_PROG_CXX
AX_CHECK_COMPILE_FLAG([-msse2], [CXXFLAGS="$CXXFLAGS -msse2"], [CXXFLAGS="$CXXFLAGS -DNOJIT -DZSTD_DISABLE_ASM"], [-Werror -Wall -Wextra])
AX_CXX_COMPILE_STDCXX([17], [ext], [])
AC_ARG_ENABLE([lto], [AS_HELP_STRING([--enable-lto], [Enable link-time optimization])], [CFLAGS="$CFLAGS -flto"; CXXFLAGS="$CXXFLAGS -flto"], [])
AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static], [Enable static build])], [CFLAGS="$CFLAGS -static"; CXXFLAGS="$CXXFLAGS -static"], [])
AC_CONFIG_FILES([Makefile common.mk])
AC_OUTPUT
if test -f ".version"; then
echo
echo
echo "------------------------------------------------------------------------"
echo "MODERN-RZIP $MRZIP_MAJOR.$MRZIP_MINOR.$MRZIP_PATCH CONFIGURATION SUMMARY"
echo "------------------------------------------------------------------------"
else
GITVER=`git describe --tags --abbrev=0`
echo
echo
echo "------------------------------------------------------------------------"
echo "MODERN-RZIP $MRZIP_MAJOR.$MRZIP_MINOR.$MRZIP_PATCH ($GITVER) CONFIGURATION SUMMARY"
echo "------------------------------------------------------------------------"
fi
echo
echo "Compilation............: make (or gmake)"
echo " CFLAGS...............: $CFLAGS"
echo " CXXFLAGS.............: $CXXFLAGS"
echo " CC...................: $CC"
echo " CXX..................: $CXX"
echo " STRIP................: $STRIP"
echo " WINDOWS..............: $WINDOWS"
echo " VERSION..............: $VERSION"