#!/bin/sh
#/*----------------------------------------------------------------------------*/
#/*                                                                            */
#/* Copyright (c) 2014-2018 Rexx Language Association. All rights reserved.    */
#/*                                                                            */
#/* This program and the accompanying materials are made available under       */
#/* the terms of the Common Public License v1.0 which accompanies this         */
#/* distribution. A copy is also available at the following address:           */
#/* http://www.oorexx.org/license.html                                         */
#/*                                                                            */
#/* Redistribution and use in source and binary forms, with or                 */
#/* without modification, are permitted provided that the following            */
#/* conditions are met:                                                        */
#/*                                                                            */
#/* Redistributions of source code must retain the above copyright             */
#/* notice, this list of conditions and the following disclaimer.              */
#/* Redistributions in binary form must reproduce the above copyright          */
#/* notice, this list of conditions and the following disclaimer in            */
#/* the documentation and/or other materials provided with the distribution.   */
#/*                                                                            */
#/* Neither the name of Rexx Language Association nor the names                */
#/* of its contributors may be used to endorse or promote products             */
#/* derived from this software without specific prior written permission.      */
#/*                                                                            */
#/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS        */
#/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT          */
#/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS          */
#/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT   */
#/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,      */
#/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED   */
#/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,        */
#/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY     */
#/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING    */
#/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS         */
#/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.               */
#/*                                                                            */
#/*----------------------------------------------------------------------------*/
version=5.0.0
prefix=/usr
includedir=/include
libdir=/lib

usage()
{
    echo "Usage: oorexx-config [OPTION]"
    echo ""
    echo "Available values for OPTION include:"
    echo ""
    echo "  --help         display this help and exit"
    echo "  --cflags       pre-processor and compiler flags"
    echo "                 [-I$includedir]"
    echo "  --libs         library linking information"
#    echo "                 [-L$libdir -l      ]"
    echo "                 [-L$libdir -lrexx -lrexxapi"
    echo "  --prefix       oorexx install prefix"
    echo "                 [$prefix]"
    echo "  --version      output version information"
    echo "                 [$version]"
    exit $1
}

if test $# -eq 0; then
    usage 1
fi

while test $# -gt 0; do
    case "$1" in
    # this deals with options in the style
    # --option=value and extracts the value part
    # [not currently used]
       -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
       *) value= ;;
    esac

    case "$1" in
       --prefix)
          echo $prefix
          ;;

       --version)
          echo $version
          exit 0
          ;;

       --help)
          usage 0
          ;;

       --cflags)
          echo -I$includedir
          ;;

       --libs)
#          echo -L$libdir -l      
          echo -L$libdir -lrexx -lrexxapi
          ;;

       *)
          usage
          exit 1
          ;;
    esac
    shift
done

exit 0
