summaryrefslogtreecommitdiff
path: root/ext/vpopmail/config.m4
blob: 3870b4270a9bd1a216c6fa7be54bf86ab3a4b305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
dnl $Id$
dnl config.m4 for extension vpopmail

PHP_ARG_WITH(vpopmail, for vpopmail support,
[  --with-vpopmail[=DIR]   Include vpopmail support.])

if test "$PHP_VPOPMAIL" != "no"; then
	AC_MSG_CHECKING(for vpopmail install directory)
	for i in ~vpopmail /home/vpopmail /home/popmail /var/qmail/vpopmail /var/qmail/popmail $PHP_VPOPMAIL; do
		if test -r $i/vpopmail.h; then
			VPOPMAIL_INC_DIR=$i
			VPOPMAIL_DIR=$i
		elif test -r $i/include/vpopmail.h; then
			VPOPMAIL_INC_DIR=$i/include
			VPOPMAIL_DIR=$i
		fi

		if test -r $i/libvpopmail.a; then
			VPOPMAIL_LIB_DIR=$i
		elif test -r $i/lib/libvpopmail.a; then
			VPOPMAIL_LIB_DIR=$i/lib
		fi

		if test -r $i/vadddomain; then
			VPOPMAIL_BIN_DIR=$i
		elif test -r $i/bin/vadddomain; then
			VPOPMAIL_BIN_DIR=$i/bin
		fi
	done

	for i in "$VPOPMAIL_INC_DIR/vpopmail.h" "$VPOPMAIL_INC_DIR/vpopmail_config.h" "$VPOPMAIL_LIB_DIR/libvpopmail.a" "$VPOPMAIL_BIN_DIR/vadddomain" "$VPOPMAIL_BIN_DIR/vaddaliasdomain" "$VPOPMAIL_BIN_DIR/vdeldomain" ; do
		if test ! -r "$i"; then
			AC_MSG_ERROR(Could not find '$i'. Please make sure you have
				vpopmail installed. Use
				./configure --with-vpopmail=<vpopmail-home-dir> if necessary)
		fi
	done

	AC_MSG_RESULT($VPOPMAIL_DIR)

	PHP_ADD_INCLUDE($VPOPMAIL_INC_DIR)

	PHP_SUBST(VPOPMAIL_SHARED_LIBADD)
	PHP_ADD_LIBRARY_WITH_PATH(vpopmail, $VPOPMAIL_LIB_DIR, VPOPMAIL_SHARED_LIBADD)

	AC_DEFINE(HAVE_VPOPMAIL,1,[Whether you have vpopmail])
	AC_DEFINE_UNQUOTED(VPOPMAIL_BIN_DIR,"$VPOPMAIL_BIN_DIR",[vpopmail bin path])

	PHP_EXTENSION(vpopmail, $ext_shared)
fi