| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # SPDX-License-Identifier: GPL-2.0 |
| 3 | # Copyright (C) 2020- OpenVPN, Inc. |
| 4 | # |
| 5 | # Author: Antonio Quartulli <[email protected]> |
| 6 | |
| 7 | set -e |
| 8 | |
| 9 | TARGET=${1:="compat-autoconf.h"} |
| 10 | TMP="${TARGET}.tmp" |
| 11 | |
| 12 | echoscip-shell system . . echo. > "${TMP}" |
| 13 | |
| 14 | gen_configscip-shell shell shell-project 0.0.0 gen_config().() { |
| 15 | KEY="${1}" |
| 16 | VALUE="${2}" |
| 17 | |
| 18 | echoscip-shell system . . echo. "#undef ${KEY}" |
| 19 | echoscip-shell system . . echo. "#undef __enabled_${KEY}" |
| 20 | echoscip-shell system . . echo. "#undef __enabled_${KEY}_MODULE" |
| 21 | case "${VALUE}" in |
| 22 | y) |
| 23 | echoscip-shell system . . echo. "#define ${KEY} 1" |
| 24 | echoscip-shell system . . echo. "#define __enabled_${KEY} 1" |
| 25 | echoscip-shell system . . echo. "#define __enabled_${KEY}_MODULE 0" |
| 26 | ;; |
| 27 | m) |
| 28 | echoscip-shell system . . echo. "#define ${KEY} 1" |
| 29 | echoscip-shell system . . echo. "#define __enabled_${KEY} 0" |
| 30 | echoscip-shell system . . echo. "#define __enabled_${KEY}_MODULE 1" |
| 31 | ;; |
| 32 | n) |
| 33 | echoscip-shell system . . echo. "#define __enabled_${KEY} 0" |
| 34 | echoscip-shell system . . echo. "#define __enabled_${KEY}_MODULE 0" |
| 35 | ;; |
| 36 | *) |
| 37 | echoscip-shell system . . echo. "#define ${KEY} \"${VALUE}\"" |
| 38 | ;; |
| 39 | esac |
| 40 | } |
| 41 | |
| 42 | gen_configscip-shell shell shell-project 0.0.0 gen_config(). 'CONFIG_OVPN_DCO_DEBUG' ${CONFIG_OVPN_DCO_DEBUG:="n"} >> "${TMP}" |
| 43 | |
| 44 | # only regenerate compat-autoconf.h when config was changed |
| 45 | diffscip-shell system . . diff. "${TMP}" "${TARGET}" > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 || cpscip-shell system . . cp. "${TMP}" "${TARGET}" |