Add files from parent branch HEAD:
[pkgsrc.git] / mk / check / check-portability.mk
1 # $NetBSD: check-portability.mk,v 1.5 2008/02/20 10:27:35 rillig Exp $
2 #
3 # This file contains some checks that are applied to the configure
4 # scripts to check for certain constructs that are known to cause
5 # problems on some platforms.
6 #
7 # The following variables may be set by the pkgsrc user in mk.conf:
8 #
9 # CHECK_PORTABILITY
10 #       Whether to enable some portability checks for the configure
11 #       scripts before they are run.
12 #
13 #       Default value: yes for PKG_DEVELOPERs, no otherwise.
14 #
15 # The following variables may be set by the package:
16 #
17 # SKIP_PORTABILITY_CHECK
18 #       Whether the above checks should be skipped for the current
19 #       package.
20 #
21 #       Default value: no
22 #       Deprecated: Use CHECK_PORTABILITY_SKIP instead.
23 #       Obsolete since 2008-02-20.
24 #
25 # CHECK_PORTABILITY_SKIP
26 #       The list of files that should be skipped in the portability
27 #       check.
28 #
29 #       Default value: empty.
30 #       Example: debian/*
31
32 _VARGROUPS+=                    check-portability
33 _USER_VARS.check-portability=   CHECK_PORTABILITY
34 _PKG_VARS.check-portability=    CHECK_PORTABILITY_SKIP
35
36 .if defined(PKG_DEVELOPER)
37 CHECK_PORTABILITY?=             yes
38 .endif
39 CHECK_PORTABILITY?=             no
40 .if defined(SKIP_PORTABILITY_CHECK)
41 PKG_FAIL_REASON+=               "[check-portability.mk] SKIP_PORTABILITY_CHECK is obsolete."
42 .endif
43 CHECK_PORTABILITY_SKIP?=        # none
44
45 .if ${CHECK_PORTABILITY:M[Yy][Ee][Ss]} != ""
46 pre-configure-checks-hook: _check-portability
47 .endif
48 .PHONY: _check-portability
49 _check-portability:
50         @${STEP_MSG} "Checking for portability problems in extracted files"
51         ${RUN}                                                          \
52         [ -d ${WRKSRC}/. ] || exit 0;                                   \
53         cd ${WRKSRC};                                                   \
54         env     SKIP_FILTER=${CHECK_PORTABILITY_SKIP:@p@${p}) skip=yes;;@:Q} \
55                 sh ${PKGSRCDIR}/mk/check/check-portability.sh