Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-dev@g.o
From: Mike Frysinger <vapier@g.o>
Subject: autoconf-cache.eclass: helper functions for managing autoconf cache variables
Date: Tue, 29 Nov 2011 19:11:57 -0500
as i started to write more open coded autoconf cache variable tweaks, i got
annoyed to write a simple eclass.  here's a rough PoC.
-mike

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/autotools.eclass,v 1.110 2011/11/14 17:08:49 vapier Exp $

# @ECLASS: autotools-cache.eclass
# @MAINTAINER:
# base-system@g.o
# @BLURB: Simplify management of autotool cache variables

# just for usex()
inherit eutils

_ac_varify() {
	echo ${1//[![:alnum:]_]/_}
}

ac_cv() {
	export ac_cv_$(_ac_varify "$1")="$2"
}

# @FUNCTION: ac_check_lib
# @USAGE: "<function> <library> [value]" ["<function> <library> [value]" ...]
ac_check_lib() {
	local line
	for line in "$@" ; do
		local args=( ${line} )
		local func=${args[0]} lib=${args[1]} val=${args[2]}
		ac_cv "lib_${lib}_${func}" "${val:-no}"
	done
}
# @FUNCTION: use_ac_check_lib
# @USAGE: <USE flag> "<function> <library>" ["<function> <library>" ...]
use_ac_check_lib() {
	local flag=$1 line packed=()
	for line in "${@:2}" ; do
		packed+=$( "${line} $(usex ${flag})" )
	done
	${FUNCNAME#use_} "${packed[@]}"
}

# @FUNCTION: ac_search_libs
# @USAGE: "<function> [value]" ["<function> [value]" ...]
ac_search_libs() {
	local line
	for line in "$@" ; do
		local args=( ${line} )
		local func=${args[0]} val=${args[1]}
		ac_cv "search_${func}" "${val:-no}"
	done
}
# @FUNCTION: use_ac_search_libs
# @USAGE: <USE flag> "<function> <library>" ["<function> <library>" ...]
use_ac_search_libs() {
	local flag=$1 line packed=()
	for line in "${@:2}" ; do
		local args=( ${line} )
		local lib=${args[1]}
		packed+=( "${line} $(usex ${flag} -l${lib})" )
	done
	${FUNCNAME#use_} "${packed[@]}"
}

# @FUNCTION: ac_check_headers
# @USAGE: "<header> [value]" ["<header> [value]" ...]
ac_check_headers() {
	local line
	for line in "$@" ; do
		local args=( ${line} )
		local h=${args[0]} val=${args[1]}
		ac_cv "header_${h}" "${val:-no}"
	done
}
# @FUNCTION: use_ac_check_headers
# @USAGE: <USE flag> <headers>
use_ac_check_headers() {
	local flag=$1 h packed=()
	for h in "${@:2}" ; do
		packed+=( "${h} $(usex ${flag})" )
	done
	ac_check_headers "${packed[@]}"
}
Attachment:
signature.asc (This is a digitally signed message part.)
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
sys-libs/zlib: punt from system in profiles
Next by thread:
[warning] the bug queue has 91 bugs
Previous by date:
sys-libs/zlib: punt from system in profiles
Next by date:
Re: sys-libs/zlib: punt from system in profiles


Updated Jun 29, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.