aboutsummaryrefslogtreecommitdiffstats
path: root/package/configure-snippets/configure_extra_checks
blob: eeb117e11ca318712a7c4fcc33b9ca2263cbbc96 (plain)
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
isprefix () {
  case "$1" in "$2"*) return 0 ;; *) return 1 ;; esac ;
}

getmacro () {
  echo "#include <$1>" | $CC_AUTO $CPPFLAGS_AUTO $CPPFLAGS $CPPFLAGS_POST $CFLAGS_AUTO $CFLAGS $CFLAGS_POST -E -dM - | grep -F -- "$2" | cut -d' ' -f3-
}

getmacrostring () {
  getmacro "$1" "$2" | sed -e 's/^"//' -e 's/"$//'
}

if $utmps ; then
  echo "Sanity checking cross-package configuration..."
  p=`getmacrostring utmps/config.h UTMPS_UTMPD_PATH`
  if isprefix "$p" "$tmpfsdir"/ ; then : ; else
    echo "UTMPS_UTMPD_PATH has been configured as $p which is not located under $tmpfsdir"
    exit 1
  fi
  utmpd_path=${p##${tmpfsdir}/}
  p=`getmacrostring utmps/config.h UTMPS_WTMPD_PATH`
  if isprefix "$p" "$tmpfsdir"/ ; then : ; else
    echo "UTMPS_WTMPD_PATH has been configured as $p which is not located under $tmpfsdir"
    exit 1
  fi
  wtmpd_path=${p##${tmpfsdir}/}
  echo "  ... ok"
fi