Proposing patch fixing this issue. Inspired by expansion of the datarootdir option.
1. diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 2. index ca8cb69..9028701 100644 3. --- a/lib/autoconf/status.m4 4. +++ b/lib/autoconf/status.m4 5. @@ -645,6 +645,35 @@ esac 6. _ACEOF 7. ])dnl 8. 9. +m4_ifndef([AC_LOCALSTATEDIR_CHECKED], 10. +[cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 11. +# If the template does not know about localstatedir, expand it. 12. +# FIXME: This hack should be removed a few years after 2.60. 13. +ac_localstatedir_hack=; ac_localstatedir_seen= 14. +m4_define([_AC_localstatedir_vars], 15. + [runstatedir])]dnl 16. +[m4_define([_AC_localstatedir_subst], [ s&@$][1@&$$][1&g])]dnl 17. +[ac_sed_dataroot=' 18. +/localstatedir/ { 19. + p 20. + q 21. +} 22. +m4_map_args_sep([/@], [@/p], [ 23. +], _AC_localstatedir_vars)' 24. +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in 25. +*localstatedir*) ac_localstatedir_seen=yes;; 26. +*@[]m4_join([@*|*@], _AC_localstatedir_vars)@*) 27. + AC_MSG_WARN([$ac_file_inputs seems to ignore the --localstatedir setting]) 28. +_ACEOF 29. +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 30. + ac_localstatedir_hack=' 31. +m4_map_args_sep([_AC_localstatedir_subst(], [)], [ 32. +], _AC_localstatedir_vars) 33. + s&\\\${localstatedir}&$localstatedir&g' ;; 34. +esac 35. +_ACEOF 36. +])dnl 37. + 38. # Neutralize VPATH when `$srcdir' = `.'. 39. # Shell code in configure.ac might set extrasub. 40. # FIXME: do we really want to maintain this feature? 41. @@ -671,6 +700,8 @@ m4_map_args_sep([$0_ADJUST_DIR(], [)], [ 42. [, [INSTALL]])AC_PROVIDE_IFELSE([AC_PROG_MKDIR_P], [, [MKDIR_P]])) 43. m4_ifndef([AC_DATAROOTDIR_CHECKED], [$ac_datarootdir_hack 44. ])dnl 45. +m4_ifndef([AC_LOCALSTATEDIR_CHECKED], [$ac_localstatedir_hack 46. +])dnl 47. " 48. eval sed \"\$ac_sed_extra\" "$ac_file_inputs" m4_defn([_AC_SUBST_CMDS]) \ 49. >$ac_tmp/out || AC_MSG_ERROR([could not create $ac_file]) 50. @@ -682,6 +713,15 @@ m4_ifndef([AC_DATAROOTDIR_CHECKED], 51. "$ac_tmp/out"`; test -z "$ac_out"; } && 52. AC_MSG_WARN([$ac_file contains a reference to the variable `datarootdir' 53. which seems to be undefined. Please make sure it is defined]) 54. +])dnl 55. + 56. +m4_ifndef([AC_LOCALSTATEDIR_CHECKED], 57. +[test -z "$ac_localstatedir_hack$ac_localstatedir_seen" && 58. + { ac_out=`sed -n '/\${localstatedir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && 59. + { ac_out=`sed -n '/^[[ ]]*localstatedir[[ ]]*:*=/p' \ 60. + "$ac_tmp/out"`; test -z "$ac_out"; } && 61. + AC_MSG_WARN([$ac_file contains a reference to the variable `localstatedir' 62. +which seems to be undefined. Please make sure it is defined]) 63. ])dnl 64. 65. rm -f "$ac_tmp/stdin" On Fri, Mar 5, 2021 at 2:18 PM Ondrej Dubaj <odu...@redhat.com> wrote: > test.sh.in: > #/bin/bash > ls @runstatedir@ > > configure.ac: > # Taken from http://www.idryman.org/blog/2016/03/10/autoconf-tutorial-1/ > # Must init the autoconf setup > # The first parameter is project name > # second is version number > # third is bug report address > AC_INIT([test], [1.0]) > > # We want to expand templates in this file > AC_CONFIG_FILES([test.sh]) > # Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess) > # in this dir (build-aux) > AC_CONFIG_AUX_DIR([build-aux]) > > # Generate the output > AC_OUTPUT > > > On Fri, Mar 5, 2021 at 12:12 PM Ondrej Dubaj <odu...@redhat.com> wrote: > >> When backporting the given commit to version 2.69: >> >> >> https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=a197431414088a417b407b9b20583b2e8f7363bd >> >> we are experiencing problems with behaviour in Fedora. >> >> In the documentation there is: By default runstatedir is a subdirectory of >> ${localstatedir}, >> but it doesn't behave in such a way. The expectation was that after setting >> >> --localstatedir=/dirA >> >> will it change also @runstatedir@ to /dirA/run. But @runstatedir@ changes >> always to /run. >> >> Steps to Reproduce: >> 1. run autoreconf --verbose --install --force >> 2. mkdir /tmp/run/ >> 3. touch /tmp/run/file1 >> 4. ./configure --localstatedir=/tmp >> 5. ./test.sh >> Actual results: >> list /run >> >> Expected results: >> list /tmp/run >> >> test.sh.in: >> >> *#/bin/bashls @runstatedir@* >> >> configure.ac: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> *# Taken from http://www.idryman.org/blog/2016/03/10/autoconf-tutorial-1/ >> <http://www.idryman.org/blog/2016/03/10/autoconf-tutorial-1/># Must init the >> autoconf setup# The first parameter is project name# second is version >> number# third is bug report addressAC_INIT([test], [1.0])# We want to expand >> templates in this fileAC_CONFIG_FILES([test.sh])# Store the auxiliary build >> tools (e.g., install-sh, config.sub, config.guess)# in this dir >> (build-aux)AC_CONFIG_AUX_DIR([build-aux])# Generate the outputAC_OUTPUT* >> >> Is there anything missing in the applied patch adding runstatedir option ? >> >> Thanks for cooperation. >> >> Red Hat developers >> >>