aboutsummaryrefslogtreecommitdiff
path: root/databases/postgresql73-server/scripts/configure.postgresql
blob: f729cb22b7bf7e65402480bf23c483f5158e92c3 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/bin/sh
# -*- tab-width: 4; -*-
# ex:ts=4
#
# $FreeBSD$
#
if [ -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc ]; then
	exit
fi

if [ ! "${BATCH}" ]; then
	dialog --title "Backup your data NOW" \
	--msgbox "`sed -e \"s#%%WRKDIR%%#${WRKDIR}#; s#%%DISTNAME%%#${DISTNAME}#\" < ${FILESDIR}/pre-install-notes`" \
	-1 -1
fi

#SSL=${NO_OPENSSL:+OFF}
#SSL=${NOSSL:-ON}

if [ "${BATCH}" ]; then
	set \"MultiByte\"
else
	/usr/bin/dialog --title "configuration options" --clear \
					--checklist "\n\
Please select desired options:" -1 -1 8 \
JDBC       "Java DataBase Connectivity" OFF \
MultiByte  "Multibyte for Multilingualism" ON \
ODBC       "Open Database Connectivity" OFF \
Perl       "Perl" OFF \
TCL        "Tcl" ON \
TCLTK      "Tcl/Tk" ON \
SSL        "Secure Socket Layer (requires certificate)" OFF \
KRB5       "Kerberos 5" OFF \
2> /tmp/checklist.tmp.$$

	retval=$?

	if [ -s /tmp/checklist.tmp.$$ ]; then
		set `cat /tmp/checklist.tmp.$$`
	fi
	rm -f /tmp/checklist.tmp.$$

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

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

while [ "$1" ]; do
	case $1 in
		\"JDBC\")
			# use JAVA_HOME if set correctly
			echo "# JDBC"
			if [ "${JAVA_HOME}" -a -x ${JAVA_HOME}/bin/javac ]; then
				echo JAVA_HOME=${JAVA_HOME}
				if [ "$(${JAVA_HOME}/bin/java -version 2>&1 | egrep \"1.1)" ]; then
				    JAVAVERSION=1
					echo BUILD_DEPENDS+=    ${JAVA_HOME}/bin/javac:\${PORTSDIR}/java/jdk
				else
					JAVAVERSION=2
					echo BUILD_DEPENDS+=    ${JAVA_HOME}/bin/javac:\${PORTSDIR}/java/jdk12-beta
				fi
			else
				JAVAVERSION=1
				echo BUILD_DEPENDS+=    \${LOCALBASE}/jdk1.1.8/bin/javac:\${PORTSDIR}/java/jdk
				echo JAVA_HOME=\${LOCALBASE}/jdk1.1.8
			fi
			cat <<-EOF
				JAVAVERSION=${JAVAVERSION}
				WITH_JDBC=YES
				SCRIPTS_ENV+=     JAVA_HOME=\${JAVA_HOME}

			EOF
			;;
		\"MultiByte\")
			MULTIBYTE=1
			;;
		\"ODBC\")
			cat <<-EOF
				# ODBC
				WITH_ODBC=YES
				CONFIGURE_ARGS+=  --with-odbc

			EOF
			;;
		\"Perl\")
			cat <<-EOF
				# PERL
				WITH_PERL=YES
				CONFIGURE_ARGS+=  --with-perl

			EOF
			;;
		\"TCL\")
			TCL=1
			;;
		\"TCLTK\")
			echo "#TCLTK"
			echo WITH_TK=YES
			echo
			TCL=1
			;;
		\"SSL\")
			cat <<-EOF
				# SSL
				USE_OPENSSL=    yes
				CFLAGS+=	-DUSE_SSL
				WITH_SSL=	yes
				CONFIGURE_ENV+=	LDFLAGS="-L\${OPENSSLLIB} -lssl -lcrypto"

			EOF
			;;
		\"KRB5\")
			KRB5=1
			;;
		\"nothing\"|true)
			;;
		*)
			echo "Invalid option(s): $*" > /dev/stderr
			rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
			exit 1
			;;
	esac
    shift
done

exec > /dev/stderr

# if multibyte, determine charset
echo "# Multibyte" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc

if [ ! "${MULTIBYTE}" ]; then
	echo "WITHOUT_MULTIBYTE=YES" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
else
	if [ "${BATCH}" ]; then
		set "nothing"
	else
		/usr/bin/dialog --title "configuration options" --clear \
						--radiolist "\n\
Please select desired options:" -1 -1 16 \
nothing       "Default Encoding" ON \
SQL_ASCII     "SQL_ASCII" OFF \
LATIN1        "LATIN1" OFF \
LATIN2        "LATIN2" OFF \
LATIN3        "LATIN3" OFF \
LATIN4        "LATIN4" OFF \
LATIN5        "LATIN5" OFF \
EUC_JP        "EUC_JP" OFF \
EUC_CN        "EUC_CN" OFF \
EUC_KR        "EUC_KR" OFF \
EUC_TW        "EUC_TW" OFF \
KOI8          "KOI8" OFF \
UNICODE       "UNICODE" OFF \
MULE_INTERNAL "MULE_INTERNAL" OFF \
WIN           "WIN" OFF \
ALT           "ALT" OFF \
2> /tmp/checklist.tmp.$$

		retval=$?

		if [ -s /tmp/checklist.tmp.$$ ]; then
			set `cat /tmp/checklist.tmp.$$`
		fi
		rm -f /tmp/checklist.tmp.$$
		if [ $retval = 1 ]; then
			echo "Cancel pressed."
			rm ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
			exit 1
		fi
	fi

    if [ "$1" = "nothing" ]; then
		echo "CONFIGURE_ARGS+=	--enable-multibyte" \
			>> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
	else
		echo "CONFIGURE_ARGS+=	--enable-multibyte=$1" \
			>> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
	fi
fi
echo

if [ "${TCL}" ]; then
	echo "# TCL" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
	if [ "${BATCH}" ]; then
		echo WITH_TCL=8.3  >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
	else
		dialog --title "TCL version" \
			   --inputbox "Please enter TCL version. Default is 8.3." -1 -1 "8.3" \
			2> /tmp/checklist.tmp.$$
		retval=$?
		if [ -s /tmp/checklist.tmp.$$ ]; then
			set `cat /tmp/checklist.tmp.$$`
		fi
		rm -f /tmp/checklist.tmp.$$
		case $retval in
			0)	if [ -z "$*" ]; then
					echo "Nothing selected"
				fi
				;;
			1)	echo "Cancel pressed."
				rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
				exit 1
				;;
		esac
		echo WITH_TCL=\"$1\" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
	fi
	cat <<-EOF >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
		CONFIGURE_ARGS+= --with-tcl --with-tclconfig="\${TCLCONFIG}"
		TCLV=\${WITH_TCL:S/.//}
		TCL_INCDIR=    \${LOCALBASE}/include/tcl\${WITH_TCL}
		MAKE_ENV=      TCL_INCDIR=\${TCL_INCDIR}
		LIB_DEPENDS=   tcl\${TCLV}.1:\${PORTSDIR}/lang/tcl\${TCLV}
		TCLCONFIG=     '\${LOCALBASE}/lib/tcl\${WITH_TCL}'
		.if defined(WITH_TK)
		TK_INCDIR=     \${LOCALBASE}/include/tk\${WITH_TCL}
		CONFIGURE_ENV+=        WISH=\${LOCALBASE}/bin/wish\${WITH_TCL}
		LIB_DEPENDS+=  tk\${TCLV}.1:\${PORTSDIR}/x11-toolkits/tk\${TCLV}
		TCLCONFIG+=    '\${LOCALBASE}/lib/tk\${WITH_TCL}'
		TCL_PLIST=     pkg-plist.tcl
		.else
		TCL_PLIST=     pkg-plist.notk
		CONFIGURE_ARGS+=        --without-tk
		.endif

	EOF
fi

if [ "${KRB5}" ]; then
	if [ "${BATCH}" ]; then
		# never gets here, but what the heck...
		echo KRB5_HOME=\${LOCALBASE} >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
	else
		dialog --inputbox "Please enter the KRB5_HOME path" -1 -1 "${KRB_HOME:-${LOCALBASE}}" \
			2> /tmp/checklist.tmp.$$
		retval=$?
		if [ -s /tmp/checklist.tmp.$$ ]; then
			set `cat /tmp/checklist.tmp.$$`
		fi
		rm -f /tmp/checklist.tmp.$$
		case $retval in
			0)	if [ -z "$*" ]; then
					echo "No input"
				fi
				;;
			1)	echo "Cancel pressed."
				rm -f ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
				exit 1
				;;
		esac
		echo KRB5_HOME=\"$1\" >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
	fi
	cat <<-EOF >> ${WRKDIRPREFIX}${CURDIR}/Makefile.inc
		.if defined(KRB5_HOME) && exists(\${KRB5_HOME})
		CONFIGURE_KRB=	--with-krb5=\${KRB5_HOME} \
						--with-krb-keytab=FILE:\${PREFIX}/pgsql/etc/keytab
		.endif

	EOF
fi