blob: 56e46830e492f8f9e2586bea3c7f376deaa23fec [file] [log] [blame]
Jeff Garzik32c80372005-10-25 01:56:48 -04001dnl Process this file with autoconf to produce a configure script.
John W. Linville76c46822019-09-23 14:13:22 -04002AC_INIT(ethtool, 5.3, netdev@vger.kernel.org)
Jeff Garzik32c80372005-10-25 01:56:48 -04003AC_PREREQ(2.52)
4AC_CONFIG_SRCDIR([ethtool.c])
5AM_INIT_AUTOMAKE([gnu])
6AC_CONFIG_HEADERS([ethtool-config.h])
7
8AM_MAINTAINER_MODE
9
10dnl Checks for programs.
11AC_PROG_CC
12AC_PROG_GCC_TRADITIONAL
Ben Hutchingscfe91ed2011-10-31 18:42:29 +000013AM_PROG_CC_C_O
Kevin Locke9b802642019-04-19 18:16:21 -060014PKG_PROG_PKG_CONFIG
Jeff Garzik32c80372005-10-25 01:56:48 -040015
16dnl Checks for libraries.
17
18dnl Checks for header files.
Jeff Garzik32c80372005-10-25 01:56:48 -040019
20dnl Checks for typedefs, structures, and compiler characteristics.
Ben Hutchings4f1d68d2010-11-23 15:46:55 +000021AC_MSG_CHECKING([whether <linux/types.h> defines big-endian types])
22AC_TRY_COMPILE([#include <linux/types.h>],
23 [__be16 foo;__be32 bar;],
24 [AC_MSG_RESULT(yes)
25 AC_DEFINE([HAVE_BE_TYPES], [1],
26 [Define to 1 if <linux/types.h> defines big-endian types])],
27 [AC_MSG_RESULT(no)])
Jeff Garzik32c80372005-10-25 01:56:48 -040028
29dnl Checks for library functions.
30AC_HEADER_STDC
31AC_CHECK_FUNCS(socket strtol)
32
Florian Fainelli875616d2014-02-27 15:43:01 -080033dnl Check for options
34AC_ARG_ENABLE(pretty-dump,
Ben Hutchings9832a4c2014-04-21 22:51:46 +010035 [ --enable-pretty-dump enable registers, EEPROM and SFP pretty dumps (enabled by default)],
36 ,
37 enable_pretty_dump=yes)
38if test x$enable_pretty_dump = xyes; then
39 AC_DEFINE(ETHTOOL_ENABLE_PRETTY_DUMP, 1,
40 [Define this to enable register, EEPROM and SFP pretty dumps.])
41fi
42AM_CONDITIONAL([ETHTOOL_ENABLE_PRETTY_DUMP], [test x$enable_pretty_dump = xyes])
Florian Fainelli875616d2014-02-27 15:43:01 -080043
Kevin Locke9b802642019-04-19 18:16:21 -060044AC_ARG_WITH([bash-completion-dir],
45 AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
46 [Install the bash-completion script in this directory. @<:@default=yes@:>@]),
47 [],
48 [with_bash_completion_dir=yes])
49AS_IF([test "x$with_bash_completion_dir" = xyes],
50 [AC_MSG_CHECKING([for bash-completion directory])
51 dnl Attempt to use pkg-config completionsdir variable with given $prefix.
52 dnl This matches distcheck expectation that all files install to $prefix.
53 dnl It works with /usr and /usr/local (for default $XDG_DATA_DIRS) but
54 dnl may install to directory not used by bash-completion in other cases.
55 dnl See: https://lore.kernel.org/netdev/20190417025333.GA28674@kevinolos/
56 AS_IF([test "x$PKG_CONFIG" != x \
57 && bash_completion_prefix=`"$PKG_CONFIG" --print-errors --variable=prefix bash-completion 2>&AS_MESSAGE_LOG_FD` \
58 && bash_completion_dir=`"$PKG_CONFIG" --print-errors --variable=completionsdir bash-completion 2>&AS_MESSAGE_LOG_FD`],
59 [bash_completion_dir="${bash_completion_dir#"$bash_completion_prefix"}"
60 bash_completion_dir="${bash_completion_dir#/}"
61 BASH_COMPLETION_DIR='${prefix}'/"$bash_completion_dir"],
62 [BASH_COMPLETION_DIR='${datadir}/bash-completion/completions'])
63 AC_MSG_RESULT([$BASH_COMPLETION_DIR])],
64 [BASH_COMPLETION_DIR="$with_bash_completion_dir"])
65AC_SUBST([BASH_COMPLETION_DIR])
66AM_CONDITIONAL([ENABLE_BASH_COMPLETION],
67 [test "x$with_bash_completion_dir" != xno])
68
Ben Hutchingsf5259c12011-01-10 15:29:58 +000069AC_CONFIG_FILES([Makefile ethtool.spec ethtool.8])
Jeff Garzik32c80372005-10-25 01:56:48 -040070AC_OUTPUT