summaryrefslogtreecommitdiff
path: root/net/gnu-radius/scripts/configure
blob: 5e95f25e93b189abaca772d4d1743a2957936d1d (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#!/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+= --enable-client"
			export CLIENT=Yes
			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/"
			export MYSQL=Yes
			;;
		\"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/"
			export PGSQL=Yes
			;;
		\"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

if [ -z $CLIENT ]; then
	echo "CLIENT=   \"@comment \""
else
	echo "CLIENT=   \"\""
	unset CLIENT
fi

if [ -z $MYSQL ]; then
	echo "MYSQL=    \"@comment \""
else
	echo "MYSQL=    \"\""
	unset MYSQL
fi

if [ -z $PGSQL ]; then
	echo "PGSQL=    \"@comment \""
else
	echo "PGSQL=    \"\""
	unset PGSQL
fi

echo "PLIST_SUB+=	GUILE=\${GUILE}"
echo "PLIST_SUB+=	CLIENT=\${CLIENT}"
echo "PLIST_SUB+=	PGSQL=\${PGSQL}"
echo "PLIST_SUB+=	MYSQL=\${MYSQL}"