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 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
|
AC_INIT([NetPerfMeter], [1.1.7], [dreib@iem.uni-due.de])
AM_INIT_AUTOMAKE
AC_PREREQ(2.60)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h:config.in])
AC_CONFIG_SRCDIR([src/netperfmeter.cc])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
# ###### Maintainer mode ####################################################
AC_ARG_ENABLE([maintainer-mode],
[ --enable-maintainer-mode enable maintainer mode ]
[default=no]],enable_maintainer_mode=$enableval,enable_maintainer_mode=no)
if test "$enable_maintainer_mode" = "yes"; then
CFLAGS="$CFLAGS -Wall -g3 -O0"
CXXFLAGS="$CXXFLAGS -Wall -g3 -O0"
else
CFLAGS="$CFLAGS -Wall"
CXXFLAGS="$CXXFLAGS -Wall"
fi
AC_ARG_ENABLE([test-programs],
[ --enable-test-programs build with batch test programs ]
[default=no]],enable_test_programs=$enableval,enable_test_programs=no)
AM_CONDITIONAL(BUILD_TEST_PROGRAMS, test x$enable_test_programs = xyes)
AC_ARG_ENABLE([plotting-programs],
[ --enable-plotting-programs build with batch plotting programs ]
[default=no]],enable_plotting_programs=$enableval,enable_plotting_programs=no)
AM_CONDITIONAL(BUILD_PLOTTING_PROGRAMS, test x$enable_plotting_programs = xyes)
# ###### Networking declarations ############################################
AC_MSG_CHECKING(if stderr is a variable of type FILE* and not a macro)
AC_TRY_COMPILE([#include <stdio.h>],
[FILE** stdlog = &stderr],
[AC_DEFINE(HAVE_STDERR_FILEPTR, 1, "Define to 1 if stderr is a pointer.")
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
AC_CHECK_HEADERS(sys/types.h sys/socket.h netinet/in.h netinet/sctp.h)
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/socket.h>],
[socklen_t x = 1; return 0;],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(int)
AC_DEFINE(socklen_t, int, [Define a type for socklen_t.])])
AC_CHECK_MEMBER(struct sockaddr_in.sin_len,
AC_DEFINE(HAVE_SIN_LEN, 1, [Define this if your IPv4 has sin_len in sockaddr_in struct.]),,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <netinet/in.h>])
AC_CHECK_MEMBER(struct sockaddr_in6.sin6_len,
AC_DEFINE(HAVE_SIN6_LEN, 1, [Define this if your IPv6 has sin6_len in sockaddr_in6 struct.]),,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <netinet/in.h>])
AC_MSG_CHECKING(for DCCP support)
AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <netinet/in.h>],
[socklen_t x = IPPROTO_DCCP; return 0;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DCCP, 1, "Define to 1 if DCCP is supported.")],
[AC_MSG_RESULT(no)])
AC_MSG_CHECKING(for IPV6_BINDV6ONLY)
AC_TRY_COMPILE([#include <netinet/in.h>],
[int x = IPV6_BINDV6ONLY],
[AC_DEFINE(HAVE_IPV6_BINDV6ONLY, 1, "Define to 1 if IPV6_BINDV6ONLY socket option is available.")
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
AC_CHECK_FUNCS(socket, , AC_CHECK_LIB(socket, socket))
# ###### Check for IEEE-754 complient float-point handling ##################
AC_MSG_CHECKING([for floating point type])
AC_TRY_RUN([
#include <stdio.h>
union DoubleIntUnion
{
double Double;
unsigned long long Integer;
};
/*
void hexdump(const void* ptr, const size_t length)
{
const unsigned char* cptr = (const unsigned char*)ptr;
size_t i;
for(i = 0;i < length;i++) {
printf("%02x ", cptr[i]);
}
puts("");
}
*/
int main ()
{
union DoubleIntUnion value;
value.Double = 0.0;
if(value.Integer != 0ULL) {
/* puts("Math is non-IEEE (check 1)!\n"); */
return(1);
}
value.Double = 1000.5;
if(value.Integer != 0x408f440000000000ULL) {
/* puts("Math is non-IEEE (check 2)!\n"); */
return(1);
}
value.Double = -1000.5;
if(value.Integer != 0xc08f440000000000ULL) {
/* puts("Math is non-IEEE (check 3)!\n"); */
return(1);
}
/* puts("Math is IEEE\n"); */
return(0);
}
], IEEEFP=ok, IEEEFP=broken, IEEEFP=cross)
case $IEEEFP in
ok)
AC_MSG_RESULT(IEEE)
AC_DEFINE(HAVE_IEEE_FP, 1, [IEEE compliant float-point handling])
;;
cross)
AC_MSG_RESULT([cross-compiling, assuming IEEE])
AC_DEFINE(HAVE_IEEE_FP)
;;
*|broken)
AC_MSG_RESULT([non IEEE])
;;
esac
# ###### Check for BZip2 library ############################################
oldLIBS=$LIBS
LIBS=
AC_CHECK_HEADERS([bzlib.h])
AC_SEARCH_LIBS([BZ2_bzReadOpen], [bz2])
bz2_LIBS=$LIBS
AC_SUBST(bz2_LIBS)
LIBS=$oldLIBS
# ###### Check if kernel SCTP should be used ################################
AC_ARG_ENABLE(kernel-sctp,
[ --enable-kernel-sctp Use kernel SCTP instead of sctplib [default=yes]],enable_kernel_sctp=$enableval,enable_kernel_sctp=yes)
# ###### Check for SCTP implementation ######################################
if test "$enable_kernel_sctp" = "no"; then
# ====== sctplib =========================================================
ac_sctplib_includes=no ac_sctplib_libraries=no ac_sctplib_bindir=no
sctplib_libraries=""
sctplib_includes=""
AC_ARG_WITH(sctplib,
[ --with-sctplib=DIR where the root of sctplib is installed ],
[ ac_sctplib_includes="$withval"/include
ac_sctplib_libraries="$withval"/lib
ac_sctplib_bindir="$withval"/bin
])
if test "$ac_sctplib_libraries" = "no"; then
ac_sctplib_defaultdir="/usr/local"
ac_sctplib_includes="$ac_sctplib_defaultdir"/include
ac_sctplib_libraries="$ac_sctplib_defaultdir"/lib
ac_sctplib_bindir="$ac_sctplib_defaultdir"/bin
fi
if test ! -e "$ac_sctplib_includes/sctp.h" ; then
AC_MSG_ERROR([No sctplib installation found ($ac_sctplib_includes/sctp.h)!])
fi
if test ! -e $ac_sctplib_libraries/libsctplib.a ; then
AC_MSG_ERROR([No sctplib installation found ($ac_sctplib_libraries/libsctplib.a)!])
fi
# ====== socketapi =======================================================
ac_socketapi_includes=no ac_socketapi_libraries=no ac_socketapi_bindir=no
socketapi_libraries=""
socketapi_includes=""
AC_ARG_WITH(socketapi,
[ --with-socketapi=DIR where the root of socketapi is installed ],
[ ac_socketapi_includes="$withval"/include
ac_socketapi_libraries="$withval"/lib
ac_socketapi_bindir="$withval"/bin
])
if test "$ac_socketapi_libraries" = "no"; then
ac_socketapi_defaultdir="/usr/local"
ac_socketapi_includes="$ac_socketapi_defaultdir"/include
ac_socketapi_libraries="$ac_socketapi_defaultdir"/lib
ac_socketapi_bindir="$ac_socketapi_defaultdir"/bin
fi
if test ! -e $ac_socketapi_libraries/libsctpsocket.a ; then
AC_MSG_ERROR([No socketapi installation found ($ac_socketapi_libraries/libsctpsocket.a)!])
fi
# In maintainer mode, use static linking for sctplib/socketapi!
if test "$enable_maintainer_mode" = "yes"; then
sctplib_LIBS="$ac_sctplib_libraries/libsctplib.a"
socketapi_LIBS="$ac_socketapi_libraries/libsctpsocket.a -lstdc++"
else
sctplib_LIBS="-L$ac_sctplib_libraries -lsctplib"
socketapi_LIBS="-L$ac_socketapi_libraries -lsctpsocket -lstdc++"
fi
AC_DEFINE(HAVE_SPP_FLAGS, 1, [Define this if you support version 10 if the API ID.])
# ====== Check for glib ==================================================
AM_PATH_GLIB_2_0(2.0.0, [ glib_is_okay=yes ], [ glib_is_okay=no ])
if test "x$glib_is_okay" = "xno"; then
AC_MSG_ERROR(GLib distribution not found.)
fi
CFLAGS="$CFLAGS $GLIB_CFLAGS"
CPPFLAGS="$CPPFLAGS $GLIB_CFLAGS"
glib_LIBS="$GLIB_LIBS"
# ====== Version compatibility test ======================================
oldLIBS=$LIBS
LIBS="$LIBS $socketapi_LIBS $sctplib_LIBS $glib_LIBS $thread_LIBS"
AC_MSG_CHECKING([socketapi library version])
AC_TRY_RUN([
#include <stdio.h>
#include "ext_socket.h"
int main(int argc, char** argv)
{
unsigned int version = socketAPIGetVersion();
printf("Version is %u.%04x\n", (version >> 16), version & 0xffff);
if(version >= 0x21100) {
return(0);
}
return(1);
}
], socketapi_version=good, socketapi_version=bad, socketapi_version=cross)
case $socketapi_version in
good)
;;
bad|*)
AC_MSG_ERROR([You need at least version 2.110 of the socketapi library!])
;;
esac
AC_DEFINE(HAVE_SCTP_SENDMSG, 1, [Define to 1 if you have the `sctp_sendmsg' function.])
AC_DEFINE(HAVE_SCTP_CONNECTX, 1, [Define to 1 if you have the `sctp_connectx' function.])
AC_DEFINE(HAVE_SCTP_SEND, 1, [Define to 1 if you have the `sctp_send' function.])
AC_DEFINE(HAVE_SCTP_SENDX, 1, [Define to 1 if you have the `sctp_sendx' function.])
AC_DEFINE(HAVE_SPP_FLAGS, 1, [Define this if you support version 10 if the API ID.])
AC_DEFINE(HAVE_CONNECTX_WITH_ID, 1, [Define to 1 if sctp_connectx has associd parameter.])
AC_DEFINE(HAVE_SCTP_DELAYED_SACK, 1, [Define to 1 if SCTP_DELAYED_SACK with sctp_sack_info is available.])
LIBS=$oldLIBS
# ========================================================================
else
# ====== Kernel SCTP =====================================================
oldLIBS=$LIBS
AC_CHECK_FUNCS(sctp_sendmsg, , AC_CHECK_LIB(sctp, sctp_sendmsg))
AC_CHECK_FUNCS(sctp_connectx, , AC_CHECK_LIB(sctp, sctp_connectx))
AC_CHECK_FUNCS(sctp_send, , AC_CHECK_LIB(sctp, sctp_send))
AC_CHECK_FUNCS(sctp_sendx, , AC_CHECK_LIB(sctp, sctp_sendx))
AC_CHECK_MEMBER(struct sctp_paddrparams.spp_flags,
AC_DEFINE(HAVE_SPP_FLAGS, 1, [Define this if sctp_paddrparams has the spp_flags field.]),,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_SCTP_H
#include <netinet/sctp.h>
#endif])
AC_CHECK_MEMBER(struct sctp_sndrcvinfo.sinfo_pr_policy,
AC_DEFINE(HAVE_SINFO_PR_POLICY, 1, [Define this if sctp_sndrcvinfo has the sinfo_pr_policy field.]),,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_NETINET_SCTP_H
#include <netinet/sctp.h>
#endif])
AC_MSG_CHECKING(whether sctp_connectx has an associd parameter)
AC_TRY_COMPILE([#include <sys/types.h>
#include <netinet/sctp.h>],
[sctp_assoc_t id;
int result = sctp_connectx(0, NULL, 0, &id);],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CONNECTX_WITH_ID, 1, [Define to 1 if sctp_connectx has the associd parameter.])],
AC_MSG_RESULT(no))
AC_MSG_CHECKING(whether SCTP_DELAYED_SACK with sctp_sack_info is available)
AC_TRY_COMPILE([#include <sys/types.h>
#include <netinet/sctp.h>],
[struct sctp_sack_info sctpSACKInfo;
int opt = SCTP_DELAYED_SACK;],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SCTP_DELAYED_SACK, 1, [Define to 1 if SCTP_DELAYED_SACK with sctp_sack_info is available.])],
AC_MSG_RESULT(no))
LIBS=$oldLIBS
# ====== Check for Valgrind ==============================================
# Needed to avoid false positives for sctp_getladdrs()/sctp_getpaddrs()
AC_CHECK_HEADERS([valgrind/valgrind.h])
AC_CHECK_HEADERS([valgrind/memcheck.h])
# ====== Check for SCTP library linker parameter =========================
sctplib_LIBS=""
socketapi_LIBS=""
sctp_okay=0
AC_CHECK_LIB(sctp, sctp_sendmsg, [
socketapi_LIBS="-lsctp"
sctp_okay=1])
if test $sctp_okay -ne 1 ; then
AC_CHECK_LIB(c, sctp_sendmsg, [
socketapi_LIBS=""
sctp_okay=1])
fi
AC_MSG_CHECKING([whether library parameter for SCTP functions])
if test $sctp_okay -ne 1 ; then
AC_MSG_ERROR([Do not know where to find SCTP functions! Missing libsctp?])
else
AC_MSG_RESULT([appending "$socketapi_LIBS"])
fi
glib_LIBS=""
CFLAGS="$CFLAGS -DHAVE_KERNEL_SCTP"
CXXFLAGS="$CXXFLAGS -DHAVE_KERNEL_SCTP"
fi
AC_SUBST(sctplib_LIBS)
AC_SUBST(socketapi_LIBS)
AC_SUBST(glib_LIBS)
# ###### Makefiles ##########################################################
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
# ###### Configuration results ##############################################
echo ""
echo "The NetPerfMeter package has been configured with the following options:"
echo ""
echo " Build in Maintainer Mode : $enable_maintainer_mode"
echo " Build with Kernel SCTP : $enable_kernel_sctp"
echo " SCTP Socket API Libraries : $socketapi_LIBS"
if test "$enable_kernel_sctp" = "no"; then
echo " SCTPLIB Libraries : $sctplib_LIBS"
fi
echo " BZip2 Libraries : $bz2_LIBS"
|