2 # LB_DOWNSTREAM_RELEASE
4 AC_DEFUN([LB_DOWNSTREAM_RELEASE],
5 [AC_ARG_WITH([downstream-release],
6 AC_HELP_STRING([--with-downstream-release=string],
7 [set a string in the BUILD_VERSION and RPM Release: (default is nothing)]),
8 [DOWNSTREAM_RELEASE=$with_downstream_release],
10 # if not specified, see if it's in the META file
12 DOWNSTREAM_RELEASE=$(sed -ne '/^LOCAL_VERSION =/s/.*= *//p' META)
15 AC_SUBST(DOWNSTREAM_RELEASE)
21 # Check if the source is a GA release and if not, set a "BUILDID"
23 # Currently there are at least two ways/modes of/for doing this. One
24 # is if we are in a valid git repository, the other is if we are in a
25 # non-git source tree of some form. Building the latter from the former
26 # will be handled here.
27 AC_DEFUN([LB_BUILDID],
29 AC_MSG_CHECKING([for buildid])
31 if git branch >/dev/null 2>&1; then
34 ver=$(git describe --match v[[0-9]]_*_[[0-9]]* --tags)
35 if [[[ $ver = *-*-* ]]]; then
41 # it's tempting to use [[ $ver =~ ^v([0-9]+_)+([0-9]+|RC[0-9]+)$ ]]
42 # here but the portability of the regex on the right is dismal
44 if echo "$ver" | egrep -q "^v([[0-9]]+_)+([[0-9]]+|RC[[0-9]]+)$"; then
45 ver=$(echo $ver | sed -e 's/^v\(.*\)/\1/' \
46 -e 's/_RC[[0-9]].*$//' -e 's/_/./g')
49 # a "lustre fix" value of .0 should be truncated
50 if [[[ $ver = *.*.*.0 ]]]; then
53 # ditto for a "lustre fix" value of _0
54 if [[[ $ver = v*_*_*_0 ]]]; then
57 if [[[ $ver = v*_*_* ]]]; then
62 if test "$ffw" != "0"; then
64 msg="$BUILDID (ahead by $ffw commits)"
67 AC_MSG_RESULT([none... congratulations, you must be on a tag])
69 elif test -f META; then
70 BUILDID=$(sed -ne '/^BUILDID =/s/.*= *//p' META)
71 msg="$BUILDID (from META file)"
74 AC_MSG_WARN([FIXME: I don't know how to deal with source trees outside of git that don't have a META file. Not setting a buildid.])
82 # Check for file existance even when cross compiling
84 AC_DEFUN([LB_CHECK_FILE],
85 [AS_VAR_PUSHDEF([lb_File], [lb_cv_file_$1])dnl
86 AC_CACHE_CHECK([for $1], lb_File,
87 [if test -r "$1"; then
88 AS_VAR_SET(lb_File, yes)
90 AS_VAR_SET(lb_File, no)
92 AS_IF([test AS_VAR_GET(lb_File) = yes], [$2], [$3])[]dnl
93 AS_VAR_POPDEF([lb_File])dnl
99 # add -include config.h
101 AC_DEFUN([LB_CONFIG_HEADERS],[
102 AC_CONFIG_HEADERS([config.h])
103 CPPFLAGS="-include $PWD/config.h $CPPFLAGS"
104 EXTRA_KCFLAGS="-include $PWD/config.h $EXTRA_KCFLAGS"
105 AC_SUBST(EXTRA_KCFLAGS)
111 # defines for including the toplevel Rules
113 AC_DEFUN([LB_INCLUDE_RULES],[
114 INCLUDE_RULES="include $PWD/Rules"
115 AC_SUBST(INCLUDE_RULES)
121 # checks on the C compiler
123 AC_DEFUN([LB_PROG_CC],
126 # --------- unsigned long long sane? -------
127 AC_CHECK_SIZEOF(unsigned long long, 0)
128 echo "---> size SIZEOF $SIZEOF_unsigned_long_long"
129 echo "---> size SIZEOF $ac_cv_sizeof_unsigned_long_long"
130 if test $ac_cv_sizeof_unsigned_long_long != 8 ; then
131 AC_MSG_ERROR([** we assume that sizeof(long long) == 8.])
134 if test $target_cpu == "powerpc64"; then
135 AC_MSG_WARN([set compiler with -m64])
136 CFLAGS="$CFLAGS -m64"
140 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
143 # Add _GNU_SOURCE for strnlen on linux
144 LLCFLAGS="-g -Wall -fPIC -D_GNU_SOURCE"
147 CCASFLAGS="-Wall -fPIC -D_GNU_SOURCE"
154 # build-specific config files
156 AC_DEFUN([LB_CONFIG_FILES],
161 [Rules:build/Rules.in]
162 AC_PACKAGE_TARNAME[.spec]