forked from CCI/cci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
270 lines (234 loc) · 8.56 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# -*- shell-script -*-
#
# Copyright © 2011 Cisco Systems, Inc. All rights reserved.
#
# See COPYING in top-level directory.
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_INIT([cci],
[m4_normalize(esyscmd([config/cci_get_version.sh VERSION --base]))],
[http://www.google.com/], [cci])
AC_PREREQ([2.68])
AC_CONFIG_AUX_DIR([./config])
# Note that this directory must *exactly* match what was specified via
# -I in ACLOCAL_AMFLAGS in the top-level Makefile.am.
AC_CONFIG_MACRO_DIR([./config])
AC_CHECK_HEADERS([ltdl.h])
AC_SEARCH_LIBS([lt_dlopen],[ltdl])
# Define $target
AC_CANONICAL_TARGET
CCI_CONFIGURE_SETUP
cci_show_title "Configuring CCI distribution tarball"
# Init automake
AM_INIT_AUTOMAKE([1.11 dist-bzip2 subdir-objects foreign -Wall -Werror])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Make configure depend on the VERSION file, since it's used in AC_INIT
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
# Get the version of cci that we are installing
AC_MSG_CHECKING([for cci version])
CCI_VERSION="`$srcdir/config/cci_get_version.sh $srcdir/VERSION`"
CCI_MAJOR_VERSION="`$srcdir/config/cci_get_version.sh $srcdir/VERSION --major`"
CCI_MINOR_VERSION="`$srcdir/config/cci_get_version.sh $srcdir/VERSION --minor`"
CCI_RELEASE_VERSION="`$srcdir/config/cci_get_version.sh $srcdir/VERSION --release`"
CCI_REPO_REV="`$srcdir/config/cci_get_version.sh $srcdir/VERSION --repo-rev`"
CCI_RELEASE_DATE="`$srcdir/config/cci_get_version.sh $srcdir/VERSION --release-date`"
AC_SUBST(CCI_VERSION)
AC_SUBST(CCI_REPO_REV)
AC_SUBST(CCI_RELEASE_DATE)
AC_DEFINE_UNQUOTED([CCI_MAJOR_VERSION], [$CCI_MAJOR_VERSION],
[Major version of cci])
AC_DEFINE_UNQUOTED([CCI_MINOR_VERSION], [$CCI_MINOR_VERSION],
[Minor version of cci])
AC_DEFINE_UNQUOTED([CCI_RELEASE_VERSION], [$CCI_RELEASE_VERSION],
[Release version of cci])
AC_MSG_RESULT([$CCI_VERSION])
# Override/fixup the version numbers set by AC_INIT, since on
# developer builds, there's no good way to know what the version is
# before running configure :(. We only use the base version number
# (ie, no svn r numbers) for the version set in AC_INIT. This will
# always match reality because we add the VERSION file (the only way
# to change the major.minor.release{greek}) into the configure
# dependencies.
PACKAGE_VERSION="$CCI_VERSION"
PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
VERSION="${PACKAGE_VERSION}"
# For standalone configurations, we also include a .so version number.
. $srcdir/VERSION
AC_SUBST([libcci_so_version])
# Setup the header file
AH_TOP([/* -*- c -*-
*
* Copyright © 2010 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef CCI_CONFIGURE_H
#define CCI_CONFIGURE_H
])
AH_BOTTOM([
#endif /* CCI_CONFIGURE_H */
])
# If debug mode, add -g
CFLAGS_save="$CFLAGS"
AC_ARG_ENABLE([cci-debug],
AS_HELP_STRING([--enable-cci-debug],
[Build w/support for debugging symbols]),
AC_SUBST([CFLAGS],["-g -O0 -Wall $CFLAGS_save"]),
[])
# Check for Cray GNI (Gemini) headers and libs
CPPFLAGS_save="$CPPFLAGS"
AS_IF([test "$CRAY_GNI_HEADERS_INCLUDE_OPTS"],
[cppflags="$CRAY_GNI_HEADERS_INCLUDE_OPTS $CPPFLAGS_save"]
AC_SUBST([CPPFLAGS],["$cppflags"]))
LDFLAGS_save="$LDFLAGS"
AS_IF([test "$CRAY_UGNI_POST_LINK_OPTS"],
[ldflags="$CRAY_UGNI_POST_LINK_OPTS -lugni $LDFLAGS_save"]
AC_SUBST([LDFLAGS],["$ldflags"]))
# Extract compiler from Cray Programming Environment
AS_IF([test "$PE_ENV" = "PGI"],
AC_SUBST([CC],["pgcc"])
[cflags="-fast -Msmartalloc -Mnobuiltin $DEBUG_FLAGS"])
AS_IF([test "$PE_ENV" = "GNU"],
AC_SUBST([CC],["gcc"])
[cflags="-O3 -pthread -fno-builtin -Wall -Werror $DEBUG_FLAGS"])
AS_IF([test "$PE_ENV" = "INTEL"],
AC_SUBST([CC],["icc"])
[cflags="-O3 -pthread -fno-builtin -Wall -Werror $DEBUG_FLAGS"])
# Cray compiler is not ready yet; needs libtool support
#AS_IF([test "$PE_ENV" = "CRAY"],
# AC_SUBST([CC],["craycc"])
# [cflags="-O3 -h msglevel_1"])
# Set Default CFLAGS when none specified.
AS_IF([test x"$CFLAGS" = x],
[CFLAGS="$cflags"])
# Setup C compiler
CFLAGS_save="$CFLAGS"
AC_PROG_CC
AM_PROG_CC_C_O
CFLAGS="$CFLAGS_save"
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# Define cci's configure arguments
CCI_DEFINE_ARGS
# Configure openpa
cci_show_title "Configuring openpa"
AC_CONFIG_SUBDIRS([src/openpa])
# Setup the cci ctp
CCI_SETUP_CTP([], [], [AC_MSG_ERROR([Cannot continue])], [1])
# Default to shared library yet
AM_ENABLE_SHARED
AM_DISABLE_STATIC
# Setup libtool / libltdl. No need for Fortran, etc.
cci_show_title "Configuring libtool / libltdl"
# LT_CONFIG_LTDL_DIR([src/libltdl])
#LT_INIT([dlopen win32-dll])
#LTDL_INIT([subproject convenience])
dnl Allow the user to specify where ltdl headers are installed
AC_ARG_WITH([ltdl_include],
[AS_HELP_STRING([--with-ltdl-include=DIR],
[use the ltdl headers installed in DIR])])
if test -n "$with_ltdl_include"; then
AC_MSG_CHECKING([for ltdl.h])
if test -f "$with_ltdl_include/ltdl.h"; then
AC_MSG_RESULT([$with_ltdl_include])
LTDLINCL="-I$with_ltdl_include"
CFLAGS="$CFLAGS $LTDLINCL"
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find ltdl.h in $with_ltdl_include])
with_ltdl_include=no
fi
else
with_ltdl_include=no
fi
dnl Allow the user to specify where libltdl is installed
AC_ARG_WITH([ltdl_lib],
[AS_HELP_STRING([--with-ltdl-lib=DIR],
[use the ltdl library installed in DIR])])
if test -n "$with_ltdl_lib"; then
AC_MSG_CHECKING([for libltdl])
if test -f "$with_ltdl_lib/libltdl.la"; then
AC_MSG_RESULT([$with_ltdl_lib])
LIBLTDL="-L$with_ltdl_lib -lltdl"
LDFLAGS="$LDFLAGS $LIBLTDL"
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find libltdl in $with_ltdl_lib])
with_ltdl_lib=no
fi
else
with_ltdl_lib=no
fi
dnl Allow the user to specify where ltdl is installed (cannot be used in
dnl conjunction with --with-ltdl-include and/or --with-ltdl-lib
AC_ARG_WITH([installed_ltdl],
[AS_HELP_STRING([--with-included-ltdl=DIR],
[use ltdl installed in DIR])])
if test -n "$with_included_ltdl"; then
AC_MSG_CHECKING([for installed ltdl])
if test x"$with_ltdl_lib" = x"no" -a x"$with_ltdl_include" = x"no"; then
if test -f "$with_included_ltdl/include/ltdl.h"; then
AC_MSG_RESULT([$with_included_ltdl])
LTDLINCL="-I$with_included_ltdl/include"
CFLAGS="$CFLAGS $LTDLINCL"
if test -f "$with_included_ltdl/lib/libltdl.la"; then
LIBLTDL="-L$with_included_ltdl/lib -lltdl"
LDFLAGS="$LDFLAGS $LIBLTDL"
AC_MSG_RESULT([yep])
else
with_included_ltdl=no
AC_MSG_RESULT([no])
AC_MSG_ERROR([Could not find libltdl in $with_included_ltdl/lib])
fi
else
AC_MSG_RESULT([no])
with_included_ltdl=no
AC_MSG_ERROR([Could not find ltdl.h in $with_ltdl/include])
fi
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([--with-included-ltdl cannot be used with --with-ltdl-lib or --with-ltdl-include])
exit 1
fi
else
with_included_ltdl=no
fi
dnl If the user did not explicitly specify where ltdl headers are, we check
dnl if the headers are available on the system by default.
echo "toto $with_ltdl_include $with_included_ltdl"
if test x"$with_ltdl_include" = x"no" -a x"$with_included_ltdl" = x"no"; then
AC_MSG_CHECKING([for ltdl.h])
AC_CHECK_HEADER([ltdl.h],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([ltdl headers not available]),
exit 1])
fi
echo "titi"
dnl If the user did not explicitly specify where the ltdl library is, we check
dnl if the library is available on the system by default. Note that by checking
dnl for lt_dladvise_init, we check whether libtool 2.2 or newer is installed
if test x"$with_ltdl_lib" = x"no" -a x"$with_included_ltdl" = x"no"; then
AC_MSG_CHECKING([for libltdl])
AC_CHECK_LIB([ltdl],
[lt_dladvise_init],
[(LIBLTDL=-lltdl
AC_MSG_RESULT([yes]))],
[AC_MSG_ERROR([libltdl not available])
exit 1])
fi
dnl Substitute INCLTDL and LIBLTDL in the Makefiles
AC_SUBST(INCLTDL)
AC_SUBST(LIBLTDL)
dnl Configure libtool
AC_PROG_LIBTOOL
LT_LANG([C])
# Party on
AC_OUTPUT