Browse code

build: autoconf: commands as environment

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: Adriaan de Jong <dejong@fox-it.com>
Signed-off-by: David Sommerseth <davids@redhat.com>

Alon Bar-Lev authored on 2012/03/01 05:12:01
Showing 1 changed files
... ...
@@ -267,37 +267,6 @@ AC_ARG_WITH(
267 267
 )
268 268
 
269 269
 AC_ARG_WITH(
270
-	[ifconfig-path],
271
-	[AS_HELP_STRING([--with-ifconfig-path=PATH], [Path to ifconfig tool])],
272
-	[IFCONFIG="$withval"],
273
-	[AC_PATH_PROG([IFCONFIG], [ifconfig], [ifconfig], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
274
-)
275
-AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
276
-
277
-AC_ARG_WITH(
278
-	[iproute-path],
279
-	[AS_HELP_STRING([--with-iproute-path=PATH], [Path to iproute tool])],
280
-	[IPROUTE="$withval"],
281
-	[AC_PATH_PROG([IPROUTE], [ip], [ip], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
282
-)
283
-AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
284
-
285
-AC_ARG_WITH([route-path],
286
-   [AS_HELP_STRING([--with-route-path=PATH], [Path to route tool])],
287
-   [ROUTE="$withval"],
288
-   [AC_PATH_PROG([ROUTE], [route], [route], [$PATH:/usr/local/sbin:/usr/sbin:/sbin])]
289
-)
290
-AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
291
-
292
-AC_ARG_WITH(
293
-	[netstat-path],
294
-	[AS_HELP_STRING([--with-netstat-path=PATH], [Path to netstat tool])],
295
-	[NETSTAT="$withval"],
296
-	[AC_PATH_PROG([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc])]
297
-)
298
-AC_DEFINE_UNQUOTED([NETSTAT_PATH], ["$NETSTAT"], [Path to netstat tool])
299
-
300
-AC_ARG_WITH(
301 270
 	[mem-check],
302 271
 	[AS_HELP_STRING([--with-mem-check=TYPE], [build with debug memory checking, TYPE=dmalloc|valgrind|ssl])],
303 272
 	[
... ...
@@ -370,6 +339,20 @@ AC_PROG_INSTALL
370 370
 AC_PROG_LN_S
371 371
 AC_PROG_MAKE_SET
372 372
 
373
+AC_ARG_VAR([IFCONFIG], [full path to ipconfig utility])
374
+AC_ARG_VAR([ROUTE], [full path to route utility])
375
+AC_ARG_VAR([IPROUTE], [full path to ip utility])
376
+AC_ARG_VAR([NETSTAT], [path to netstat utility]) # tests
377
+AC_ARG_VAR([MAN2HTML], [path to man2html utility])
378
+AC_PATH_PROGS([IFCONFIG], [ifconfig],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
379
+AC_PATH_PROGS([ROUTE], [route],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
380
+AC_PATH_PROGS([IPROUTE], [ip],, [$PATH:/usr/local/sbin:/usr/sbin:/sbin])
381
+AC_CHECK_PROGS([NETSTAT], [netstat], [netstat], [$PATH:/usr/local/sbin:/usr/sbin:/sbin:/etc]) # tests
382
+AC_CHECK_PROGS([MAN2HTML], [man2html])
383
+AC_DEFINE_UNQUOTED([IFCONFIG_PATH], ["$IFCONFIG"], [Path to ifconfig tool])
384
+AC_DEFINE_UNQUOTED([IPROUTE_PATH], ["$IPROUTE"], [Path to iproute tool])
385
+AC_DEFINE_UNQUOTED([ROUTE_PATH], ["$ROUTE"], [Path to route tool])
386
+
373 387
 #
374 388
 # Libtool
375 389
 #
... ...
@@ -386,12 +369,6 @@ ifdef(
386 386
 	]
387 387
 )
388 388
 
389
-if test "${WIN32}" = "yes"; then
390
-	AC_ARG_VAR([MAN2HTML], [man2html utility])
391
-	AC_CHECK_PROGS([MAN2HTML], [man2html])
392
-	test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
393
-fi
394
-
395 389
 AC_C_CONST
396 390
 AC_C_INLINE
397 391
 AC_C_VOLATILE
... ...
@@ -920,7 +897,16 @@ test "${enable_pf}" = "yes" && AC_DEFINE([ENABLE_PF], [1], [Enable internal pack
920 920
 test "${enable_strict_options}" = "yes" && AC_DEFINE([ENABLE_STRICT_OPTIONS_CHECK], [1], [Enable strict options check between peers])
921 921
 test "${enable_password_save}" = "yes" && AC_DEFINE([ENABLE_PASSWORD_SAVE], [1], [Allow --askpass and --auth-user-pass passwords to be read from a file])
922 922
 test "${enable_systemd}" = "yes" && AC_DEFINE([ENABLE_SYSTEMD], [1], [Enable systemd support])
923
-test "${enable_iproute2}" = "yes" && AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
923
+
924
+if test "${enable_iproute2}" = "yes"; then
925
+	test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing])
926
+	AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support])
927
+else
928
+	if test "${WIN32}" != "yes"; then
929
+		test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing])
930
+		test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing])
931
+	fi
932
+fi
924 933
 
925 934
 if test "${enable_pedantic}" = "yes"; then
926 935
 	enable_strict="yes"
... ...
@@ -930,6 +916,10 @@ if test "${enable_strict}" = "yes"; then
930 930
 	CFLAGS="${CFLAGS} -Wall -Wno-unused-parameter -Wno-unused-function"
931 931
 fi
932 932
 
933
+if test "${WIN32}" = "yes"; then
934
+	test -z "${MAN2HTML}" && AC_MSG_ERROR([man2html is required for win32])
935
+fi
936
+
933 937
 CONFIGURE_DEFINES="`set | grep '^enable_.*=' ; set | grep '^with_.*='`"
934 938
 AC_DEFINE_UNQUOTED([CONFIGURE_DEFINES], ["`echo ${CONFIGURE_DEFINES}`"], [Configuration settings])
935 939