Annotation of embedaddon/mtr/configure.ac, revision 1.1.1.4

1.1.1.3   misho       1: AC_PREREQ([2.59])
                      2: AC_INIT([mtr],
                      3:   [m4_esyscmd([build-aux/git-version-gen .tarball-version])],
                      4:   [R.E.Wolff@BitWizard.nl], [],
                      5:   [http://www.BitWizard.nl/mtr/])
                      6: AC_CONFIG_SRCDIR([ui/mtr.c])
                      7: AC_CONFIG_AUX_DIR([build-aux])
                      8: AC_USE_SYSTEM_EXTENSIONS
                      9: AM_INIT_AUTOMAKE([
                     10:   1.7.9
                     11:   foreign
                     12:   subdir-objects
                     13: ])
                     14: 
                     15: # --enable-silent-rules
                     16: m4_ifdef([AM_SILENT_RULES],
                     17:   [AM_SILENT_RULES([yes])],
                     18:   [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
1.1       misho      19: 
1.1.1.3   misho      20: AC_CANONICAL_HOST
1.1       misho      21: AC_PROG_CC
                     22: 
1.1.1.3   misho      23: # Check pkg-config availability.
1.1.1.4 ! misho      24: m4_ifndef([PKG_CHECK_MODULES], [m4_defun([PKG_CHECK_MODULES], [AC_MSG_ERROR(
1.1.1.3   misho      25: [Could not locate the pkg-config autoconf macros.  These are usually located
                     26: in /usr/share/aclocal/pkg.m4.  If your macros are in a different location,
                     27: try setting the environment variable ACLOCAL_OPTS="-I/other/macro/dir"
1.1.1.4 ! misho      28: before running ./bootstrap.sh again, or configure --without-gtk ----without-jansson ])])
1.1.1.3   misho      29: ])
                     30: PKG_PROG_PKG_CONFIG
                     31: 
                     32: AM_CONDITIONAL([CYGWIN], [test "$host_os" = cygwin])
1.1.1.4 ! misho      33: AM_COND_IF([CYGWIN],
        !            34:            [AC_DEFINE([USING_CYGWIN], [1], [Building Under Cygwin.])],
        !            35:            [])
1.1.1.3   misho      36: 
                     37: # Check bytes in types.
                     38: AC_CHECK_SIZEOF([unsigned char], [1])
                     39: AC_CHECK_SIZEOF([unsigned short], [2])
                     40: AC_CHECK_SIZEOF([unsigned int], [4])
                     41: AC_CHECK_SIZEOF([unsigned long], [4])
                     42: 
                     43: # Check headers.
                     44: AC_CHECK_HEADERS([ \
                     45:   arpa/nameser_compat.h \
                     46:   curses.h \
                     47:   cursesX.h \
                     48:   error.h \
                     49:   fcntl.h \
                     50:   linux/icmp.h \
1.1.1.4 ! misho      51:   linux/errqueue.h \
1.1.1.3   misho      52:   ncurses.h \
                     53:   ncurses/curses.h \
                     54:   netinet/in.h \
                     55:   socket.h \
                     56:   sys/cdefs.h \
                     57:   sys/limits.h \
                     58:   sys/socket.h \
                     59:   stdio_ext.h \
                     60:   sys/types.h \
                     61:   sys/xti.h \
                     62:   values.h \
                     63: ])
                     64: 
                     65: # Check functions.
                     66: AC_CHECK_FUNCS([ \
                     67:   __fpending \
                     68:   fcntl \
                     69: ])
                     70: 
                     71: AC_CHECK_FUNC([error], [with_error=no],
                     72:   [AC_CHECK_FUNCS([verr verrx vwarn vwarnx], [with_error=yes],
                     73:     [AC_MSG_ERROR([cannot find working error printing function])
                     74:   ])
                     75: ])
                     76: AM_CONDITIONAL([WITH_ERROR], [test "x$with_error" = "xyes"])
                     77: 
                     78: AC_CHECK_FUNC([getopt_long], [with_getopt=no], [with_getopt=yes])
                     79: AS_IF([test "x$with_getopt" = "xno"], [
                     80:   AC_DEFINE([HAVE_GETOPT], [1], [Define if libc has getopt_long])
                     81: ])
                     82: AM_CONDITIONAL([WITH_GETOPT], [test "x$with_getopt" = "xyes"])
                     83: 
                     84: AC_CHECK_LIB([m], [floor], [], [AC_MSG_ERROR([No math library found])])
                     85: 
1.1.1.4 ! misho      86: # libasan
        !            87: AC_ARG_WITH([libasan],
        !            88:  [AS_HELP_STRING([--with-libasan], [Build with AddressSanitizer])],
        !            89:  [with_libasan=yes], [])
        !            90: AM_CONDITIONAL([WITH_LIBASAN], [test "x$with_libasan" = "xyes"])
        !            91: 
1.1.1.3   misho      92: # Find GTK
                     93: AC_ARG_WITH([gtk],
1.1.1.4 ! misho      94:   [AS_HELP_STRING([--without-gtk], [Build without the GTK+ interface])],
1.1.1.3   misho      95:   [], [with_gtk=yes])
                     96: AS_IF([test "x$with_gtk" = "xyes"],
1.1.1.4 ! misho      97:   [PKG_CHECK_MODULES([GTK], [gtk+-3.0],
        !            98:     [AC_DEFINE([HAVE_GTK], [1], [Define if gtk+ library available])]
        !            99:       [AC_DEFINE([HAVE_GTK3], [1], [Define if gtk+-3.0 library available])],
        !           100:     [PKG_CHECK_MODULES([GTK], [gtk+-2.0],
        !           101:       [AC_DEFINE([HAVE_GTK], [1], [Define if gtk+ library available])],
        !           102:       [with_gtk=no])])
1.1.1.3   misho     103: ])
                    104: AM_CONDITIONAL([WITH_GTK], [test "x$with_gtk" = xyes])
                    105: 
1.1.1.4 ! misho     106: AC_ARG_WITH([jansson],
        !           107:   [AS_HELP_STRING([--without-jansson], [Build without JSON output])],
        !           108:   [], [with_jansson=yes])
        !           109: AS_IF([test "x$with_jansson" = "xyes"],
        !           110:   [PKG_CHECK_MODULES([JANSSON], [jansson],
        !           111:     [AC_DEFINE([HAVE_JANSSON], [1], [Define if jansson library available])],
        !           112:     [with_jansson=no])
        !           113: ])
        !           114: 
1.1.1.3   misho     115: # Find ncurses
                    116: AC_ARG_WITH([ncurses],
                    117:   [AS_HELP_STRING([--without-ncurses], [Build without the ncurses interface])],
                    118:   [], [with_ncurses=yes])
                    119: AS_IF([test "x$with_ncurses" = "xyes"],
                    120: 
                    121:   # Prefer ncurses over curses, if both are available.
                    122:   # (On Solaris 11.3, ncurses builds and links for us, but curses does not.)
                    123:   [AC_SEARCH_LIBS(
                    124:     [initscr], [ncurses curses],
                    125:     [AC_DEFINE([HAVE_CURSES], [1], [Define if a curses library available])],
                    126:     [with_ncurses=no])
                    127: ])
                    128: AM_CONDITIONAL([WITH_CURSES], [test "x$with_ncurses" = xyes])
                    129: 
1.1.1.4 ! misho     130: AC_CHECK_LIB([cap], [cap_set_proc], [have_cap="yes"],
1.1.1.3   misho     131:   AS_IF([test "$host_os" = linux-gnu],
                    132:     AC_MSG_WARN([Capabilities support is strongly recommended for increased security.  See SECURITY for more information.])))
1.1       misho     133: 
1.1.1.3   misho     134: # Enable ipinfo
1.1       misho     135: AC_ARG_WITH([ipinfo],
1.1.1.3   misho     136:   [AS_HELP_STRING([--without-ipinfo], [Do not try to use ipinfo lookup at all])],
                    137:   [], [with_ipinfo=yes])
                    138: AM_CONDITIONAL([WITH_IPINFO], [test "x$with_ipinfo" = "xyes"])
                    139: AS_IF([test "x$with_ipinfo" = "xyes"], [
                    140:   AC_DEFINE([HAVE_IPINFO], [1], [Define when ipinfo lookups are in use])
                    141: ])
                    142: 
                    143: AC_ARG_ENABLE([ipv6],
                    144:   [AS_HELP_STRING([--disable-ipv6], [Do not enable IPv6])],
                    145:   [WANTS_IPV6=$enableval], [WANTS_IPV6=yes])
                    146: 
                    147: AS_IF([test "x$WANTS_IPV6" = "xyes"], [
                    148:   AC_DEFINE([ENABLE_IPV6], [1], [Define to enable IPv6])
                    149:   USES_IPV6=yes
                    150: ])
                    151: 
                    152: AC_CHECK_FUNC([socket], [],
                    153:   [AC_CHECK_LIB([socket], [socket], [], [AC_MSG_ERROR([No socket library found])])])
                    154: 
                    155: AC_CHECK_FUNC([gethostbyname], [],
                    156:   [AC_CHECK_LIB([nsl], [gethostbyname], [], [AC_MSG_ERROR([No nameservice library found])])])
                    157: 
                    158: # Find resolver library.
                    159: AC_CHECK_FUNC([res_query], [RESOLV_LIBS=""], [
                    160:   AC_CHECK_LIB([resolv], [__res_query], [RESOLV_LIBS="-lresolv"], [
                    161:     AC_CHECK_LIB([resolv], [res_query], [RESOLV_LIBS="-lresolv"], [
                    162:       AC_CHECK_LIB([bind], [res_query], [RESOLV_LIBS="-lbind"], [
                    163:         AC_MSG_ERROR([No resolver library found])
                    164:       ])
                    165:     ])
                    166:   ])
                    167: ])
                    168: dnl MacOS has res_query in libc, but needs libresolv for dn_expand().
                    169: AS_IF([test "x" = "x$RESOLV_LIBS"], [
                    170:   AC_CHECK_LIB([resolv], [dn_expand], [RESOLV_LIBS="-lresolv"])
                    171: ])
                    172: AC_SUBST([RESOLV_LIBS])
1.1       misho     173: 
1.1.1.3   misho     174: # Check errno and socket data types.
                    175: AC_CHECK_DECLS([errno], [], [], [[
1.1       misho     176: #include <errno.h>
                    177: #include <sys/errno.h>
1.1.1.3   misho     178:   ]])
1.1       misho     179: 
1.1.1.3   misho     180: AC_CHECK_TYPE([socklen_t],
                    181:   [AC_DEFINE([HAVE_SOCKLEN_T], [], [Define if your system has socklen_t])], [],
                    182:   [[#include <netinet/in.h>
1.1       misho     183: #ifdef HAVE_SOCKET_H
                    184: #include <socket.h>
                    185: #endif
                    186: #ifdef HAVE_SYS_SOCKET_H
                    187: #include <sys/socket.h>
1.1.1.3   misho     188: #endif]])
1.1       misho     189: 
1.1.1.3   misho     190: AC_CHECK_TYPES([time_t], [], [], [[
                    191: #include <time.h>
1.1       misho     192: ]])
                    193: 
1.1.1.3   misho     194: # Add C flags to display more warnings
                    195: AC_MSG_CHECKING([for C flags to get more warnings])
1.1       misho     196: ac_save_CFLAGS="$CFLAGS"
1.1.1.3   misho     197: 
                    198: AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
1.1       misho     199:   dnl gcc is the easiest C compiler
                    200:   warning_CFLAGS="-Wall"
                    201:   # Check if compiler supports -Wno-pointer-sign and add it if supports
                    202:   CFLAGS_saved="$CFLAGS"
                    203:   CFLAGS="$CFLAGS -Wno-pointer-sign"
1.1.1.3   misho     204:   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int foo;]])],
                    205:     [warning_CFLAGS="${warning_CFLAGS} -Wno-pointer-sign"], [])
1.1       misho     206:   CFLAGS="$CFLAGS_saved"
1.1.1.3   misho     207: ], [
1.1       misho     208:   dnl Vendor supplied C compilers are a bit tricky
1.1.1.3   misho     209:   AS_CASE([$host_os],
1.1       misho     210:     dnl SGI IRIX with the MipsPRO C compiler
1.1.1.3   misho     211:     [irix*], [
1.1       misho     212:       CFLAGS="$CFLAGS -fullwarn"
1.1.1.3   misho     213:       AC_COMPILE_IFELSE([
                    214:         AC_LANG_PROGRAM(
                    215:           [[#include <stdio.h>]],
                    216:           [[printf("test");]])],
                    217:         [warning_CFLAGS="-fullwarn"], []
                    218:       )
                    219:     ],
1.1       misho     220:     dnl SunOS 4.x with the SparcWorks(?) acc compiler
1.1.1.3   misho     221:     [sunos*], [
                    222:       AS_IF([test "$CC" = "acc"], [
                    223:         CFLAGS="$CFLAGS -vc"
                    224:         AC_COMPILE_IFELSE([
                    225:           AC_LANG_PROGRAM(
                    226:             [[#include <stdio.h>]],
                    227:             [[printf("test");]])],
                    228:           [warning_CFLAGS="-vc"], []
                    229:         )
                    230:       ])
                    231:     ]
1.1       misho     232:     dnl Unknown, do nothing
1.1.1.3   misho     233:     [*], [
1.1       misho     234:       warning_CFLAGS="none"
1.1.1.3   misho     235:     ]
                    236:   )
                    237: ])
1.1       misho     238: CFLAGS="$ac_save_CFLAGS"
                    239: 
1.1.1.3   misho     240: AS_IF([test "$warning_CFLAGS" = "none"], [
                    241:   AC_MSG_RESULT([none])
                    242: ], [
                    243:   CFLAGS="$CFLAGS $warning_CFLAGS"
                    244:   AC_MSG_RESULT([$warning_CFLAGS])
                    245: ])
1.1       misho     246: 
1.1.1.3   misho     247: # bash-completion
                    248: AC_ARG_WITH([bashcompletiondir],
                    249:   AS_HELP_STRING([--with-bashcompletiondir=DIR], [Bash completions directory]),
                    250:   [],
                    251:   [AS_IF([`$PKG_CONFIG --exists bash-completion`], [
                    252:     with_bashcompletiondir=`$PKG_CONFIG --variable=completionsdir bash-completion`
                    253:   ], [
                    254:     with_bashcompletiondir=${datadir}/bash-completion/completions
                    255:   ])
                    256: ])
                    257: AC_SUBST([bashcompletiondir], [$with_bashcompletiondir])
                    258: AC_ARG_ENABLE([bash-completion],
                    259:   AS_HELP_STRING([--disable-bash-completion], [do not install bash completion files]),
                    260:   [], [enable_bash_completion=yes]
                    261: )
                    262: AM_CONDITIONAL([BUILD_BASH_COMPLETION], [test "x$enable_bash_completion" = xyes])
1.1.1.4 ! misho     263: echo "build options:"
        !           264: echo "--------------"
        !           265: echo "libasan :$with_libasan"
        !           266: echo "ipv6    :$USES_IPV6"
        !           267: echo "ipinfo  :$with_ipinfo"
        !           268: echo "ncurses :$with_ncurses"
        !           269: echo "gtk     :$with_gtk"
        !           270: echo "jansson :$with_jansson"
        !           271: echo "cap     :$have_cap"
        !           272: echo "libs    :$LIBS"
        !           273: echo "cflags  :$CFLAGS"
        !           274: echo "--------------"
1.1.1.3   misho     275: # Prepare config.h, Makefile, and output them.
1.1       misho     276: AC_CONFIG_HEADERS([config.h])
1.1.1.3   misho     277: AC_CONFIG_FILES([Makefile])
1.1       misho     278: AC_OUTPUT

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>