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
85AC_ARG_WITH([debugdir],
86    AS_HELP_STRING([--with-debugdir=DIR],
87    [Path to directory for debug symbols. [PREFIX/lib/debug]]),
88    [debugdir_path=$withval],
89    [debugdir_path=$prefix/lib/debug])
90
91if test "$libexecdir" = '${exec_prefix}/libexec' ; then
92    case "$host_os" in
93         *netbsd*) ;;
94         *)
95         libexecdir='${exec_prefix}/lib'
96         ;;
97    esac
98fi
99dnl expand exec_prefix or it will endup in substituted variables
100LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
101AC_SUBST(LIBEXEC)
102
103dnl These variables will be substituted in various .in files
104LIBEXEC_BIN=${LIBEXEC}/bin
105AC_SUBST(LIBEXEC_BIN)
106LIBEXEC_LIB=${LIBEXEC}/lib
107AC_SUBST(LIBEXEC_LIB)
108LIBEXEC_INC=${LIBEXEC}/include
109AC_SUBST(LIBEXEC_INC)
110XENFIRMWAREDIR=${LIBEXEC}/boot
111AC_SUBST(XENFIRMWAREDIR)
112
113XEN_RUN_DIR=$rundir_path/xen
114AC_SUBST(XEN_RUN_DIR)
115
116XEN_LOG_DIR=$localstatedir/log/xen
117AC_SUBST(XEN_LOG_DIR)
118
119XEN_LIB_STORED=$localstatedir/lib/xenstored
120AC_SUBST(XEN_LIB_STORED)
121
122XEN_RUN_STORED=$rundir_path/xenstored
123AC_SUBST(XEN_RUN_STORED)
124
125XEN_LIB_DIR=$localstatedir/lib/xen
126AC_SUBST(XEN_LIB_DIR)
127
128SHAREDIR=$prefix/share
129AC_SUBST(SHAREDIR)
130
131CONFIG_DIR=$sysconfdir
132AC_SUBST(CONFIG_DIR)
133
134INITD_DIR=$initddir_path
135AC_SUBST(INITD_DIR)
136
137XEN_CONFIG_DIR=$CONFIG_DIR/xen
138AC_SUBST(XEN_CONFIG_DIR)
139
140XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
141AC_SUBST(XEN_SCRIPT_DIR)
142
143case "$host_os" in
144*freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
145*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
146*) XEN_LOCK_DIR=$localstatedir/lock ;;
147esac
148AC_SUBST(XEN_LOCK_DIR)
149
150XEN_PAGING_DIR=$localstatedir/lib/xen/xenpaging
151AC_SUBST(XEN_PAGING_DIR)
152
153XEN_DUMP_DIR=$xen_dumpdir_path
154AC_SUBST(XEN_DUMP_DIR)
155
156DEBUG_DIR=$debugdir_path
157AC_SUBST(DEBUG_DIR)
158])
159
160case "$host_os" in
161*freebsd*) XENSTORED_KVA=/dev/xen/xenstored ;;
162*) XENSTORED_KVA=/proc/xen/xsd_kva ;;
163esac
164AC_SUBST(XENSTORED_KVA)
165
166case "$host_os" in
167*freebsd*) XENSTORED_PORT=/dev/xen/xenstored ;;
168*) XENSTORED_PORT=/proc/xen/xsd_port ;;
169esac
170AC_SUBST(XENSTORED_PORT)
171