xref: /freebsd/crypto/openssh/freebsd-configure.sh (revision ec0ea6efa1ad229d75c394c1a9b9cac33af2b1d3)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6configure_args="
7    --prefix=/usr
8    --sysconfdir=/etc/ssh
9    --with-pam
10    --with-ssl-dir=/usr
11    --without-tcp-wrappers
12    --with-libedit
13    --with-ssl-engine
14    --without-xauth
15    --without-security-key-internal
16"
17
18set -e
19
20openssh=$(dirname $(realpath $0))
21cd $openssh
22
23# Run autotools before we drop LOCALBASE out of PATH
24(cd $openssh && libtoolize --copy && autoheader && autoconf)
25
26# Ensure we use the correct toolchain and clean our environment
27export CC=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCC)
28export CPP=$(echo ".include <bsd.lib.mk>" | make -f /dev/stdin -VCPP)
29unset CFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH LIBS
30export PATH=/bin:/sbin:/usr/bin:/usr/sbin
31
32# Generate config.h with krb5 and stash it
33sh configure $configure_args --with-kerberos5=/usr
34mv config.log config.log.kerberos5
35mv config.h config.h.kerberos5
36
37# Generate config.h without krb5
38sh configure $configure_args --without-kerberos5
39
40# Extract the difference
41echo '/* $Free''BSD$ */' > krb5_config.h
42diff -u config.h.kerberos5 config.h |
43	sed -n '/^-#define/s/^-//p' |
44	grep -Ff /dev/stdin config.h.kerberos5 >> krb5_config.h
45