#!/usr/bin/perl
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

$rcsid='$Id: version.pl,v 1.8 2006/06/19 10:10:23 areggiori Exp $';
#
$h=`hostname`;
chop $h;
$id='??';
if ($^O =~ m/solaris/i) {
	$id=`whoami`;
	chop $id;
} else {
	$a=`id -u -n`;
	$id=$1 if $a=~ m/(\w+)/;
}

# $a=`pwd`;
# $a =~ m/dbms-(\d+)\.(\d+)/
# 	or die "no version in $a";
# $version =$1 * 100 +$2;

$rcsid =~ m/Id:\s+\S+\s+([\d\.]+)\s+/
	or die "No version in rcs version";

$version = $1;
$date=gmtime(time);

print qq|\
/*>version.c - $0 generated - $version
 * $rcsid
 */
#include <sys/types.h>

#include "dbms_compat.h"

#if 0
static char rcsid[]="$rcsid";
#endif

static char version[]= "DBMS/$version - $date - $id\@$h - "
#ifdef DB_VERSION_MAJOR
	DB_VERSION_STRING
#else
	"Berkeley DB 1.x (perhaps BSD-ish built in library)"
#endif

#ifdef FORKING
	" - forking"
#else
	" - NON forking"
#endif
#ifdef STATIC_BUFF
	" - recycle structs "
#endif
#ifdef	STATIC_CS_BUFF     
	" - static Client buffs "
#endif
#ifdef STATIC_SC_BUFF
	" - static Server buffs "
#endif

	;

char * get_full( void ) {
	return version;
	}
|;


