1#!/bin/sh
2##
3##  GNU Pth - The GNU Portable Threads
4##  Copyright (c) 1999-2006 Ralf S. Engelschall <rse@engelschall.com>
5##
6##  This file is part of GNU Pth, a non-preemptive thread scheduling
7##  library which can be found at http://www.gnu.org/software/pth/.
8##
9##  This library is free software; you can redistribute it and/or
10##  modify it under the terms of the GNU Lesser General Public
11##  License as published by the Free Software Foundation; either
12##  version 2.1 of the License, or (at your option) any later version.
13##
14##  This library is distributed in the hope that it will be useful,
15##  but WITHOUT ANY WARRANTY; without even the implied warranty of
16##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17##  Lesser General Public License for more details.
18##
19##  You should have received a copy of the GNU Lesser General Public
20##  License along with this library; if not, write to the Free Software
21##  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
23##
24##  pth-config.in: Pth library build utility
25##
26
27DIFS='
28'
29
30prefix="@prefix@"
31exec_prefix="@exec_prefix@"
32
33pth_prefix="$prefix"
34pth_exec_prefix="$exec_prefix"
35pth_bindir="@bindir@"
36pth_libdir="@libdir@"
37pth_includedir="@includedir@"
38pth_mandir="@mandir@"
39pth_datadir="@datadir@"
40pth_acdir="@datadir@/aclocal"
41pth_cflags="@CFLAGS@"
42pth_ldflags="@LDFLAGS@"
43pth_libs="@LIBS@"
44pth_version="@PTH_VERSION_STR@"
45
46help=no
47version=no
48
49usage="pth-config"
50usage="$usage [--help] [--version] [--all]"
51usage="$usage [--prefix] [--exec-prefix] [--bindir] [--libdir] [--includedir] [--mandir] [--datadir] [--acdir]"
52usage="$usage [--cflags] [--ldflags] [--libs]"
53if [ $# -eq 0 ]; then
54    echo "pth-config:Error: Invalid option" 1>&2
55    echo "pth-config:Usage: $usage" 1>&2
56    exit 1
57fi
58output=''
59output_extra=''
60all=no
61prev=''
62OIFS="$IFS" IFS="$DIFS"
63for option
64do
65    if [ ".$prev" != . ]; then
66        eval "$prev=\$option"
67        prev=''
68        continue
69    fi
70    case "$option" in
71        -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
72           *) optarg='' ;;
73    esac
74    case "$option" in
75        --help|-h)
76            echo "Usage: $usage"
77            echo "Report bugs to bug-pth@gnu.org"
78            exit 0
79            ;;
80        --version|-v)
81            echo "pthsem $pth_version"
82            exit 0
83            ;;
84        --all)
85            all=yes
86            ;;
87        --prefix)
88            output="$output $pth_prefix"
89            ;;
90        --exec-prefix)
91            output="$output $pth_exec_prefix"
92            ;;
93        --bindir)
94            output="$output $pth_bindir"
95            ;;
96        --libdir)
97            output="$output $pth_libdir"
98            ;;
99        --includedir)
100            output="$output $pth_includedir"
101            ;;
102        --mandir)
103            output="$output $pth_mandir"
104            ;;
105        --datadir)
106            output="$output $pth_datadir"
107            ;;
108        --acdir)
109            output="$output $pth_acdir"
110            ;;
111        --cflags)
112            output="$output -I$pth_includedir"
113            output_extra="$output_extra $pth_cflags"
114            ;;
115        --ldflags)
116            output="$output -L$pth_libdir"
117            output_extra="$output_extra $pth_ldflags"
118            ;;
119        --libs)
120            output="$output -lpthsem"
121            output_extra="$output_extra $pth_libs"
122            ;;
123        * )
124            echo "pth-config:Error: Invalid option" 1>&2
125            echo "pth-config:Usage: $usage" 1>&2
126            exit 1;
127            ;;
128    esac
129done
130IFS="$OIFS"
131if [ ".$prev" != . ]; then
132    echo "pth-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
133    exit 1
134fi
135if [ ".$output" != . ]; then
136    if [ ".$all" = .yes ]; then
137        output="$output $output_extra"
138    fi
139    echo $output
140fi
141
142