1AC_DEFUN([AX_XEN_EXPAND_CONFIG], [
2dnl expand these early so we can use this for substitutions
3test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
4test "x$exec_prefix" = "xNONE" && exec_prefix=${prefix}
5
6dnl Use /var instead of /usr/local/var because there can be only one
7dnl xenstored active at a time. All tools have to share this dir, even
8dnl if they come from a different --prefix=.
9if test "$localstatedir" = '${prefix}/var' ; then
10    localstatedir=/var
11fi
12
13dnl expand exec_prefix or it will endup in substituted variables
14bindir=`eval echo $bindir`
15sbindir=`eval echo $sbindir`
16libdir=`eval echo $libdir`
17
18dnl
19if test "x$sysconfdir" = 'x${prefix}/etc' ; then
20    case "$host_os" in
21         *freebsd*)
22         sysconfdir=$prefix/etc
23         ;;
24         *solaris*)
25         if test "$prefix" = "/usr" ; then
26             sysconfdir=/etc
27         else
28             sysconfdir=$prefix/etc
29         fi
30         ;;
31         *)
32         sysconfdir=/etc
33         ;;
34    esac
35fi
36
37AC_ARG_WITH([initddir],
38    AS_HELP_STRING([--with-initddir=DIR],
39    [Path to directory with sysv runlevel scripts. [SYSCONFDIR/init.d]]),
40    [initddir_path=$withval],
41    [case "$host_os" in
42         *linux*)
43         if test -d $sysconfdir/rc.d/init.d ; then
44             initddir_path=$sysconfdir/rc.d/init.d
45         else
46             initddir_path=$sysconfdir/init.d
47         fi
48         ;;
49         *)
50         initddir_path=$sysconfdir/rc.d
51         ;;
52     esac])
53
54AC_ARG_WITH([sysconfig-leaf-dir],
55    AS_HELP_STRING([--with-sysconfig-leaf-dir=SUBDIR],
56    [Name of subdirectory in /etc to store runtime options for runlevel
57    scripts and daemons such as xenstored.
58    This should be either "sysconfig" or "default". [sysconfig]]),
59    [config_leaf_dir=$withval],
60    [config_leaf_dir=sysconfig
61    if test ! -d /etc/sysconfig ; then config_leaf_dir=default ; fi])
62CONFIG_LEAF_DIR=$config_leaf_dir
63AC_SUBST(CONFIG_LEAF_DIR)
64
65dnl autoconf docs suggest to use a "package name" subdir. We make it
66dnl configurable for the benefit of those who want e.g. xen-X.Y instead.
67AC_ARG_WITH([libexec-leaf-dir],
68    AS_HELP_STRING([--with-libexec-leaf-dir=SUBDIR],
69    [Name of subdirectory in libexecdir to use.]),
70    [libexec_subdir=$withval],
71    [libexec_subdir=$PACKAGE_TARNAME])
72
73AC_ARG_WITH([xen-dumpdir],
74    AS_HELP_STRING([--with-xen-dumpdir=DIR],
75    [Path to directory for domU crash dumps. [LOCALSTATEDIR/lib/xen/dump]]),
76    [xen_dumpdir_path=$withval],
77    [xen_dumpdir_path=$localstatedir/lib/xen/dump])
78
79AC_ARG_WITH([rundir],
80    AS_HELP_STRING([--with-rundir=DIR],
81    [Path to directory for runtime data. [LOCALSTATEDIR/run]]),
82    [rundir_path=$withval],
83    [rundir_path=$localstatedir/run])
84
85if test "$libexecdir" = '${exec_prefix}/libexec' ; then
86    case "$host_os" in
87         *netbsd*) ;;
88         *)
89         libexecdir='${exec_prefix}/lib'
90         ;;
91    esac
92fi
93dnl expand exec_prefix or it will endup in substituted variables
94LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
95AC_SUBST(LIBEXEC)
96
97dnl These variables will be substituted in various .in files
98LIBEXEC_BIN=${LIBEXEC}/bin
99AC_SUBST(LIBEXEC_BIN)
100LIBEXEC_LIB=${LIBEXEC}/lib
101AC_SUBST(LIBEXEC_LIB)
102LIBEXEC_INC=${LIBEXEC}/include
103AC_SUBST(LIBEXEC_INC)
104XENFIRMWAREDIR=${LIBEXEC}/boot
105AC_SUBST(XENFIRMWAREDIR)
106
107XEN_RUN_DIR=$rundir_path/xen
108AC_SUBST(XEN_RUN_DIR)
109
110XEN_LOG_DIR=$localstatedir/log/xen
111AC_SUBST(XEN_LOG_DIR)
112
113XEN_LIB_STORED=$localstatedir/lib/xenstored
114AC_SUBST(XEN_LIB_STORED)
115
116XEN_RUN_STORED=$rundir_path/xenstored
117AC_SUBST(XEN_RUN_STORED)
118
119XEN_LIB_DIR=$localstatedir/lib/xen
120AC_SUBST(XEN_LIB_DIR)
121
122SHAREDIR=$prefix/share
123AC_SUBST(SHAREDIR)
124
125CONFIG_DIR=$sysconfdir
126AC_SUBST(CONFIG_DIR)
127
128INITD_DIR=$initddir_path
129AC_SUBST(INITD_DIR)
130
131XEN_CONFIG_DIR=$CONFIG_DIR/xen
132AC_SUBST(XEN_CONFIG_DIR)
133
134XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
135AC_SUBST(XEN_SCRIPT_DIR)
136
137case "$host_os" in
138*freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
139*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
140*) XEN_LOCK_DIR=$localstatedir/lock ;;
141esac
142AC_SUBST(XEN_LOCK_DIR)
143
144XEN_PAGING_DIR=$localstatedir/lib/xen/xenpaging
145AC_SUBST(XEN_PAGING_DIR)
146
147XEN_DUMP_DIR=$xen_dumpdir_path
148AC_SUBST(XEN_DUMP_DIR)
149])
150
151case "$host_os" in
152*freebsd*) XENSTORED_KVA=/dev/xen/xenstored ;;
153*) XENSTORED_KVA=/proc/xen/xsd_kva ;;
154esac
155AC_SUBST(XENSTORED_KVA)
156
157case "$host_os" in
158*freebsd*) XENSTORED_PORT=/dev/xen/xenstored ;;
159*) XENSTORED_PORT=/proc/xen/xsd_port ;;
160esac
161AC_SUBST(XENSTORED_PORT)
162