-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
79 lines (66 loc) · 1.79 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
AC_INIT(libexpreval, version-0.9.2)
AM_INIT_AUTOMAKE([subdir-objects])
AC_PREFIX_DEFAULT(/usr)
AC_PROG_RANLIB
dnl AC_MSG_NOTICE([Hello, world.])
AC_LANG(C)
AC_PROG_CC
AC_ARG_ENABLE([shared],
AS_HELP_STRING([[[--enable-shared]]],
[Compile shared library]),
shared="yes",
shared="no")
AM_CONDITIONAL(MAKE_SHARED_LIBRARY, test "$shared" = "yes")
AC_PROG_AWK
AC_PROG_SED
AC_CHECK_FUNCS([pow])
AC_CHECK_FUNCS([sqrt])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strndup])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([sys/time.h])
AC_SEARCH_LIBS([pow], [m], [], [
AC_MSG_ERROR([Unable to find standard math library])
])
if test "$host" = ""; then
arch=$(uname -m | $AWK '{print tolower($0)}')
os=$(uname -s | $AWK '{print tolower($0)}')
else
arch=$(echo $host | $AWK '{print $1}' FS=-)
os=$(echo $host | $AWK '{print $(NF-1)}' FS=-)
fi;
if test "$arch" = "i386"; then
arch="i686";
elif test "$arch" = "i486"; then
arch="i686";
elif test "$arch" = "i586"; then
arch="i686";
fi;
# Supported OSs
if test "$os" = "mingw32"; then
os="win"; # TODO win port
AC_SUBST(SHARED_EXTENSION, "dll")
elif test "$os" = "linux"; then
AC_SUBST(SHARED_EXTENSION, "so")
else
AC_MSG_ERROR([Unsupported os $os])
fi;
AC_SUBST(OS, $os)
AC_SUBST(ARCH, $arch)
# Supported architectures
if ! echo "i686 x86_64 aarch64" | $GREP -w $arch > /dev/null; then
AC_MSG_ERROR([Architecture $arch is not supported])
fi;
if echo "i686 x86_64" | $GREP -w $arch > /dev/null; then
AC_CHECK_PROG(HAVE_NASM, nasm, yes, no)
dnl AC_MSG_RESULT($HAVE_NASM)
if test "$HAVE_NASM" = "no"; then
AC_MSG_ERROR([nasm not found])
fi;
AC_SUBST(AS, nasm)
fi;
AM_CONDITIONAL(ARCH_i686, test "$arch" = "i686")
AM_CONDITIONAL(ARCH_x86_64, test "$arch" = "x86_64")
AM_CONDITIONAL(ARCH_AARCH64, test "$arch" = "aarch64")
AC_OUTPUT(Makefile)
dnl Anna