-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
162 lines (136 loc) · 4.61 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
156
157
158
159
160
161
162
# The MCLinker project
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
##############################################################################
### WARNING: this file contains embedded tabs. Do not run untabify on this file.
####################
# m4 includes
m4_include(m4/acx_pthread.m4)
####################
# Autoconf/Automake Initialization
dnl AC_INIT(PKG_NAME, BUILD_VERSION, BUG_REPORTER)
AC_INIT([MCLinker],[dev],[[email protected]])
AC_PREREQ(2.59)
AC_CONFIG_SRCDIR([./COPYING])
AC_CONFIG_AUX_DIR([scripts])
AC_CONFIG_MACRO_DIR([m4])
dnl Check the target for which we're linking and the host that will do the
dnl linking. This will tell us which MCLINKER will be used for linking
dnl input objects into output. This needs to be done early because
dnl following tests depend on it.
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.9 dist-bzip2 foreign subdir-objects silent-rules])
AM_SILENT_RULES([yes])
####################
# Versioning, see VERSION
MAJOR=2
MINOR=11
MICRO=0
BUILD=dev
DEV_VERSION=$MAJOR.$MINOR.$MICRO-$BUILD
PKG_VERSION=$MAJOR.$MINOR.$MICRO-$BUILD
MCLD_VERSION=$DEV_VERSION
AC_SUBST(MCLD_VERSION)
AC_DEFINE_UNQUOTED([MCLD_VERSION], ["$MCLD_VERSION"])
AH_TEMPLATE([MCLD_VERSION], [MCLINKER version])
####################
# Languages
AC_PROG_CC
AC_PROG_CXX
AC_PATH_PROG([FLEX],[flex])
AX_PROG_FLEX_VERSION([2.5.35],[],[AC_MSG_ERROR([Require flex 2.5.35 or later])])
AC_PATH_PROG([BISON],[bison])
AX_PROG_BISON_VERSION([2.4.3],[3.1],[],
[AC_MSG_ERROR([Require bison >= 2.4.3 and < 3.1])])
AC_LANG([C++])
LT_INIT
####################
# Check for libraries
# Configure pthreads.
AC_ARG_WITH([pthreads],
[AS_HELP_STRING([--with-pthreads],
[use pthreads (default is yes)])],
[with_pthreads=$withval],
[with_pthreads=check])
have_pthreads=no
AS_IF([test "x$with_pthreads" != "xno"],
[ACX_PTHREAD(
[],
[AS_IF([test "x$with_pthreads" != "xcheck"],
[AC_MSG_FAILURE(
[--with-pthreads was specified, but unable to be used])])])
have_pthreads="$acx_pthread_ok"])
AM_CONDITIONAL([HAVE_PTHREADS],[test "x$have_pthreads" == "xyes"])
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_LIBS)
####################
# Configure optimized build
AC_ARG_ENABLE(optimized,
[AS_HELP_STRING([--enable-optimized],
[turn on unit-tests (default is no)])],
[case "${enableval}" in
yes) optimized=true ;;
no) optimized=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-optimized) ;;
esac],
[optimized=false])
AM_CONDITIONAL([ENABLE_OPTIMIZED],[test "x${optimized}" == "xtrue" ])
####################
# Configure compiler warnings
AC_MSG_CHECKING([for optional compiler flags])
CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
CXX_FLAG_CHECK(NO_COVERED_SWITCH_DEFAULT, [-Wno-covered-switch-default])
CXX_FLAG_CHECK(NO_C99_EXTENSIONS, [-Wno-c99-extensions])
AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_COVERED_SWITCH_DEFAULT $NO_C99_EXTENSIONS])
####################
# Check for header files
AC_CHECK_HEADERS([fcntl.h unistd.h])
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_HEADERS([cxxabi.h])
AC_CHECK_HEADERS([zlib.h])
####################
# Configure LLVM
CHECK_LLVM([3.8])
ENUM_MCLD_TARGETS
CHECK_ALONE_TARGET
# Config.h
AC_CONFIG_HEADER(include/mcld/Config/Config.h)
AH_TOP([
//===- Config.h.in --------------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef MCLD_CONFIG_H
#define MCLD_CONFIG_H
])
AH_BOTTOM([
#define MCLD_REGION_CHUNK_SIZE 32
#define MCLD_NUM_OF_INPUTS 32
#define MCLD_SECTIONS_PER_INPUT 16
#define MCLD_SYMBOLS_PER_INPUT 128
#define MCLD_RELOCATIONS_PER_INPUT 1024
#define MCLD_SEGMENTS_PER_OUTPUT 8
#endif
])
####################
# OUTPUT
AC_CONFIG_FILES([VERSION])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([include/Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([utils/Makefile])
AC_CONFIG_FILES([utils/gtest/Makefile])
AC_CONFIG_FILES([utils/gtestmain/Makefile])
AC_CONFIG_FILES([utils/zlib/Makefile])
AC_CONFIG_FILES([unittests/Makefile])
AC_CONFIG_FILES([include/mcld/Config/Targets.def])
AC_CONFIG_FILES([include/mcld/Config/Linkers.def])
AC_CONFIG_FILES([tools/Makefile])
AC_CONFIG_FILES([tools/mcld/Makefile])
AC_CONFIG_FILES([test/Makefile])
AC_OUTPUT