version 1.1.1.2, 2016/11/01 09:33:48
|
version 1.1.1.3, 2019/10/21 14:25:31
|
Line 1
|
Line 1
|
AC_INIT([mtr], [0.86]) | AC_PREREQ([2.59]) |
AC_CONFIG_SRCDIR([mtr.c]) | AC_INIT([mtr], |
AM_INIT_AUTOMAKE([foreign]) | [m4_esyscmd([build-aux/git-version-gen .tarball-version])], |
| [R.E.Wolff@BitWizard.nl], [], |
| [http://www.BitWizard.nl/mtr/]) |
| AC_CONFIG_SRCDIR([ui/mtr.c]) |
| AC_CONFIG_AUX_DIR([build-aux]) |
| AC_USE_SYSTEM_EXTENSIONS |
| AM_INIT_AUTOMAKE([ |
| 1.7.9 |
| foreign |
| subdir-objects |
| ]) |
|
|
AC_CONFIG_FILES([version.h.tmp:version.h.in]) | # --enable-silent-rules |
| m4_ifdef([AM_SILENT_RULES], |
| [AM_SILENT_RULES([yes])], |
| [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) |
|
|
AC_SUBST(GTK_OBJ) | AC_CANONICAL_HOST |
AC_SUBST(CURSES_OBJ) | |
| |
GTK_OBJ=gtk.o | |
CURSES_OBJ=curses.o | |
| |
AC_PROG_CC |
AC_PROG_CC |
|
|
AC_CHECK_SIZEOF(unsigned char, 1) | # Check pkg-config availability. |
AC_CHECK_SIZEOF(unsigned short, 2) | m4_ifndef([PKG_PROG_PKG_CONFIG], |
AC_CHECK_SIZEOF(unsigned int, 4) | [m4_fatal( |
AC_CHECK_SIZEOF(unsigned long, 4) | [Could not locate the pkg-config autoconf macros. These are usually located |
| in /usr/share/aclocal/pkg.m4. If your macros are in a different location, |
| try setting the environment variable ACLOCAL_OPTS="-I/other/macro/dir" |
| before running ./bootstrap.sh again.]) |
| ]) |
| PKG_PROG_PKG_CONFIG |
|
|
AC_CHECK_HEADERS(ncurses.h ncurses/curses.h curses.h cursesX.h sys/types.h fcntl.h) | AM_CONDITIONAL([CYGWIN], [test "$host_os" = cygwin]) |
AC_CHECK_HEADERS(socket.h sys/socket.h sys/xti.h arpa/nameser_compat.h) | |
|
|
# We don't refer to any symbols in termcap, but -lcurses on SunOS does. | # Check bytes in types. |
# We have to trust the linker not to mess things up... (It should not | AC_CHECK_SIZEOF([unsigned char], [1]) |
# pull in anything if we don't refer to anything in the lib). | AC_CHECK_SIZEOF([unsigned short], [2]) |
AC_CHECK_LIB(termcap, tgetent) | AC_CHECK_SIZEOF([unsigned int], [4]) |
AC_CHECK_LIB(tinfo, tgetent) | AC_CHECK_SIZEOF([unsigned long], [4]) |
|
|
AC_CHECK_FUNC(initscr, , | # Check headers. |
AC_CHECK_LIB(ncurses, initscr, , | AC_CHECK_HEADERS([ \ |
AC_CHECK_LIB(curses, initscr, , | arpa/nameser_compat.h \ |
AC_CHECK_LIB(cursesX, initscr, , | curses.h \ |
AC_MSG_WARN(Building without curses display support) | cursesX.h \ |
AC_DEFINE(NO_CURSES, 1, Define if you don't have the curses libraries available.) | error.h \ |
CURSES_OBJ=)))) | fcntl.h \ |
| linux/icmp.h \ |
| ncurses.h \ |
| ncurses/curses.h \ |
| netinet/in.h \ |
| socket.h \ |
| sys/cdefs.h \ |
| sys/limits.h \ |
| sys/socket.h \ |
| stdio_ext.h \ |
| sys/types.h \ |
| sys/xti.h \ |
| values.h \ |
| ]) |
|
|
AC_CHECK_FUNCS(attron fcntl) | # Check functions. |
| AC_CHECK_FUNCS([ \ |
| __fpending \ |
| fcntl \ |
| ]) |
|
|
AC_CHECK_LIB(m, floor, , AC_MSG_ERROR(No math library found)) | AC_CHECK_FUNC([error], [with_error=no], |
| [AC_CHECK_FUNCS([verr verrx vwarn vwarnx], [with_error=yes], |
| [AC_MSG_ERROR([cannot find working error printing function]) |
| ]) |
| ]) |
| AM_CONDITIONAL([WITH_ERROR], [test "x$with_error" = "xyes"]) |
|
|
AC_ARG_WITH(gtk, | AC_CHECK_FUNC([getopt_long], [with_getopt=no], [with_getopt=yes]) |
[ --without-gtk Do not try to use GTK+ at all], | AS_IF([test "x$with_getopt" = "xno"], [ |
WANTS_GTK=$withval, WANTS_GTK=yes) | AC_DEFINE([HAVE_GETOPT], [1], [Define if libc has getopt_long]) |
| ]) |
| AM_CONDITIONAL([WITH_GETOPT], [test "x$with_getopt" = "xyes"]) |
|
|
AC_ARG_WITH([ipinfo], | AC_CHECK_LIB([m], [floor], [], [AC_MSG_ERROR([No math library found])]) |
[ --without-ipinfo Do not try to use ipinfo lookup at all], | |
[ipinfo="${withval}"], [ipinfo=yes]) | |
AM_CONDITIONAL([IPINFO], [test x$ipinfo = xyes]) | |
|
|
AC_ARG_ENABLE(ipv6, | # Find GTK |
[ --disable-ipv6 Do not enable IPv6], | AC_ARG_WITH([gtk], |
WANTS_IPV6=$enableval, WANTS_IPV6=yes) | [AS_HELP_STRING([--without-gtk], [Build without the GTK+2.0 interface])], |
| [], [with_gtk=yes]) |
| AS_IF([test "x$with_gtk" = "xyes"], |
| [PKG_CHECK_MODULES([GTK], [gtk+-2.0], |
| [AC_DEFINE([HAVE_GTK], [1], [Define if gtk+-2.0 library available])], |
| [with_gtk=no]) |
| ]) |
| AM_CONDITIONAL([WITH_GTK], [test "x$with_gtk" = xyes]) |
|
|
m4_ifndef([AM_PATH_GTK_2_0], [m4_defun([AM_PATH_GTK_2_0], [AC_MSG_ERROR([ | # Find ncurses |
Could not locate the gtk2 automake macros, these are usually located in | AC_ARG_WITH([ncurses], |
.../share/aclocal/gtk-2.0.m4 | [AS_HELP_STRING([--without-ncurses], [Build without the ncurses interface])], |
Before running bootstrap try setting the environment variable | [], [with_ncurses=yes]) |
ACLOCAL_PATH="/own/dir" | AS_IF([test "x$with_ncurses" = "xyes"], |
or configure --without-gtk. | |
])])]) | |
| |
if test "x$WANTS_GTK" = "xyes"; then | |
AM_PATH_GTK_2_0(2.6.0, CFLAGS="$CFLAGS $GTK_CFLAGS" | |
LIBS="$LIBS $GTK_LIBS -lm", | |
AC_MSG_WARN(Building without GTK2 display support) | |
AC_DEFINE(NO_GTK, 1, [Define if you don't have the GTK+ libraries available.]) | |
GTK_OBJ="") | |
else | |
AC_DEFINE(NO_GTK) | |
GTK_OBJ="" | |
fi | |
|
|
if test "x$ipinfo" = "xno"; then | # Prefer ncurses over curses, if both are available. |
AC_DEFINE([NO_IPINFO], [1], [Define to disable ipinfo lookup]) | # (On Solaris 11.3, ncurses builds and links for us, but curses does not.) |
fi | [AC_SEARCH_LIBS( |
| [initscr], [ncurses curses], |
| [AC_DEFINE([HAVE_CURSES], [1], [Define if a curses library available])], |
| [with_ncurses=no]) |
| ]) |
| AM_CONDITIONAL([WITH_CURSES], [test "x$with_ncurses" = xyes]) |
|
|
AC_CHECK_FUNC(socket, , | AC_CHECK_LIB([cap], [cap_set_proc], [], |
AC_CHECK_LIB(socket, socket, , AC_MSG_ERROR(No socket library found))) | AS_IF([test "$host_os" = linux-gnu], |
| AC_MSG_WARN([Capabilities support is strongly recommended for increased security. See SECURITY for more information.]))) |
|
|
AC_CHECK_FUNC(gethostbyname, , | # Enable ipinfo |
AC_CHECK_LIB(nsl, gethostbyname, , AC_MSG_ERROR(No nameservice library found))) | AC_ARG_WITH([ipinfo], |
| [AS_HELP_STRING([--without-ipinfo], [Do not try to use ipinfo lookup at all])], |
| [], [with_ipinfo=yes]) |
| AM_CONDITIONAL([WITH_IPINFO], [test "x$with_ipinfo" = "xyes"]) |
| AS_IF([test "x$with_ipinfo" = "xyes"], [ |
| AC_DEFINE([HAVE_IPINFO], [1], [Define when ipinfo lookups are in use]) |
| ]) |
|
|
#AC_CHECK_FUNC(res_init, , | AC_ARG_ENABLE([ipv6], |
# AC_CHECK_LIB(bind, res_init, , | [AS_HELP_STRING([--disable-ipv6], [Do not enable IPv6])], |
# AC_CHECK_LIB(resolv, res_init, , AC_MSG_ERROR(No resolver library found)))) | [WANTS_IPV6=$enableval], [WANTS_IPV6=yes]) |
|
|
AC_CHECK_FUNCS(seteuid) | AS_IF([test "x$WANTS_IPV6" = "xyes"], [ |
# AC_CHECK_FUNC(setuid, , AC_MSG_ERROR (I Need either seteuid or setuid)) | AC_DEFINE([ENABLE_IPV6], [1], [Define to enable IPv6]) |
| USES_IPV6=yes |
| ]) |
|
|
#AC_CHECK_FUNC(res_mkquery, , | AC_CHECK_FUNC([socket], [], |
# AC_CHECK_LIB(bind, res_mkquery, , | [AC_CHECK_LIB([socket], [socket], [], [AC_MSG_ERROR([No socket library found])])]) |
# AC_CHECK_LIB(resolv, res_mkquery, , | |
# AC_CHECK_LIB(resolv, __res_mkquery, , AC_MSG_ERROR(No resolver library found))))) | |
|
|
# See if a library is needed for res_mkquery and if so put it in RESOLV_LIBS | AC_CHECK_FUNC([gethostbyname], [], |
RESOLV_LIBS= | [AC_CHECK_LIB([nsl], [gethostbyname], [], [AC_MSG_ERROR([No nameservice library found])])]) |
AC_SUBST(RESOLV_LIBS) | |
AC_DEFUN([LIBRESOLVTEST_SRC], [ | |
AC_LANG_PROGRAM([[ | |
#include <netinet/in.h> | |
#include <resolv.h> | |
]], [[ | |
int (*res_mkquery_func)(int,...) = (int (*)(int,...))res_mkquery; | |
(void)(*res_mkquery_func)(0); | |
]])]) | |
AC_MSG_CHECKING([whether library required for res_mkquery]) | |
RESOLV_LIB_NONE= | |
AC_LINK_IFELSE([LIBRESOLVTEST_SRC], | |
[AC_MSG_RESULT([no]) | |
RESOLV_LIB_NONE=yes], | |
[AC_MSG_RESULT([yes])]) | |
if test "x$RESOLV_LIB_NONE" = "x"; then | |
AC_MSG_CHECKING([for res_mkquery in -lbind]) | |
STASH_LIBS="$LIBS" | |
LIBS="$STASH_LIBS -lbind" | |
AC_LINK_IFELSE([LIBRESOLVTEST_SRC], | |
[AC_MSG_RESULT([yes]) | |
RESOLV_LIBS=-lbind], | |
[AC_MSG_RESULT([no])]) | |
if test "x$RESOLV_LIBS" = "x"; then | |
AC_MSG_CHECKING([for res_mkquery in -lresolv]) | |
LIBS="$STASH_LIBS -lresolv" | |
AC_LINK_IFELSE([LIBRESOLVTEST_SRC], | |
[AC_MSG_RESULT([yes]) | |
RESOLV_LIBS=-lresolv], | |
[AC_MSG_RESULT([no]) | |
AC_MSG_ERROR(No resolver library found)]) | |
fi | |
LIBS="$STASH_LIBS" | |
fi | |
|
|
AC_CHECK_FUNC(herror, , AC_DEFINE(NO_HERROR, 1, [Define if you don't have the herror() function available.])) | # Find resolver library. |
AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR, 1, [Define if you don't have the strerror() function available.])) | AC_CHECK_FUNC([res_query], [RESOLV_LIBS=""], [ |
| AC_CHECK_LIB([resolv], [__res_query], [RESOLV_LIBS="-lresolv"], [ |
| AC_CHECK_LIB([resolv], [res_query], [RESOLV_LIBS="-lresolv"], [ |
| AC_CHECK_LIB([bind], [res_query], [RESOLV_LIBS="-lbind"], [ |
| AC_MSG_ERROR([No resolver library found]) |
| ]) |
| ]) |
| ]) |
| ]) |
| dnl MacOS has res_query in libc, but needs libresolv for dn_expand(). |
| AS_IF([test "x" = "x$RESOLV_LIBS"], [ |
| AC_CHECK_LIB([resolv], [dn_expand], [RESOLV_LIBS="-lresolv"]) |
| ]) |
| AC_SUBST([RESOLV_LIBS]) |
|
|
USES_IPV6= | # Check errno and socket data types. |
AC_CHECK_FUNC(getaddrinfo, | AC_CHECK_DECLS([errno], [], [], [[ |
[if test "$WANTS_IPV6" = "yes"; then | |
AC_DEFINE([ENABLE_IPV6], [], [Define to enable IPv6]) | |
USES_IPV6=yes | |
fi]) | |
| |
AC_DEFUN([NEED_RES_STATE_EXT_TEST_SRC], [ | |
AC_LANG_PROGRAM([[ | |
#include <netinet/in.h> | |
#include <resolv.h> | |
#ifdef __GLIBC__ | |
#define RESEXTIN6(r,i) (*(r._u._ext.nsaddrs[i])) | |
#else | |
#define RESEXTIN6(r,i) (r._u._ext.ext->nsaddrs[i].sin6) | |
#endif | |
]], [[ | |
struct __res_state res; | |
return RESEXTIN6(res,0).sin6_addr.s6_addr[0]; | |
]])]) | |
AC_DEFUN([DEFINE_RES_STATE_EXT_TEST_SRC], [ | |
AC_LANG_PROGRAM([[ | |
#include <netinet/in.h> | |
#include <resolv.h> | |
#ifdef __GLIBC__ | |
#define RESEXTIN6(r,i) (*(r._u._ext.nsaddrs[i])) | |
#else | |
#define RESEXTIN6(r,i) (r._u._ext.ext->nsaddrs[i].sin6) | |
struct __res_state_ext { | |
union res_sockaddr_union nsaddrs[MAXNS]; | |
struct sort_list { | |
int af; | |
union { | |
struct in_addr ina; | |
struct in6_addr in6a; | |
} addr, mask; | |
} sort_list[MAXRESOLVSORT]; | |
char nsuffix[64]; | |
char nsuffix2[64]; | |
}; | |
#endif | |
]], [[ | |
struct __res_state res; | |
return RESEXTIN6(res,0).sin6_addr.s6_addr[0]; | |
]])]) | |
if test "x$USES_IPV6" = "xyes"; then | |
AC_MSG_CHECKING([whether __res_state_ext needs to be defined]) | |
AC_COMPILE_IFELSE([NEED_RES_STATE_EXT_TEST_SRC], | |
[AC_MSG_RESULT([no])], | |
[AC_MSG_RESULT([yes]) | |
AC_MSG_CHECKING([whether provided __res_state_ext definition can be compiled]) | |
AC_COMPILE_IFELSE([DEFINE_RES_STATE_EXT_TEST_SRC], | |
[AC_MSG_RESULT([yes]) | |
AC_DEFINE(NEED_RES_STATE_EXT, 1, [Define if struct __res_state_ext needs to be defined.])], | |
[AC_MSG_RESULT([no]) | |
AC_MSG_ERROR(Need definition for struct __res_state_ext but unable to define it.)])]) | |
fi | |
| |
AC_CHECK_DECLS(errno, , , [[ | |
#include <errno.h> |
#include <errno.h> |
#include <sys/errno.h> |
#include <sys/errno.h> |
]] ) | ]]) |
|
|
AC_CHECK_TYPE(socklen_t, AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t]) , , [[ | AC_CHECK_TYPE([socklen_t], |
#include <netinet/in.h> | [AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t])], [], |
| [[#include <netinet/in.h> |
#ifdef HAVE_SOCKET_H |
#ifdef HAVE_SOCKET_H |
#include <socket.h> |
#include <socket.h> |
#endif |
#endif |
#ifdef HAVE_SYS_SOCKET_H |
#ifdef HAVE_SYS_SOCKET_H |
#include <sys/socket.h> |
#include <sys/socket.h> |
#endif | #endif]]) |
]]) | |
|
|
AC_CHECK_TYPE(struct in_addr, AC_DEFINE([HAVE_STRUCT_INADDR], [], [Define if you have struct in_addr]), , [[ | AC_CHECK_TYPES([time_t], [], [], [[ |
#include <netinet/in.h> | #include <time.h> |
]]) |
]]) |
|
|
dnl Add C flags to display more warnings | # Add C flags to display more warnings |
AC_MSG_CHECKING(for C flags to get more warnings) | AC_MSG_CHECKING([for C flags to get more warnings]) |
ac_save_CFLAGS="$CFLAGS" |
ac_save_CFLAGS="$CFLAGS" |
if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then | |
| AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [ |
dnl gcc is the easiest C compiler |
dnl gcc is the easiest C compiler |
warning_CFLAGS="-Wall" |
warning_CFLAGS="-Wall" |
# Check if compiler supports -Wno-pointer-sign and add it if supports |
# Check if compiler supports -Wno-pointer-sign and add it if supports |
CFLAGS_saved="$CFLAGS" |
CFLAGS_saved="$CFLAGS" |
CFLAGS="$CFLAGS -Wno-pointer-sign" |
CFLAGS="$CFLAGS -Wno-pointer-sign" |
AC_COMPILE_IFELSE([ AC_LANG_SOURCE([[ int foo; ]])], | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int foo;]])], |
[ warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign" ],) | [warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign"], []) |
CFLAGS="$CFLAGS_saved" |
CFLAGS="$CFLAGS_saved" |
else | ], [ |
dnl Vendor supplied C compilers are a bit tricky |
dnl Vendor supplied C compilers are a bit tricky |
case "$host_os" in | AS_CASE([$host_os], |
dnl SGI IRIX with the MipsPRO C compiler |
dnl SGI IRIX with the MipsPRO C compiler |
irix*) | [irix*], [ |
CFLAGS="$CFLAGS -fullwarn" |
CFLAGS="$CFLAGS -fullwarn" |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("test");]])],[warning_CFLAGS="-fullwarn"],[]) | AC_COMPILE_IFELSE([ |
;; | AC_LANG_PROGRAM( |
| [[#include <stdio.h>]], |
| [[printf("test");]])], |
| [warning_CFLAGS="-fullwarn"], [] |
| ) |
| ], |
dnl SunOS 4.x with the SparcWorks(?) acc compiler |
dnl SunOS 4.x with the SparcWorks(?) acc compiler |
sunos*) | [sunos*], [ |
if "$CC" = "acc" ; then | AS_IF([test "$CC" = "acc"], [ |
CFLAGS="$CFLAGS -vc" | CFLAGS="$CFLAGS -vc" |
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[printf("test");]])],[warning_CFLAGS="-vc"],[]) | AC_COMPILE_IFELSE([ |
fi | AC_LANG_PROGRAM( |
;; | [[#include <stdio.h>]], |
| [[printf("test");]])], |
| [warning_CFLAGS="-vc"], [] |
| ) |
| ]) |
| ] |
dnl Unknown, do nothing |
dnl Unknown, do nothing |
*) | [*], [ |
warning_CFLAGS="none" |
warning_CFLAGS="none" |
;; | ] |
esac | ) |
fi | ]) |
CFLAGS="$ac_save_CFLAGS" |
CFLAGS="$ac_save_CFLAGS" |
if test "$warning_CFLAGS" = "none" ; then | |
AC_MSG_RESULT(none) | AS_IF([test "$warning_CFLAGS" = "none"], [ |
else | AC_MSG_RESULT([none]) |
| ], [ |
CFLAGS="$CFLAGS $warning_CFLAGS" |
CFLAGS="$CFLAGS $warning_CFLAGS" |
AC_MSG_RESULT($warning_CFLAGS) | AC_MSG_RESULT([$warning_CFLAGS]) |
fi | ]) |
|
|
|
# bash-completion |
|
AC_ARG_WITH([bashcompletiondir], |
|
AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]), |
|
[], |
|
[AS_IF([`$PKG_CONFIG --exists bash-completion`], [ |
|
with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion` |
|
], [ |
|
with_bashcompletiondir=${datadir}/bash-completion/completions |
|
]) |
|
]) |
|
AC_SUBST([bashcompletiondir], [$with_bashcompletiondir]) |
|
AC_ARG_ENABLE([bash-completion], |
|
AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]), |
|
[], [enable_bash_completion=yes] |
|
) |
|
AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes]) |
|
|
| # Prepare config.h, Makefile, and output them. |
| |
AC_CONFIG_HEADERS([config.h]) |
AC_CONFIG_HEADERS([config.h]) |
AC_CONFIG_FILES([Makefile img/Makefile]) | AC_CONFIG_FILES([Makefile]) |
AC_OUTPUT |
AC_OUTPUT |
|
|