summaryrefslogtreecommitdiff
path: root/net/gnu-radius/scripts/configure
blob: b7e03ad9686d9d744d7c4d16b97fc45184fbee4b (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh

if [ -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc ]; then
	exit
fi

tempfile=`/usr/bin/mktemp -t checklist`

if [ "${BATCH}" ]; then
	set \"MySQL\"
else
	/usr/bin/dialog --title "GNU-Radius configuration options" --clear \
		--checklist "\n\
Please select desired options:" -1 -1 16 \
Client		"Enable build client" OFF \
DBM		    "Enable DBM support" OFF \
MySQL		"Enable MySQL support" ON \
PostgreSQL	"Enable PostgreSQL support" OFF \
SNMP	    "Enable SNMP support" ON \
Notify		"Enable TTL notification" OFF \
2> $tempfile

	retval=$?

	if [ -s $tempfile ]; then
		set `cat $tempfile`
	fi
	rm -f $tempfile

	case $retval in
		0)	if [ -z "$*" ]; then
				echo "Nothing selected"
			fi
			;;
		1)	echo "Cancel pressed."
			exit 1
			;;
	esac
fi

${MKDIR} ${WRKDIRPREFIX}${CURDIR}
exec > ${WRKDIRPREFIX}${CURDIR}/Makefile.inc

INCLUDE_PATH=${LOCALBASE}/include/
LIB_PATH=${LOCALBASE}/lib/

while [ "$1" ]; do
	case $1 in
		\"Client\")
			echo "CONFIGURE_ARGS+= --with-client"
			export GUILE=Yes
			;;
		\"DBM\")
			echo "CONFIGURE_ARGS+= --enable-dbm=ndbm"
			;;
		\"MySQL\")
			echo "USE_MYSQL=	YES"
			echo "CONFIGURE_ARGS+= --with-mysql"
			LIB_PATH="$LIB_PATH:${LOCALBASE}/lib/mysql/"
			;;
		\"PostgreSQL\")
			echo "POSTGRESQL_PORT?=	databases/postgresql7"
			echo "LIB_DEPENDS+=	pq.3:\${PORTSDIR}/\${POSTGRESQL_PORT}"
			echo "CONFIGURE_ARGS+= --with-postgres"
			INCLUDE_PATH="$INCLUDE_PATH:${LOCALBASE}/include/pgsql/"
			;;
		\"SNMP\")
			echo "CONFIGURE_ARGS+= --enable-snmp"
			;;
		\"Notify\")
			echo "CONFIGURE_ARGS+= --enable-notify"
			;;
		*)
			echo "Invalid option(s): $*" > /dev/stderr
			rm -f ${WRKDIRPREFIX}${REALCURDIR}/Makefile.inc
			exit 1
			;;
	esac
	shift
done

echo "CONFIGURE_ARGS+= --with-include-path=\"$INCLUDE_PATH\""
echo "CONFIGURE_ARGS+= --with-lib-path=\"$LIB_PATH\""

if [ -z $GUILE ]; then
	echo "CONFIGURE_ARGS+= --without-guile"
	echo "GUILE=	\"@comment \""
else
	echo "BUILD_DEPENDS+= guile:${PORTSDIR}/lang/guile"
	echo "GUILE=	\"\""
	unset GUILE
fi

echo "PLIST_SUB+=	GUILE=\${GUILE}"