]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
configure: use `runstatedir` instead of /var/run in configure
authorVincent Bernat <vincent@bernat.im>
Wed, 7 May 2014 11:06:05 +0000 (13:06 +0200)
committerVincent Bernat <vincent@bernat.im>
Wed, 7 May 2014 11:33:13 +0000 (13:33 +0200)
configure.ac
m4/args.m4
redhat/lldpd.spec

index 59bb3b7b87beebd8fddae7a24e916e99bcb978cb..dc2e1db9918f52fb69fdf8b5128b97235b35b634 100644 (file)
@@ -226,7 +226,13 @@ lldp_SYSTEMTAP
 lldp_ARG_ENABLE([privsep], [Privilege separation], [yes])
 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
 lldp_ARG_WITH([privsep-group], [Which group to use for privilege separation], [_lldpd])
-lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [/var/run/lldpd])
+
+# Directories
+dnl On autoconf 2.69 and before, runstatedir is not configurable, let be able to use it anyway
+if test "x$runstatedir" = x; then
+    AC_SUBST([runstatedir], ['${localstatedir}/run'])
+fi
+lldp_ARG_WITH([privsep-chroot], [Which directory to use to chroot lldpd], [${runstatedir}/lldpd])
 
 # CDP/FDP/EDP/SONMP
 lldp_ARG_ENABLE([cdp], [Cisco Discovery Protocol], [yes])
index cf015d640de1b3e2b8e0876e8d17ba1175eae17e..8e286faff1f2c45d25783a05f4d81c07969c3db7 100644 (file)
@@ -2,17 +2,53 @@
 # lldp_ARG_WITH
 #
 
+dnl lldp_AC_EXPAND(var)
+
+AC_DEFUN([lldp_AC_EXPAND], [
+  dnl first expand prefix and exec_prefix if necessary
+  prefix_save=$prefix
+  exec_prefix_save=$exec_prefix
+
+  dnl if no prefix given, then use /usr/local, the default prefix
+  if test "x$prefix" = "xNONE"; then
+    prefix="$ac_default_prefix"
+  fi
+  dnl if no exec_prefix given, then use prefix
+  if test "x$exec_prefix" = "xNONE"; then
+    exec_prefix=$prefix
+  fi
+
+  full_var="$1"
+  dnl loop until it doesn't change anymore
+  while true; do
+    dnl echo DEBUG: full_var: $full_var
+    new_full_var="`eval echo $full_var`"
+    if test "x$new_full_var" = "x$full_var"; then break; fi
+    full_var=$new_full_var
+  done
+
+  dnl clean up
+  full_var=$new_full_var
+  eval $2="$full_var"
+
+  dnl restore prefix and exec_prefix
+  prefix=$prefix_save
+  exec_prefix=$exec_prefix_save
+])
+
 dnl lldp_ARG_WITH(name, help1, default)
 
 AC_DEFUN([lldp_ARG_WITH],[
   AC_ARG_WITH([$1],
        AS_HELP_STRING([--with-$1],
                [$2 @<:@default=$3@:>@]),[
-        AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]), ["$withval"], [$2])
-        AC_SUBST(AS_TR_CPP([$1]), [$withval])],[
-       AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]), ["$3"], [$2])
-        AC_SUBST(AS_TR_CPP([$1]), [$3])
-        eval with_[]m4_translit([$1], [-+.], [___])="$3"
+        lldp_AC_EXPAND("$withval", expanded)
+        AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]), ["$expanded"], [$2])
+        AC_SUBST(AS_TR_CPP([$1]), [$expanded])],[
+        lldp_AC_EXPAND("$3", expanded)
+       AC_DEFINE_UNQUOTED(AS_TR_CPP([$1]), ["$expanded"], [$2])
+        AC_SUBST(AS_TR_CPP([$1]), [$expanded])
+        eval with_[]m4_translit([$1], [-+.], [___])="$expanded"
 ])])
 
 dnl lldp_ARG_ENABLE(name, help1, default)
index 757bc7f7ffb3deaedd00ee3d1f11ed0d8e7be04a..06592aa94b3d5083a49408896c222ffddb42d698 100644 (file)
@@ -130,7 +130,7 @@ This package is required to develop alternate clients for lldpd.
    --with-privsep-group=%lldpd_group \
    --with-privsep-chroot=%lldpd_chroot \
    --with-systemdsystemunitdir=no \
-   --prefix=/usr --localstatedir=%lldpd_chroot --sysconfdir=/etc --libdir=%{_libdir} \
+   --prefix=/usr --localstatedir=%{_localstatedir} --sysconfdir=/etc --libdir=%{_libdir} \
    --docdir=%{_docdir}/lldpd
 
 [ -f /usr/include/net-snmp/agent/struct.h ] || touch src/struct.h