Fix path check.
[samba.git] / source4 / build / m4 / check_path.m4
1 dnl SMB Build Environment Path Checks
2 dnl -------------------------------------------------------
3 dnl  Copyright (C) Stefan (metze) Metzmacher 2004
4 dnl  Released under the GNU GPL
5 dnl -------------------------------------------------------
6 dnl
7
8 AC_LIBREPLACE_LOCATION_CHECKS
9
10 #################################################
11 # Directory handling stuff to support both the
12 # legacy SAMBA directories and FHS compliant
13 # ones...
14 AC_PREFIX_DEFAULT(/usr/local/samba)
15
16 # Defaults and --without-fhs
17 logfilebase="${localstatedir}"
18 lockdir="${localstatedir}/locks"
19 piddir="${localstatedir}/run"
20 privatedir="\${prefix}/private"
21 modulesdir="\${prefix}/modules"
22 winbindd_socket_dir="${localstatedir}/run/winbindd"
23 winbindd_privileged_socket_dir="${localstatedir}/lib/winbindd_privileged"
24 ntp_signd_socket_dir="${localstatedir}/run/ntp_signd"
25
26 AC_ARG_ENABLE(fhs, 
27 [AS_HELP_STRING([--enable-fhs],[Use FHS-compliant paths (default=no)])],
28 [fhs=$enableval],
29 [fhs=no]
30 )
31
32 if test x$fhs = xyes; then
33     lockdir="${localstatedir}/lib/samba"
34     piddir="${localstatedir}/run/samba"
35     logfilebase="${localstatedir}/log/samba"
36     privatedir="${localstatedir}/lib/samba/private"
37     sysconfdir="${sysconfdir}/samba"
38     modulesdir="${libdir}/samba"
39     datadir="${datadir}/samba"
40     includedir="${includedir}/samba-4.0"
41     ntp_signd_socket_dir="${localstatedir}/run/samba/ntp_signd"
42     winbindd_socket_dir="${localstatedir}/run/samba/winbindd"
43     winbindd_privileged_socket_dir="${localstatedir}/lib/samba/winbindd_privileged"
44 else
45         # Check to prevent installing directly under /usr without the FHS
46         AS_IF([test $prefix == /usr || test $prefix == /usr/local],[
47                 AC_MSG_ERROR([Don't install directly under "/usr" or "/usr/local" without using the FHS option (--enable-fhs). This could lead to file loss!])
48         ])
49 fi
50
51 #################################################
52 # set private directory location
53 AC_ARG_WITH(privatedir,
54 [AS_HELP_STRING([--with-privatedir=DIR],[Where to put sam.ldb and other private files containing key material ($ac_default_prefix/private)])],
55 [ case "$withval" in
56   yes|no)
57   #
58   # Just in case anybody calls it without argument
59   #
60     AC_MSG_WARN([--with-privatedir called without argument - will use default])
61   ;;
62   * )
63     privatedir="$withval"
64     ;;
65   esac])
66
67 #################################################
68 # set where the winbindd socket should be put
69 AC_ARG_WITH(winbindd-socket-dir,
70 [AS_HELP_STRING([--with-winbindd-socket-dir=DIR],[Where to put the winbindd socket ($winbindd_socket_dir)])],
71 [ case "$withval" in
72   yes|no)
73   #
74   # Just in case anybody calls it without argument
75   #
76     AC_MSG_WARN([--with-winbind-socketdir called without argument - will use default])
77   ;;
78   * )
79     winbindd_socket_dir="$withval"
80     ;;
81   esac])
82
83 #################################################
84 # set where the winbindd privilaged socket should be put
85 AC_ARG_WITH(winbindd-privileged-socket-dir,
86 [AS_HELP_STRING([--with-winbindd-privileged-socket-dir=DIR],[Where to put the winbindd socket ($winbindd_privileged_socket_dir)])],
87 [ case "$withval" in
88   yes|no)
89   #
90   # Just in case anybody calls it without argument
91   #
92     AC_MSG_WARN([--with-winbind-privileged-socketdir called without argument - will use default])
93   ;;
94   * )
95     winbindd_privileged_socket_dir="$withval"
96     ;;
97   esac])
98
99 #################################################
100 # set where the NTP signing deamon socket should be put
101 AC_ARG_WITH(ntp-signd-socket-dir,
102 [AS_HELP_STRING([--with-ntp-signd-socket-dir=DIR],[Where to put the NTP signing deamon socket ($ac_default_prefix/run/ntp_signd)])],
103 [ case "$withval" in
104   yes|no)
105   #
106   # Just in case anybody calls it without argument
107   #
108     AC_MSG_WARN([--with-ntp-signd-socketdir called without argument - will use default])
109   ;;
110   * )
111     ntp_signd_socket_dir="$withval"
112     ;;
113   esac])
114
115 #################################################
116 # set lock directory location
117 AC_ARG_WITH(lockdir,
118 [AS_HELP_STRING([--with-lockdir=DIR],[Where to put lock files ($ac_default_prefix/var/locks)])],
119 [ case "$withval" in
120   yes|no)
121   #
122   # Just in case anybody calls it without argument
123   #
124     AC_MSG_WARN([--with-lockdir called without argument - will use default])
125   ;;
126   * )
127     lockdir="$withval"
128     ;;
129   esac])
130
131 #################################################
132 # set pid directory location
133 AC_ARG_WITH(piddir,
134 [AS_HELP_STRING([--with-piddir=DIR],[Where to put pid files ($ac_default_prefix/var/locks)])],
135 [ case "$withval" in
136   yes|no)
137   #
138   # Just in case anybody calls it without argument
139   #
140     AC_MSG_WARN([--with-piddir called without argument - will use default])
141   ;;
142   * )
143     piddir="$withval"
144     ;;
145   esac])
146
147 #################################################
148 # set log directory location
149 AC_ARG_WITH(logfilebase,
150 [AS_HELP_STRING([--with-logfilebase=DIR],[Where to put log files (\$(VARDIR))])],
151 [ case "$withval" in
152   yes|no)
153   #
154   # Just in case anybody does it
155   #
156     AC_MSG_WARN([--with-logfilebase called without argument - will use default])
157   ;;
158   * )
159     logfilebase="$withval"
160     ;;
161   esac])
162
163
164 AC_SUBST(lockdir)
165 AC_SUBST(piddir)
166 AC_SUBST(logfilebase)
167 AC_SUBST(privatedir)
168 AC_SUBST(bindir)
169 AC_SUBST(sbindir)
170 AC_SUBST(winbindd_socket_dir)
171 AC_SUBST(winbindd_privileged_socket_dir)
172 AC_SUBST(ntp_signd_socket_dir)
173 AC_SUBST(modulesdir)
174
175 #################################################
176 # set prefix for 'make test'
177 # this is needed to workarround the 108 char 
178 # unix socket path limitation!
179 #
180 selftest_prefix="./st"
181 AC_SUBST(selftest_prefix)
182 AC_ARG_WITH(selftest-prefix,
183 [AS_HELP_STRING([--with-selftest-prefix=DIR],[The prefix where make test will be run ($selftest_prefix)])],
184 [ case "$withval" in
185   yes|no)
186     AC_MSG_WARN([--with-selftest-prefix called without argument - will use default])
187   ;;
188   * )
189     selftest_prefix="$withval"
190     ;;
191   esac])
192
193 debug=no
194 AC_ARG_ENABLE(debug,
195 [AS_HELP_STRING([--enable-debug],[Turn on compiler debugging information (default=no)])],
196     [if test x$enable_debug = xyes; then
197         debug=yes
198     fi])
199
200 developer=no
201 AC_SUBST(developer)
202 AC_ARG_ENABLE(developer,
203 [AS_HELP_STRING([--enable-developer],[Turn on developer warnings and debugging (default=no)])],
204     [if test x$enable_developer = xyes; then
205         debug=yes
206         developer=yes
207     fi])
208
209 dnl disable these external libs 
210 AC_ARG_WITH(disable-ext-lib,
211 [AS_HELP_STRING([--with-disable-ext-lib=LIB],[Comma-seperated list of external libraries])],
212 [ if test $withval; then
213         for i in `echo $withval | sed -e's/,/ /g'`
214         do
215                 eval SMB_$i=NO
216         done
217 fi ])