Just like CPP, CC, CXX, LD, AR, PKG_CONFIG Programs are expected to be in environment. The autoconf detection get/set these in environment too.
2012/3/8 Samuli Seppänen <sam...@openvpn.net>: > So, this patch replaces (removes?) the "--with-<executable>-path" configure > options with environment variables, right? For example, if one has > "ifconfig" in a non-standard place, he can set the IFCONFIG environment > variable and the build will find it. Did I understand this correctly? > > I don't know autotools well enough to give this one an ACK at this point. > That said, the patch does clean up configure.ac a lot, and cleanups are > always nice :). > > -- > Samuli Seppänen > Community Manager > OpenVPN Technologies, Inc > > irc freenode net: mattock > > >> Signed-off-by: Alon Bar-Lev <alon.bar...@gmail.com> >> --- >> configure.ac | 66 >> ++++++++++++++++++++++++--------------------------------- >> 1 files changed, 28 insertions(+), 38 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index 6b5cf71..ed98464 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -267,37 +267,6 @@ AC_ARG_WITH( >> ) >> >> AC_ARG_WITH( >> - [ifconfig-path], >> - [AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])], >> - [IFCONFIG="$withval"], >> - [AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], >> [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] >> -) >> -AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) >> - >> -AC_ARG_WITH( >> - [iproute-path], >> - [AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])], >> - [IPROUTE="$withval"], >> - [AC_PATH_PROG([IPROUTE], [ip], [ip], >> [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] >> -) >> -AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) >> - >> -AC_ARG_WITH([route-path], >> - [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])], >> - [ROUTE="$withval"], >> - [AC_PATH_PROG([ROUTE], [route], [route], >> [$PATH:/usr/local/sbin:/usr/sbin:/sbin])] >> -) >> -AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) >> - >> -AC_ARG_WITH( >> - [netstat-path], >> - [AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])], >> - [NETSTAT="$withval"], >> - [AC_PATH_PROG([NETSTAT], [netstat], [netstat], >> [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])] >> -) >> -AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool]) >> - >> -AC_ARG_WITH( >> [mem-check], >> [AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory >> checking, TYPE=dmalloc|valgrind|ssl])], >> [ >> @@ -370,6 +339,20 @@ AC_PROG_INSTALL >> AC_PROG_LN_S >> AC_PROG_MAKE_SET >> >> +AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility]) >> +AC_ARG_VAR([ROUTE], [full path to route utility]) >> +AC_ARG_VAR([IPROUTE], [full path to ip utility]) >> +AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests >> +AC_ARG_VAR([MAN2HTML], [path to man2html utility]) >> +AC_PATH_PROGS([IFCONFIG], [ifconfig],, >> [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) >> +AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) >> +AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin]) >> +AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], >> [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests >> +AC_CHECK_PROGS([MAN2HTML], [man2html]) >> +AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool]) >> +AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool]) >> +AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool]) >> + >> # >> # Libtool >> # >> @@ -386,12 +369,6 @@ ifdef( >> ] >> ) >> >> -if test "${WIN32}" = "yes"; then >> - AC_ARG_VAR([MAN2HTML], [man2html utility]) >> - AC_CHECK_PROGS([MAN2HTML], [man2html]) >> - test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) >> -fi >> - >> AC_C_CONST >> AC_C_INLINE >> AC_C_VOLATILE >> @@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], >> [1], [Enable internal pack >> test "${enable_strict_options}" = "yes" && >> AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check >> between peers]) >> test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], >> [1], [Allow --askpass and --auth-user-pass passwords to be read from a file]) >> test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], >> [Enable systemd support]) >> -test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], >> [enable iproute2 support]) >> + >> +if test "${enable_iproute2}" = "yes"; then >> + test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but >> missing]) >> + AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) >> +else >> + if test "${WIN32}" != "yes"; then >> + test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required >> but missing]) >> + test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is >> required but missing]) >> + fi >> +fi >> >> if test "${enable_pedantic}" = "yes"; then >> enable_strict="yes" >> @@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; then >> CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function" >> fi >> >> +if test "${WIN32}" = "yes"; then >> + test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32]) >> +fi >> + >> CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`" >> AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], >> [Configuration settings]) >> >