-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
157 lines (109 loc) · 3.26 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
### configure.ac -- Autoconf configuration script
#
# Copyright 2016-2017 ChemicalDevelopment
#
# This file is part of the STEMprime project
#
# STEMprime source code, as well as any other resources in this project are
# free software; you are free to redistribute it and/or modify them under
# the terms of the GNU General Public License; either version 3 of the
# license, or any later version.
#
# These programs are hopefully useful and reliable, but it is understood
# that these are provided WITHOUT ANY WARRANTY, or MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GPLv3 or email at
# <[email protected]> for more info on this.
#
# Here is a copy of the GPL v3, which this software is licensed under. You
# can also find a copy at http://www.gnu.org/licenses/.
###
AC_PREREQ([2.55])
AC_INIT([STEMprime], [0.1.0], [[email protected]])
AM_INIT_AUTOMAKE()
AC_CONFIG_SRCDIR([src/stemprime.h])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h stdio.h stdbool.h string.h math.h sys/time.h time.h unistd.h])
# Checks for libraries.
AC_CHECK_LIB(m, log)
# these are all required
LIBS="-lcargs -lgmp -lm $LIBS"
# mpi for titan supercomputer
AC_ARG_WITH(
mpi,
AS_HELP_STRING([--with-mpi],
[Provide cargs directory]), [
case "$with_mpi" in
yes)
withval=/usr/local
;;
esac
LDFLAGS="$LDFLAGS -L$withval/lib"
CFLAGS="$CFLAGS -I$withval/include"
AC_DEFINE([USE_MPI], [], [Use MPI])
AC_MSG_CHECKING(mpi)
AC_MSG_RESULT(yes ($withval))
], [ ])
# cargs is required
AC_ARG_WITH(
cargs,
AS_HELP_STRING([--with-cargs],
[Provide cargs directory]), [
case "$with_cargs" in
yes)
withval=/usr/local
;;
esac
LDFLAGS="$LDFLAGS -L$withval/lib"
CFLAGS="$CFLAGS -I$withval/include"
AC_MSG_CHECKING(cargs)
AC_MSG_RESULT(yes ($withval))
], [ ])
AC_CHECK_HEADER(cargs.h, [], [
AC_MSG_ERROR(cargs header not found (looking for cargs.h))
])
AC_CHECK_LIB(cargs, cargs_init)
# GMP can be supplied to use multiprecision support
AC_ARG_WITH(
gmp,
AS_HELP_STRING([--with-gmp],
[Use GMP for multiprecision]), [
case "$with_gmp" in
yes)
withval=/usr/local
;;
esac
LDFLAGS="$LDFLAGS -L$withval/lib"
CFLAGS="$CFLAGS -I$withval/include"
AC_CHECK_HEADER(gmp.h, [], [
AC_MSG_ERROR(GMP header not found (looking for gmp.h))
])
AC_MSG_CHECKING(GMP)
AC_MSG_RESULT(yes ($withval))
AC_DEFINE([USE_GMP], [1], [Use GMP library code])
], [ ])
AH_TEMPLATE(USE_GMP,[GMP support is available])
AC_DEFINE([MAX_ITI], [60], [Maximum internal time interval (in s)])
AC_MSG_CHECKING("whether timeval should be used")
AC_TRY_RUN([
#include <time.h>
#include <sys/time.h>
int main() { struct timeval x; return 0; }
], [
AC_DEFINE(USE_TIMEVAL, [], [Use timeval struct])
AC_MSG_RESULT("yes")
], AC_MSG_RESULT("no") )
AC_ARG_ENABLE([static], AS_HELP_STRING([--enable-static], [Enable static building]))
AS_IF([test "x$enable_static" = "xyes"], [
LDFLAGS="-static $LDFLAGS"
], [
])
AC_DEFINE(MAX_STRLEN_LONG, [60], [Max length for a long])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
# todo, add tests
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT