-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
207 lines (163 loc) · 5.28 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
define([ver_major], esyscmd([sh -c "(awk -F. '{ print \$1 }' version) | tr -d '\n'"]))
define([ver_minor], esyscmd([sh -c "(awk -F. '{ print \$2 }' version) | tr -d '\n'"]))
define([ver_svn], esyscmd([sh -c "(svnversion .) | awk '{ print \$1 }' | tr -d '\n'"]))
AC_INIT([SOCKPERF], [ver_major.ver_minor.ver_svn], [[email protected]])
AC_DEFINE(SOCKPERF_MAJOR_VER, ver_major, [sockperf Major Version])
AC_DEFINE(SOCKPERF_MINOR_VER, ver_minor, [sockperf Minor Version])
AC_DEFINE(SOCKPERF_MICRO_VER, ver_svn, [sockperf Micro Version])
VERSION=ver_major.ver_minor.ver_svn
AC_CONFIG_HEADER([config.h])
#AC_CONFIG_MACRO_DIR([config/m4])
AC_CONFIG_AUX_DIR([config/aux])
# Determine the host system
AC_CANONICAL_SYSTEM
TARGETDIR="unknown"
case "$host" in
i?86-*-*) TARGET=X86; TARGETDIR=x86;;
ia64*-*-*) TARGET=IA64; TARGETDIR=ia64;;
powerpc*-*-linux* | powerpc-*-sysv*) TARGET=POWERPC; TARGETDIR=powerpc;;
arm*-*-linux*) TARGET=ARM; TARGETDIR=arm;;
powerpc-*-beos*) TARGET=POWERPC; TARGETDIR=powerpc;;
powerpc-*-darwin*) TARGET=POWERPC_DARWIN; TARGETDIR=powerpc;;
powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc;;
powerpc-*-freebsd*) TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc;;
powerpc*-*-rtems*) TARGET=POWERPC; TARGETDIR=powerpc;;
x86_64-*-*) TARGET=X86_64; TARGETDIR=x86;;
aarch64-*-*) TARGET=AARCH64; TARGETDIR=aarch64;;
esac
AC_SUBST(AM_RUNTESTFLAGS)
AC_SUBST(AM_LTLDFLAGS)
if test $TARGETDIR = unknown; then
AC_MSG_ERROR(["it has not been ported to $host."])
fi
AM_CONDITIONAL(X86, test x$TARGET = xX86)
AM_CONDITIONAL(IA64, test x$TARGET = xIA64)
AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC)
AM_CONDITIONAL(ARM, test x$TARGET = xARM)
AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX)
AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN)
AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD)
AM_CONDITIONAL(AARCH64, test x$TARGET = xAARCH64)
AC_SUBST(TARGET)
AC_SUBST(TARGETDIR)
AC_MSG_NOTICE([ ])
AC_MSG_NOTICE([release $VERSION])
#########
# Locate a compiler for the build machine. This compiler should
# generate command-line programs that run on the build machine.
#
if test x"$cross_compiling" = xyes; then
AC_MSG_NOTICE([Enable cross compiling on ${build_cpu} for ${host_cpu}])
#prefix=${prefix}/${host_cpu}
fi
AC_MSG_NOTICE([..............................................])
AM_INIT_AUTOMAKE(foreign)
AM_MAINTAINER_MODE
#####################################
# check for C++ preprocessor and compiler
#
AC_PROG_CXX
#AC_PROG_LIBTOOL
CXXFLAGS="-Werror -Wall --param inline-unit-growth=200"
CXXFLAGS="$CXXFLAGS -D__LINUX__ -DVERSION=$VERSION"
##########################
# Documentation
#
AC_ARG_ENABLE(
[doc],
AC_HELP_STRING([--enable-doc],
[SOCKPERF: create documentation with doxygen in html and unix-man(default=yes)]))
# Checks for doxygen
AC_PATH_PROG(DOXYGEN, doxygen, ,$PATH:/usr/local/bin:/usr/bin)
if test x$DOXYGEN = x; then
enable_doc=no
fi
AM_CONDITIONAL(DOC, test x$enable_doc = xyes)
##########################
# Enable tests
#
AC_ARG_ENABLE(
[test],
AC_HELP_STRING([--enable-test],
[SOCKPERF: compile tests (default=yes)]))
AM_CONDITIONAL(TEST, test x$enable_test = xyes)
##########################
# Enable tools
#
AC_ARG_ENABLE(
[tool],
AC_HELP_STRING([--enable-tool],
[SOCKPERF: compile utilities (default=yes)]))
AM_CONDITIONAL(TOOL, test x$enable_tool = xyes)
##########################
# Enable debug build
#
AC_ARG_ENABLE(
[debug],
AC_HELP_STRING([--enable-debug],
[SOCKPERF: turn on debugging (default=no)]))
if test x$enable_debug = xyes; then
TARGET_BUILD=dbg
CXXFLAGS="$CXXFLAGS -g -D_DEBUG -DDEBUG"
CFLAGS="$CFLAGS -g -D_DEBUG -DDEBUG"
else
TARGET_BUILD=rls
CXXFLAGS="$CXXFLAGS -O3 -DNDEBUG"
CFLAGS="$CFLAGS -O3 -DNDEBUG"
fi
##########################
# Enable debug info
#
AC_ARG_ENABLE(
[debuginfo],
AC_HELP_STRING([--enable-debuginfo],
[SOCKPERF: include debug information (default=no)]))
if test x$enable_debuginfo = xyes; then
CXXFLAGS="$CXXFLAGS -g -O3"
CFLAGS="$CFLAGS -g -O3"
fi
##########################
# Enable build 32bit
#
AC_ARG_ENABLE(
[build32],
AC_HELP_STRING([--enable-build32],
[SOCKPERF: force build 32bit (default=no)]))
if test x$enable_build32 = xyes; then
CXXFLAGS="$CXXFLAGS -m32"
CFLAGS="$CFLAGS -m32"
fi
#####################################
# Checks for header files.
#
AC_HEADER_STDC
AC_CHECK_HEADERS(
[arpa/inet.h fcntl.h netinet/in.h stdint.h stdlib.h \
string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h \
termios.h unistd.h])
#####################################
# Checks for libraries.
#
AC_HEADER_STDC
AC_CHECK_LIB(
[rt], [clock_gettime], [], AC_MSG_ERROR([librt not found]))
AC_CHECK_LIB(
[pthread], [pthread_create], [], AC_MSG_ERROR([libpthread not found]))
AC_CHECK_LIB(
[dl], [dlsym], [], AC_MSG_ERROR([libdl not found]))
RPM_RELEASE=1
AC_SUBST(RPM_RELEASE)
RPM_DIR=${top_sockperf_dir}
AC_SUBST(RPM_DIR)
RPM_TARBALL=${PACKAGE}-${VERSION}.tar.gz
AC_SUBST(RPM_TARBALL)
OUT_DIR=`pwd`/bin/linux/${TARGET_BUILD}/${host_cpu}
#AC_PREFIX_DEFAULT("`pwd`/inst")
AC_CONFIG_FILES([
Makefile
doc/Makefile
src/Makefile
tools/Makefile
tests/Makefile
])
AC_OUTPUT