384 lines
10 KiB
Plaintext
384 lines
10 KiB
Plaintext
AC_PREREQ(2.12)
|
|
AC_COPYRIGHT(test)
|
|
|
|
rm -f config.cache
|
|
|
|
AC_INIT(acconfig.h)
|
|
|
|
AC_CANONICAL_SYSTEM
|
|
AC_ARG_PROGRAM
|
|
|
|
AM_INIT_AUTOMAKE(sualibrary,0.1.0)
|
|
|
|
AC_PREFIX_DEFAULT(/usr/local)
|
|
if test "x$prefix" = "xNONE"; then
|
|
prefix=$ac_default_prefix
|
|
ac_configure_args="$ac_configure_args --prefix $prefix"
|
|
fi
|
|
|
|
dnl keep this order because automake gets confused apart from the authors
|
|
AM_CONFIG_HEADER(config.h:config.h.in)
|
|
|
|
dnl Checks for programs.
|
|
AC_PROG_AWK
|
|
AC_PROG_CC
|
|
AC_PROG_INSTALL
|
|
AC_PROG_LN_S
|
|
AC_PROG_CXX
|
|
AC_PROG_RANLIB
|
|
|
|
|
|
dnl Checks for libraries.
|
|
dnl create only shared libtool-libraries (add --enable-shared)
|
|
AC_ENABLE_SHARED(no)
|
|
dnl AM_DISABLE_SHARED
|
|
|
|
dnl set the following to yes, if you want to create static
|
|
dnl libtool-libraries, else no
|
|
AC_ENABLE_STATIC(yes)
|
|
|
|
dnl create a working libtool-script
|
|
if test -z "$LIBTOOL"; then
|
|
AC_LANG_SAVE
|
|
AC_LANG_CPLUSPLUS
|
|
AC_LIBTOOL_DLOPEN
|
|
AM_PROG_LIBTOOL
|
|
dnl LIBTOOL="$LIBTOOL --silent"
|
|
dnl AC_SUBST(LIBTOOL)
|
|
AC_LANG_RESTORE
|
|
LIBTOOL_SHELL='/bin/sh ./libtool'
|
|
else
|
|
LIBTOOL_SHELL=$LIBTOOL
|
|
fi
|
|
|
|
|
|
dnl activate the following for some additional tests
|
|
dnl (compat, crypt, socket, nsl, ...)
|
|
|
|
all_libraries="$USER_LDFLAGS $all_libraries"
|
|
all_includes="$all_includes $USER_INCLUDES"
|
|
AC_SUBST(all_includes)
|
|
AC_SUBST(all_libraries)
|
|
AC_SUBST(AUTODIRS)
|
|
|
|
dnl Checks for header files.
|
|
|
|
AC_HEADER_STDC
|
|
AC_HEADER_TIME
|
|
AC_CHECK_HEADERS(strings.h sys/file.h sys/time.h unistd.h netinet/in.h netdb.h \
|
|
sys/socket.h netinet/icmp6.h)
|
|
AC_CHECK_HEADERS(sys/poll.h, AC_DEFINE(HAVE_SYS_POLL_H))
|
|
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
dnl ----------------------
|
|
dnl Packages configuration - Blatantly stolen from zebra !
|
|
dnl ----------------------
|
|
AC_ARG_ENABLE(ipv6,
|
|
[ --disable-ipv6 turn off IPv6 support ])
|
|
|
|
dnl ----------
|
|
dnl IPv6 check
|
|
dnl ----------
|
|
AC_MSG_CHECKING(whether this OS does have IPv6 stack)
|
|
if test "${enable_ipv6}" = "no"; then
|
|
AC_MSG_RESULT(disabled)
|
|
else
|
|
dnl ----------
|
|
dnl INRIA IPv6
|
|
dnl ----------
|
|
if grep IPV6_INRIA_VERSION /usr/include/netinet/in.h >/dev/null 2>&1; then
|
|
cv_ipv6=yes
|
|
AC_DEFINE(HAVE_IPV6)
|
|
AC_DEFINE(INRIA_IPV6)
|
|
LIB_IPV6=""
|
|
AC_MSG_RESULT(INRIA IPv6)
|
|
fi
|
|
dnl ---------
|
|
dnl KAME IPv6
|
|
dnl ---------
|
|
if grep WIDE /usr/include/netinet6/in6.h >/dev/null 2>&1; then
|
|
cv_ipv6=yes
|
|
AC_DEFINE(HAVE_IPV6)
|
|
AC_DEFINE(KAME)
|
|
if test -d /usr/local/v6/lib -a -f /usr/local/v6/lib/libinet6.a; then
|
|
LIB_IPV6="-L/usr/local/v6/lib -linet6"
|
|
fi
|
|
AC_MSG_RESULT(KAME)
|
|
fi
|
|
dnl ---------
|
|
dnl NRL check
|
|
dnl ---------
|
|
if grep NRL /usr/include/netinet6/in6.h >/dev/null 2>&1; then
|
|
cv_ipv6=yes
|
|
AC_DEFINE(HAVE_IPV6)
|
|
AC_DEFINE(NRL)
|
|
if test x"$opsys" = x"bsdi";then
|
|
AC_DEFINE(BSDI_NRL)
|
|
AC_MSG_RESULT(BSDI_NRL)
|
|
else
|
|
AC_MSG_RESULT(NRL)
|
|
fi
|
|
fi
|
|
dnl ----------
|
|
dnl Linux IPv6
|
|
dnl ----------
|
|
if test "${enable_ipv6}" = "yes"; then
|
|
AC_EGREP_CPP(yes, [dnl
|
|
#include <linux/version.h>
|
|
/* 2.1.128 or later */
|
|
#if LINUX_VERSION_CODE >= 0x020180
|
|
yes
|
|
#endif],
|
|
[cv_ipv6=yes; cv_linux_ipv6=yes;AC_MSG_RESULT(Linux IPv6)])
|
|
else
|
|
if test x`ls /proc/net/ipv6_route 2>/dev/null` = x"/proc/net/ipv6_route"
|
|
then
|
|
cv_ipv6=yes
|
|
cv_linux_ipv6=yes
|
|
AC_MSG_RESULT(Linux IPv6)
|
|
fi
|
|
fi
|
|
if test "$cv_linux_ipv6" = "yes";then
|
|
AC_DEFINE(HAVE_IPV6)
|
|
AC_MSG_CHECKING(for GNU libc 2.1)
|
|
AC_EGREP_CPP(yes, [
|
|
#include <features.h>
|
|
#if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
|
|
yes
|
|
#endif], [glibc=yes; AC_MSG_RESULT(yes)], AC_MSG_RESULT(no))
|
|
AC_DEFINE(LINUX_IPV6)
|
|
if test "$glibc" != "yes"; then
|
|
INCLUDES="-I/usr/inet6/include"
|
|
if test x`ls /usr/inet6/lib/libinet6.a 2>/dev/null` != x;then
|
|
LIB_IPV6="-L/usr/inet6/lib -linet6"
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
fi
|
|
|
|
dnl -----------------------
|
|
dnl Set IPv6 related values
|
|
dnl -----------------------
|
|
LIBS="$LIB_IPV6 $LIBS"
|
|
AC_SUBST(LIB_IPV6)
|
|
|
|
dnl -----------------------------------
|
|
dnl check sin6_scope_id of sockaddr_in6
|
|
dnl -----------------------------------
|
|
if test "$cv_ipv6" = yes; then
|
|
AC_MSG_CHECKING(whether struct sockaddr_in6 has a sin6_scope_id field)
|
|
AC_TRY_COMPILE([#include <sys/types.h>
|
|
#include <netinet/in.h>
|
|
],[static struct sockaddr_in6 ac_i;int ac_j = sizeof(ac_i.sin6_scope_id);],
|
|
[AC_MSG_RESULT(yes)
|
|
AC_DEFINE(HAVE_SIN6_SCOPE_ID)],
|
|
AC_MSG_RESULT(no))
|
|
fi
|
|
|
|
dnl -----------------------------------
|
|
dnl Check for New Socket API (RFC2292BIS)
|
|
dnl -----------------------------------
|
|
AC_MSG_CHECKING(for rfc2292bis support)
|
|
AC_TRY_COMPILE([#include <sys/types.h>
|
|
#include <netinet/in.h>],
|
|
[int x = IPV6_RECVPKTINFO;],
|
|
[AC_DEFINE(USE_RFC2292BIS)
|
|
AC_MSG_RESULT(yes)],
|
|
[AC_MSG_RESULT(no)])
|
|
|
|
|
|
AC_MSG_CHECKING(for struct in_pktinfo)
|
|
AC_TRY_COMPILE([#include <sys/types.h>
|
|
#include <netinet/in.h>],
|
|
[struct in_pktinfo x; x.ipi_ifindex = 0;],
|
|
[AC_DEFINE(HAVE_PKTINFO)
|
|
AC_MSG_RESULT(yes)],
|
|
[AC_MSG_RESULT(no)])
|
|
|
|
dnl This is taken from the ethereal configuration scripts.
|
|
dnl We check whether user wants to build gtk-based programs
|
|
dnl These need to be enabled explicitly
|
|
GTK_OK=yes
|
|
|
|
# GTK checks
|
|
# We don't add $GLIB_LIBS to LIBS, because we don't want to force all
|
|
# programs to be built with GTK+.
|
|
#
|
|
|
|
AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no)
|
|
if test "x$GTK_OK" = "xno" ; then
|
|
AC_MSG_RESULT(GTK distribution not found - disabling sctpd compilation.)
|
|
AC_MSG_RESULT(On FreeBSD, you might want to do: ln -s gtk12-config gtk-config)
|
|
fi
|
|
|
|
# GLib checks
|
|
# This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
|
|
# GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
|
|
# However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
|
|
# set when generating the Makefile, so we can make programs that require
|
|
# only GLib link with @GLIB_LIBS@ and make programs that require GTK+
|
|
# link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
|
|
# We don't add $GLIB_LIBS to LIBS, because we don't want to force all
|
|
# programs to be built with GLib.
|
|
#
|
|
|
|
enable_sctpd="no"
|
|
# gtkprogs_bin=""
|
|
sctpd_SUBDIRS=""
|
|
# Honor GLIB_CFLAGS
|
|
AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found. On FreeBSD do: ln -s glib12-config glib-config), gmodule)
|
|
|
|
|
|
#AC_SUBST(gtkprogs_bin)
|
|
AC_SUBST(sctp_SUBDIRS)
|
|
|
|
|
|
dnl Checks for library functions.
|
|
AC_CHECK_LIB(socket, socket)
|
|
AC_CHECK_LIB(nsl, gethostbyname)
|
|
AC_CHECK_LIB(sctp, sctp_eventloop)
|
|
|
|
dnl removed libefence....this should be used though, when we REALLY debug :-)
|
|
AC_CHECK_LIB(efence, malloc)
|
|
AC_CHECK_LIB(glib, g_main_add_poll)
|
|
|
|
|
|
AC_CHECK_HEADERS(ncurses.h, AC_DEFINE(HAVE_NCURSES_H))
|
|
# AC_CHECK_HEADERS(curses.h, AC_DEFINE(HAVE_CURSES_H))
|
|
AC_CHECK_LIB(ncurses, initscr, found_ncurses_lib=yes,found_ncurses_lib=no)
|
|
|
|
if test "x$found_ncurses_lib" = "xyes" -a "x$ac_cv_header_ncurses_h" = "xyes" ; then
|
|
curses_LIBS="-lncurses"
|
|
# CPPFLAGS="$CPPFLAGS -I/usr/include/ncurses.h"
|
|
cursesprogs_BIN="monitor chat echo_monitor"
|
|
else
|
|
# AC_CHECK_LIB(curses, initscr, found_curses_lib=yes,found_curses_lib=no)
|
|
# if test "x$found_curses_lib" = "xyes" -a "x$ac_cv_header_curses_h" = "xyes" ; then
|
|
# curses_LIBS="-lcurses"
|
|
# CPPFLAGS="$CPPFLAGS -I/usr/include/curses.h"
|
|
# cursesprogs_BIN="monitor chat echo_monitor"
|
|
# else
|
|
cursesprogs_BIN=""
|
|
curses_LIBS=""
|
|
AC_MSG_WARN(nCurses libraries seem to be missing. Not compiling Curses-Programs! Please contact ajung@exp-math.uni-essen.de in case this test should not have failed!)
|
|
# fi
|
|
fi
|
|
AC_SUBST(cursesprogs_BIN)
|
|
AC_SUBST(curses_LIBS)
|
|
|
|
if test "$GTK_OK" = "yes" ; then
|
|
sctp_LIBS="-L/usr/local/lib/ -lsctp"
|
|
gtk_LIBS="$GTK_LIBS"
|
|
glib_LIBS="$GLIB_LIBS"
|
|
else
|
|
sctp_LIBS="-L/usr/local/lib/ -lsctp"
|
|
gtk_LIBS=""
|
|
glib_LIBS="$GLIB_LIBS"
|
|
fi
|
|
|
|
AC_SUBST(sctp_LIBS)
|
|
AC_SUBST(gtk_LIBS)
|
|
AC_SUBST(glib_LIBS)
|
|
|
|
AC_CHECK_LIB(c, inet_ntop, [AC_DEFINE(HAVE_INET_NTOP)])
|
|
AC_CHECK_LIB(c, inet_pton, [AC_DEFINE(HAVE_INET_PTON)])
|
|
AC_CHECK_LIB(c, inet_aton, [AC_DEFINE(HAVE_INET_ATON)])
|
|
|
|
dnl Checks for library functions.
|
|
AC_FUNC_VPRINTF
|
|
AC_FUNC_MEMCMP
|
|
AC_CHECK_FUNCS(gettimeofday socket strerror poll getuid setuid geteuid random)
|
|
AC_CHECK_FUNCS(getaddrinfo, [have_getaddrinfo=yes], [have_getaddrinfo=no])
|
|
|
|
|
|
dnl checks for host/build/target system type
|
|
AC_CANONICAL_HOST
|
|
case $host_os in
|
|
bsdi*)
|
|
CFLAGS="$CFLAGS -DBSDI"
|
|
thread_LIBS="-lpthread"
|
|
# CFLAGS="$CFLAGS `glib-config --cflags`"
|
|
#LDFLAGS="$LDFLAGS `glib-config --libs`"
|
|
;;
|
|
freebsd*)
|
|
CFLAGS="$CFLAGS -DFreeBSD -Wall -pthread"
|
|
CXXFLAGS="$CXXFLAGS -DFreeBSD -Wall -pthread"
|
|
thread_LIBS=""
|
|
# CFLAGS="$CFLAGS `glib12-config --cflags`"
|
|
#LDFLAGS="$LDFLAGS `glib12-config --libs`"
|
|
;;
|
|
hpux*)
|
|
CFLAGS="$CFLAGS -DSNAKE"
|
|
test -z "$GCC" && TRY_CFLAGS="$TRY_CFLAGS -Wp,-H600000"
|
|
thread_LIBS="-lpthread"
|
|
# CFLAGS="$CFLAGS `glib-config --cflags`"
|
|
#LDFLAGS="$LDFLAGS `glib-config --libs`"
|
|
;;
|
|
linux*)
|
|
CFLAGS="$CFLAGS -Wall -DLINUX "
|
|
CXXFLAGS="$CXXFLAGS -Wall -DLINUX "
|
|
thread_LIBS="-lpthread"
|
|
# CFLAGS="$CFLAGS `glib-config --cflags`"
|
|
#LDFLAGS="`glib-config --libs` $LDFLAGS"
|
|
;;
|
|
openbsd*)
|
|
LIBS="$LIBS -lcompat"
|
|
thread_LIBS="-lpthread"
|
|
# CFLAGS="$CFLAGS `glib-config --cflags`"
|
|
#LDFLAGS="$LDFLAGS `glib-config --libs`"
|
|
;;
|
|
solaris*)
|
|
CFLAGS="$CFLAGS -Wall -DSOLARIS -D__sun -DSUN -DSUNOS_5"
|
|
CXXFLAGS="$CXXFLAGS -Wall -DSOLARIS -D__sun -DSUN -DSUNOS_5"
|
|
thread_LIBS="-lpthread"
|
|
LDFLAGS="$LDFLAGS -lsocket -lnsl -lrt -lresolv"
|
|
# CFLAGS="$CFLAGS `glib-config --cflags`"
|
|
# LDFLAGS="$LDFLAGS `glib-config --libs`"
|
|
;;
|
|
sunos4*)
|
|
CFLAGS="$CFLAGS -DSUN -DSUN4"
|
|
thread_LIBS="-lpthread"
|
|
# CFLAGS="$CFLAGS `glib-config --cflags`"
|
|
# LDFLAGS="$LDFLAGS `glib-config --libs`"
|
|
;;
|
|
darwin*)
|
|
CFLAGS="$CFLAGS -DDARWIN"
|
|
CXXFLAGS="$CXXFLAGS -DDARWIN"
|
|
thread_LIBS="-lpthread"
|
|
# CFLAGS="$CFLAGS `glib-config --cflags`"
|
|
# LDFLAGS="$LDFLAGS `glib-config --libs`"
|
|
;;
|
|
esac
|
|
AC_SUBST(thread_LIBS)
|
|
|
|
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
AC_C_CONST
|
|
AC_TYPE_SIZE_T
|
|
AC_STRUCT_TM
|
|
AC_CHECK_SIZEOF(char, 1)
|
|
AC_CHECK_SIZEOF(short, 2)
|
|
AC_CHECK_SIZEOF(int, 4)
|
|
AC_CHECK_SIZEOF(long, 4)
|
|
AC_CHECK_SIZEOF(long long, 8)
|
|
|
|
AC_MSG_CHECKING(for type socklen_t)
|
|
AC_TRY_COMPILE([#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
#include <unistd.h>
|
|
#include <netinet/in.h>],
|
|
[socklen_t x; x = 0;],
|
|
[AC_DEFINE(HAVE_SOCKLEN_T)
|
|
AC_MSG_RESULT(yes)],
|
|
[AC_MSG_RESULT(no)])
|
|
|
|
|
|
|
|
|
|
dnl add here all your Makefiles. These will be created by configure
|
|
AC_OUTPUT(Makefile sualibrary/Makefile sualibrary/docs/Makefile sualibrary/docs/en/Makefile sualibrary/sua/Makefile sualibrary/testup/Makefile )
|