CVS: beepcore-c beepcore-c-config.in,NONE,1.1

Chris Hanson <[email protected]> Thu, 01 Aug 2002 18:45:13 -0700
Newsgroups gmane.network.beep.beepcore.c.cvs
Message-ID <[email protected]>
Update of /cvsroot/beepcore-c/beepcore-c
In directory usw-pr-cvs1:/tmp/cvs-serv1971

Added Files:
	beepcore-c-config.in 
Log Message:
Add beepcore-c-config shell script.


--- NEW FILE: beepcore-c-config.in ---
#!/bin/sh
# @configure_input@
#
# Copyright (c) 2002 Invisible Worlds, Inc.  All rights reserved.
# 
# The contents of this file are subject to the Blocks Public License (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.invisible.net/
# 
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
# for the specific language governing rights and limitations under the
# License.
#
# $Id: beepcore-c-config.in,v 1.1 2002/08/02 01:45:09 cphmit Exp $

set -e

prefix="@prefix@"
exec_prefix="@exec_prefix@"
includedir="@includedir@"
libdir="@libdir@"

PROGRAM_VERSION="@PROGRAM_VERSION@"
TARGET_LIBS="@TARGET_LIBS@"
TARGET_DEFINES="@TARGET_DEFINES@"
SSL_LIBS="@SSL_LIBS@"
SSL_INCLUDES="@SSL_INCLUDES@"
CYRUS_LIBS="@CYRUS_LIBS@"
CYRUS_DEFINES="@CYRUS_DEFINES@"
CYRUS_INCLUDES="@CYRUS_INCLUDES@"

ECHO_CFLAGS=
ECHO_TLS_CFLAGS=
ECHO_CYRUS_CFLAGS=
ECHO_LIBS=
ECHO_TLS_LIBS=
ECHO_CYRUS_LIBS=

usage ()
{
    cat 1>&2 <<EOF
Usage: beepcore-c-config [OPTIONS]
Options:
    [--version]      print beepcore-c version
    [--cflags]       print flags for compiling against beepcore-c
    [--tls-cflags]   print flags for compiling against TLS profile
    [--cyrus-cflags] print flags for compiling against Cyrus SASLv2 profiles
    [--libs]         print flags for linking to beepcore-c
    [--tls-libs]     print flags for linking to TLS profile
    [--cyrus-libs]   print flags for linking to Cyrus SASLv2 profiles
EOF
    exit 1
}

[ $# -gt 0 ] || usage
while [ $# -gt 0 ]; do
    case "${1}" in
	(--version)
	    echo "${PROGRAM_VERSION}"
	    exit 0
	    ;;
	(--cflags)
	    ECHO_CFLAGS=yes
	    ;;
	(--tls-cflags)
	    ECHO_TLS_CFLAGS=yes
	    ECHO_CFLAGS=yes
	    ;;
	(--cyrus-cflags)
	    ECHO_CYRUS_CFLAGS=yes
	    ECHO_CFLAGS=yes
	    ;;
	(--libs)
	    ECHO_LIBS=yes
	    ;;
	(--tls-libs)
	    ECHO_TLS_LIBS=yes
	    ECHO_LIBS=yes
	    ;;
	(--cyrus-libs)
	    ECHO_CYRUS_LIBS=yes
	    ECHO_LIBS=yes
	    ;;
	(*)
	    usage
	    ;;
    esac
    shift
done

if [ "${ECHO_CFLAGS}" ]; then
    add_cflags ()
    {
	if [ "${1}" ]; then
	    if [ "${CFLAGS_STRING}" ]; then
		CFLAGS_STRING="${CFLAGS_STRING} ${1}"
	    else
		CFLAGS_STRING="${1}"
	    fi
	fi
    }

    CFLAGS_STRING=""
    if [ "${ECHO_TLS_CFLAGS}" ]; then
	add_cflags "${SSL_INCLUDES}"
    fi
    if [ "${ECHO_CYRUS_CFLAGS}" ]; then
	add_cflags "${CYRUS_DEFINES}"
	add_cflags "${CYRUS_INCLUDES}"
    fi
    add_cflags "${TARGET_DEFINES}"

    if [ "${includedir}" != "/usr/include" ]; then
	CFLAGS_STRING="-I${includedir} ${CFLAGS_STRING}"
    fi

    echo "${CFLAGS_STRING}"
fi

if [ "${ECHO_LIBS}" ]; then
    add_libs ()
    {
	if [ "${1}" ]; then
	    if [ "${LIBS_STRING}" ]; then
		LIBS_STRING="${LIBS_STRING} ${1}"
	    else
		LIBS_STRING="${1}"
	    fi
	fi
    }

    LIBS_STRING=""
    if [ "${ECHO_TLS_LIBS}" ]; then
	add_libs "-ltls-profile"
	add_libs "${SSL_LIBS}"
	add_libs "-lssl"
	add_libs "-lcrypto"
    fi
    if [ "${ECHO_CYRUS_LIBS}" ]; then
	add_libs "-lcyrus-profiles"
	add_libs "${CYRUS_LIBS}"
    fi
    add_libs "-lbeepcore-c"
    add_libs "${TARGET_LIBS}"

    if [ "${libdir}" != "/usr/lib" ]; then
	LIBS_STRING="-L${libdir} ${LIBS_STRING}"
    fi

    echo "${LIBS_STRING}"
fi

exit 0



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf