@@ -30,6 +30,34 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([no])])
3030AM_INIT_AUTOMAKE ( 1.11.1 foreign TESTS_OPTION )
3131AM_PROG_CC_C_O
3232
33+ # expand_path_option $path_variable_name $default
34+ expand_path_option() {
35+ # The first argument is the variable *name* (not value)
36+ ac_path_varname="$1"
37+
38+ # Get the original value of the variable
39+ ac_path_value=$(eval echo "\${${ac_path_varname}}")
40+
41+ # Expand any literal variable expressions in the value so that we don't
42+ # end up with something like '${prefix}' in #defines etc.
43+ #
44+ # Autoconf deliberately leaves values unexpanded to allow overriding
45+ # the configure script choices in make commands (for example,
46+ # "make exec_prefix=/foo install"). No longer being able to do this seems
47+ # like no great loss.
48+ eval ac_path_value=$(eval echo "${ac_path_value}")
49+
50+ # Use (expanded) default if necessary
51+ AS_IF ( [ test x"${ac_path_value}" = x""] ,
52+ [ eval ac_path_value=$(eval echo "$2 ")] )
53+
54+ # Require a full path
55+ AS_CASE ( [ "$ac_path_value"] ,
56+ [ /*] , [ eval ${ac_path_varname}="$ac_path_value"] ,
57+ [ *] , [ AC_MSG_ERROR ( [ $ac_path_varname value "$ac_path_value" is not a full path] ) ]
58+ )
59+ }
60+
3361PKG_CHECK_MODULES(glib, [ glib-2.0] )
3462PKG_CHECK_MODULES(libxml, [ libxml-2.0] )
3563
@@ -298,42 +326,29 @@ case $exec_prefix in
298326 prefix) exec_prefix=$prefix;;
299327esac
300328
301- dnl Expand autoconf variables so that we dont end up with '${prefix}'
302- dnl in #defines and python scripts
303- dnl NOTE: Autoconf deliberately leaves them unexpanded to allow
304- dnl make exec_prefix=/foo install
305- dnl No longer being able to do this seems like no great loss to me...
306-
307- eval prefix="`eval echo ${prefix}`"
308- eval exec_prefix="`eval echo ${exec_prefix}`"
309- eval bindir="`eval echo ${bindir}`"
310- eval sbindir="`eval echo ${sbindir}`"
311- eval libexecdir="`eval echo ${libexecdir}`"
312- eval datadir="`eval echo ${datadir}`"
313- eval sysconfdir="`eval echo ${sysconfdir}`"
314- eval sharedstatedir="`eval echo ${sharedstatedir}`"
315- eval localstatedir="`eval echo ${localstatedir}`"
316- eval libdir="`eval echo ${libdir}`"
317- eval includedir="`eval echo ${includedir}`"
318- eval oldincludedir="`eval echo ${oldincludedir}`"
319- eval infodir="`eval echo ${infodir}`"
320- eval mandir="`eval echo ${mandir}`"
321-
322- if [ test "x${runstatedir}" = "x" ] ; then
323- if [ test "x${sbd_runstatedir}" = "x" ] ; then
324- runstatedir="${localstatedir}/run"
325- else
326- runstatedir="${sbd_runstatedir}"
327- fi
328- fi
329- eval runstatedir="$(eval echo ${runstatedir})"
329+ dnl Expand values of autoconf-provided directory options
330+ expand_path_option prefix
331+ expand_path_option exec_prefix
332+ expand_path_option bindir
333+ expand_path_option sbindir
334+ expand_path_option libexecdir
335+ expand_path_option datadir
336+ expand_path_option sysconfdir
337+ expand_path_option sharedstatedir
338+ expand_path_option localstatedir
339+ expand_path_option libdir
340+ expand_path_option includedir
341+ expand_path_option oldincludedir
342+ expand_path_option infodir
343+ expand_path_option mandir
344+
345+ AS_IF ( [ test x"${runstatedir}" = x""] , [ runstatedir="${sbd_runstatedir}"] )
346+ expand_path_option runstatedir "${localstatedir}/run"
330347AC_SUBST ( runstatedir )
331348
332349AC_SUBST ( LIBADD_DL ) dnl extra flags for dynamic linking libraries
333350
334- if test x"${CONFIGDIR}" = x""; then
335- CONFIGDIR="${sysconfdir}/sysconfig"
336- fi
351+ expand_path_option CONFIGDIR "${sysconfdir}/sysconfig"
337352AC_SUBST ( CONFIGDIR )
338353
339354if test x"${SBD_WATCHDOG_TIMEOUT_DEFAULT}" = x""; then
0 commit comments