File: configure.ac

package info (click to toggle)
libb2 0.98.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,304 kB
  • sloc: ansic: 19,855; makefile: 128; sh: 13
file content (95 lines) | stat: -rw-r--r-- 2,927 bytes parent folder | download | duplicates (2)
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
AC_PREREQ([2.61])
AC_INIT([libb2], [0.98.1], [contact@blake2.net], [libb2], [https://blake2.net])
AC_CONFIG_SRCDIR([src/blake2b.c])
AC_CONFIG_HEADERS([src/config.h])
AM_INIT_AUTOMAKE([foreign 1.9])
AC_CONFIG_MACRO_DIR([m4])

B2_LIBRARY_VERSION=1:4:0 # interface, revision, age
AC_SUBST(B2_LIBRARY_VERSION)

AC_LANG_C
AC_PROG_CC
AC_PROG_CC_C99

AC_CHECK_FUNCS(explicit_bzero)
AC_CHECK_FUNCS(explicit_memset)
AC_CHECK_FUNCS(memset_s)
AC_CHECK_HEADERS([stddef.h stdint.h stdlib.h string.h])
AC_OPENMP
# AX_FORCEINLINE()
AC_C_BIGENDIAN(
	[],
	AC_DEFINE(NATIVE_LITTLE_ENDIAN, 1, [machine is little-endian]),
	AC_MSG_ERROR(unknown endianness),
	AC_MSG_ERROR(universal endianness not supported)
) 

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_CHECK_FUNCS([memset])

dnl AM_PROG_AR 
AC_PROG_LIBTOOL
dnl LT_INIT


AC_ARG_ENABLE(fat,
AC_HELP_STRING([--enable-fat],
               [build a fat binary on systems that support it [default=no]]),
               [case $enableval in
                  yes|no) ;;
                  *) AC_MSG_ERROR([bad value $enableval for --enable-fat, need yes or no]) ;;
                esac],
               [enable_fat=no]
)

AC_ARG_ENABLE(native,
AC_HELP_STRING([--enable-native],
               [build a binary optimized for the CPU found at compile time on systems that support it [default=yes]]),
               [case $enableval in
                  yes|no) ;;
                  *) AC_MSG_ERROR([bad value $enableval for --enable-native, need yes or no]) ;;
                esac],
               [enable_native=yes]
)

AX_CHECK_COMPILE_FLAG([-O3], [CFLAGS="$CFLAGS -O3"])
dnl Not all architectures support -march=native
if test $enable_native == "yes"; then
  AX_CHECK_COMPILE_FLAG([-march=native], [], [enable_native=no])
fi

if test $enable_fat == "yes"; then
  dnl Fat build needs compiler who knows all the possible instruction sets
  AX_CHECK_COMPILE_FLAG([-msse2],   [], AC_MSG_ERROR([Compiler does not know -msse2.]))
  AX_CHECK_COMPILE_FLAG([-mssse3],  [], AC_MSG_ERROR([Compiler does not know -mssse3.]))
  AX_CHECK_COMPILE_FLAG([-msse4.1], [], AC_MSG_ERROR([Compiler does not know -msse4.1.]))
  AX_CHECK_COMPILE_FLAG([-mavx],    [], AC_MSG_ERROR([Compiler does not know -mavx.]))
  AX_CHECK_COMPILE_FLAG([-mxop],    [], AC_MSG_ERROR([Compiler does not know -mxop.]))
elif test $enable_native == "yes"; then
  AX_EXT
  CFLAGS="${CFLAGS} -march=native ${SIMD_FLAGS}"
fi

case $host_os in
	*mingw*) LDFLAGS="${LDFLAGS} -no-undefined" ;;
esac

AM_CONDITIONAL([USE_FAT], [test "$enable_fat" = "yes"])
dnl Only move away from ref with SSSE3; SSE2 is generally slower
AM_CONDITIONAL([USE_SSE], [test "$ax_cv_have_ssse3_ext" = "yes"])


PKG_INSTALLDIR
AC_CONFIG_FILES([Makefile
                 src/Makefile
                 libb2.pc
                 ])
AC_OUTPUT