forked from jburguete/mpcotool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
68 lines (59 loc) · 1.5 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
# To compile on UNIX systems:
# aclocal
# autoconf
# ./configure
# make
AC_PREREQ([2.69])
AC_INIT([calibrator], [0.0.15], [BUG-REPORT-ADDRESS])
# Checks for programs.
AC_PROG_CC(mpicc, egcc, gcc, clang)
AC_MSG_NOTICE([Compiler: $CC])
AC_PROG_MAKE_SET
AC_LANG([C])
PKG_PROG_PKG_CONFIG
# Checks for libraries.
AC_SEARCH_LIBS([sqrt], [m])
PKG_CHECK_MODULES([GSL], [gsl])
PKG_CHECK_MODULES([XML], [libxml-2.0])
PKG_CHECK_MODULES([GTHREAD], [gthread-2.0])
PKG_CHECK_MODULES([GLIB], [glib-2.0])
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])
# Checking MPI
if test $CC == "mpicc"; then
AC_SUBST(MPIDEFINE, "-DHAVE_MPI")
AC_MSG_NOTICE([Found MPI compiler])
fi
# Checking -march=native compiler flag
compiler=$CC
CC="$CC -march=native"
AC_TRY_LINK([],
[int main(int argc, char **argv){return 0;}], [arch=1], [arch=0])
CC=$compiler
if test $arch == 0; then
AC_MSG_NOTICE([checking for -march=native... no])
AC_SUBST(ARCH, "")
else
AC_MSG_NOTICE([checking for -march=native... yes])
AC_SUBST(ARCH, "-march=native")
fi
# Checking -flto compiler flag
compiler=$CC
CC="$CC -flto"
AC_TRY_LINK([], [int main(int argc, char **argv){return 0;}], [lto=1], [lto=0])
CC=$compiler
if test $lto == 0; then
AC_MSG_NOTICE([checking for -flto... no])
AC_SUBST(LTO, "")
else
AC_MSG_NOTICE([checking for -flto... yes])
AC_SUBST(LTO, "-flto")
fi
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([strtoul])
# Final output
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT