-
Notifications
You must be signed in to change notification settings - Fork 12
/
configure.ac
112 lines (87 loc) · 3.11 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
dnl --------------------------------
dnl Initialization macros.
dnl --------------------------------
AC_INIT([metslib], [0.6.0], [mirko.maischberger@gmail.com])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([config])
dnl -----------------------------------------------
dnl Package name and version number (user defined)
dnl -----------------------------------------------
GENERIC_LIBRARY_NAME=metslib
#release versioning
GENERIC_MAJOR_VERSION=0
GENERIC_MINOR_VERSION=6
GENERIC_MICRO_VERSION=0
#API version (often = GENERIC_MAJOR_VERSION.GENERIC_MINOR_VERSION)
GENERIC_API_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_API_VERSION)
dnl --------------------------------
dnl Package name and version number
dnl --------------------------------
AC_SUBST(GENERIC_LIBRARY_VERSION)
PACKAGE=$GENERIC_LIBRARY_NAME
AC_SUBST(GENERIC_LIBRARY_NAME)
GENERIC_VERSION=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION.$GENERIC_MICRO_VERSION
GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$GENERIC_MINOR_VERSION
AC_SUBST(GENERIC_RELEASE)
AC_SUBST(GENERIC_VERSION)
VERSION=$GENERIC_VERSION
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, [mirko.maischberger@gmail.com])
AC_CONFIG_HEADERS([config.h])
AX_PREFIX_CONFIG_H([metslib/metslib_ah.hh])
dnl -----------------------------------------------
dnl Checks for programs.
dnl -----------------------------------------------
PKG_PROG_PKG_CONFIG([0.9])
AC_PROG_CXX
AM_SANITY_CHECK
AC_LANG_CPLUSPLUS
dnl ---------------------------------------------
dnl Check for TR1 headers
dnl ---------------------------------------------
AC_CHECK_HEADERS([tr1/unordered_map unordered_map],
[],
[])
if test $ac_cv_header_tr1_unordered_map = no; then
if test $ac_cv_header_unordered_map = no; then
AC_MSG_FAILURE([Unable to find <tr1/unordered_map> nor <unordered_map>, please use a recent C++ compiler supporting TR1 extension.])
fi
fi
AC_TRY_COMPILE([#include <unordered_map>],
[namespace std::tr1::unordered_map;],
[AC_DEFINE(TR1_MIXED_NAMESPACE, [], [Description])],
[])
dnl ---------------------------------------------
dnl Add option to turn off optimizations
dnl ---------------------------------------------
release_version=yes
AC_ARG_ENABLE(debug, [ --enable-debug Turn off optimizations. ], \
if test "$enableval" = "yes"; then \
echo "disabling optimizations."
release_version=no
fi;)
if test $release_version = no; then
CFLAGS=`echo $CFLAGS | sed s/-O2//`
CXXFLAGS=`echo $CXXFLAGS | sed s/-O2//`
CPPFLAGS=`echo $CPPFLAGS | sed s/-O2//`
fi
dnl ---------------------------------------------
dnl g++ specific options
dnl ---------------------------------------------
if test $CXX = g++; then
CXXFLAGS="$CXXFLAGS -Wall -Weffc++"
if test $release_version = yes; then
CXXFLAGS="$CXXFLAGS -O3"
fi
fi
dnl -----------------------------------------------
dnl Generates Makefile's, configuration files and scripts
dnl -----------------------------------------------
SHAVE_INIT
AC_CONFIG_FILES([shave])
AC_OUTPUT(Makefile \
metslib.pc \
metslib/Makefile \
doxydoc/Makefile \
test/Makefile \
)