xref: /openssh-portable/.github/configs (revision 29e194a7)
1#!/bin/sh
2#
3# usage: configs vmname test_config (or '' for default)
4#
5# Sets the following variables:
6# CONFIGFLAGS           options to ./configure
7# SSHD_CONFOPTS         sshd_config options
8# TEST_TARGET           make target used when testing.  defaults to "tests".
9# LTESTS
10
11config=$1
12
13TEST_TARGET="tests"
14LTESTS=""
15SKIP_LTESTS=""
16SUDO=sudo	# run with sudo by default
17TEST_SSH_UNSAFE_PERMISSIONS=1
18
19CONFIGFLAGS=""
20LIBCRYPTOFLAGS=""
21
22case "$config" in
23    default|sol64)
24	;;
25    c89)
26	CC="gcc"
27	CFLAGS="-Wall -std=c89 -pedantic -Werror=vla"
28	CONFIGFLAGS="--without-openssl --without-zlib"
29	TEST_TARGET=t-exec
30	;;
31    kitchensink)
32	CONFIGFLAGS="--with-kerberos5 --with-libedit --with-pam"
33	CONFIGFLAGS="${CONFIGFLAGS} --with-security-key-builtin --with-selinux"
34	CONFIGFLAGS="${CONFIGFLAGS} --with-cflags=-DSK_DEBUG"
35	;;
36    hardenedmalloc)
37	CONFIGFLAGS="--with-ldflags=-lhardened_malloc"
38	;;
39    kerberos5)
40	CONFIGFLAGS="--with-kerberos5"
41	;;
42    libedit)
43	CONFIGFLAGS="--with-libedit"
44	;;
45    pam-krb5)
46	CONFIGFLAGS="--with-pam --with-kerberos5"
47	SSHD_CONFOPTS="UsePam yes"
48	;;
49    *pam)
50	CONFIGFLAGS="--with-pam"
51	SSHD_CONFOPTS="UsePam yes"
52	;;
53    libressl-*)
54	LIBCRYPTOFLAGS="--with-ssl-dir=/opt/libressl --with-rpath=-Wl,-rpath,"
55	;;
56    openssl-*)
57	LIBCRYPTOFLAGS="--with-ssl-dir=/opt/openssl --with-rpath=-Wl,-rpath,"
58	;;
59    selinux)
60	CONFIGFLAGS="--with-selinux"
61	;;
62    sk)
63	CONFIGFLAGS="--with-security-key-builtin"
64        ;;
65    without-openssl)
66	LIBCRYPTOFLAGS="--without-openssl"
67	TEST_TARGET=t-exec
68	;;
69    valgrind-[1-4]|valgrind-unit)
70	# rlimit sandbox and FORTIFY_SOURCE confuse Valgrind.
71	CONFIGFLAGS="--without-sandbox --without-hardening"
72	CONFIGFLAGS="$CONFIGFLAGS --with-cppflags=-D_FORTIFY_SOURCE=0"
73	TEST_TARGET="t-exec USE_VALGRIND=1"
74	TEST_SSH_ELAPSED_TIMES=1
75	export TEST_SSH_ELAPSED_TIMES
76	# Valgrind slows things down enough that the agent timeout test
77	# won't reliably pass, and the unit tests run longer than allowed
78	# by github so split into three separate tests.
79	tests2="rekey integrity"
80	tests3="krl forward-control sshsig"
81	tests4="cert-userkey cert-hostkey kextype sftp-perm keygen-comment"
82	case "$config" in
83	    valgrind-1)
84		# All tests except agent-timeout (which is flaky under valgrind)
85		#) and slow ones that run separately to increase parallelism.
86		SKIP_LTESTS="agent-timeout ${tests2} ${tests3} ${tests4}"
87		;;
88	    valgrind-2)
89		LTESTS="${tests2}"
90		;;
91	    valgrind-3)
92		LTESTS="${tests3}"
93		;;
94	    valgrind-4)
95		LTESTS="${tests4}"
96		;;
97	    valgrind-unit)
98		TEST_TARGET="unit USE_VALGRIND=1"
99		;;
100	esac
101	;;
102    *)
103	echo "Unknown configuration $config"
104	exit 1
105	;;
106esac
107
108# The Solaris 64bit targets are special since they need a non-flag arg.
109case "$config" in
110    sol64*)
111	CONFIGFLAGS="x86_64 --with-cflags=-m64 --with-ldflags=-m64 ${CONFIGFLAGS}"
112	LIBCRYPTOFLAGS="--with-ssl-dir=/usr/local/ssl64"
113	;;
114esac
115
116case "${TARGET_HOST}" in
117    nbsd4)
118	# System compiler will ICE on some files with fstack-protector
119	CONFIGFLAGS="${CONFIGFLAGS} --without-hardening"
120	;;
121    sol10|sol11)
122	# sol10 VM is 32bit and the unit tests are slow.
123	# sol11 has 4 test configs so skip unit tests to speed up.
124	TEST_TARGET="tests SKIP_UNIT=1"
125	;;
126    win10)
127	# No sudo on Windows.
128	SUDO=""
129	;;
130esac
131
132# If we have a local openssl/libressl, use that.
133if [ -z "${LIBCRYPTOFLAGS}" ]; then
134	# last-match
135	for i in /usr/local /usr/local/ssl /usr/local/opt/openssl; do
136		if [ -x ${i}/bin/openssl ]; then
137			LIBCRYPTOFLAGS="--with-ssl-dir=${i}"
138		fi
139	done
140fi
141
142CONFIGFLAGS="${CONFIGFLAGS} ${LIBCRYPTOFLAGS}"
143
144if [ -x "$(which plink 2>/dev/null)" ]; then
145	REGRESS_INTEROP_PUTTY=yes
146	export REGRESS_INTEROP_PUTTY
147fi
148
149export LTESTS SUDO TEST_TARGET TEST_SSH_UNSAFE_PERMISSIONS
150