summaryrefslogtreecommitdiff
blob: 9c3a342207ec8dcae498569f97bb544c44502c8c (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/db4-fix.eclass,v 1.4 2004/06/25 00:39:48 vapier Exp $
#
# Author: Paul de Vrieze <pauldv@gentoo.org>
#
# This eclass is meant to fix configure scripts to work with our versioned db4
#
# the dodb4-fix script should be run from the directory where autoconf needs to
# be run from

ECLASS=db4-fix
INHERITED="$INHERITED $ECLASS"

DEPEND="sys-apps/sed"

DESCRIPTION="Based on the ${ECLASS} eclass"

EDB4_FIX_VERSION=0.1

dodb4-fix () {
	postfix=`grep "#define.db_create" /usr/include/db4/db.h \
		|cut -d " " -f 2|sed -e "s,db_create,,"`

	if [ $# -ne 1 ];then
		die "This function needs as argument the name of the file to fix"
	fi
	if has_version =sys-libs/db-4*; then
		if [ "`basename $1`" == "configure" ]; then
			die "sorry configure fixing is not supported yet"
		else
			einfo "fixing $1 to work with db-4 by appending ${postfix}"
			cp $1 ${1}.cpy
			cat ${1}.cpy \
				|sed -e "s;\( *AC_CHECK_LIB( *db-?4? *, db_[^ ,]*\);\1${postfix};" \
				-e "s/\(-l\|[ \t]\)\(db3\)\([ \t]\)/\1db-3\3/g" \
				>${1} || die "sed failed"
#				-e "s/\( *AC_CHECK_LIB([^,]*, db_create\)\( *,\)/\1${postfix}\2/" \

			autoconf
		fi
	else
		einfo "db4 not found, so not applying db4 fixes"
	fi

}