/[ghosts]/ghosts/gedcomparser/gedcomparser-config.in
ViewVC logotype

Diff of /ghosts/gedcomparser/gedcomparser-config.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by cpcp, Thu Sep 26 11:26:09 2002 UTC revision 1.2 by cpcp, Tue Nov 12 21:25:20 2002 UTC
# Line 0  Line 1 
1    #!/bin/sh
2    
3    # this is shamelessly stolen from gtkmm-config
4    
5    prefix=@prefix@
6    exec_prefix=@exec_prefix@
7    
8    libdir=@libdir@
9    
10    bindir=${exec_prefix}/bin
11    pkglibdir=${libdir}/@PACKAGE@
12    
13    transform=@program_transform_name@
14    
15    CFLAGS="-I${pkglibdir}/include"
16    test "x@includedir@" = "x/usr/include" || CFLAGS="${CFLAGS} -I@includedir@"
17    LIBDIRS="-L@libdir@"
18    
19    gedcomparser_libs="$LIBDIRS -lgedcomparser"
20    gedcomparser_cflags="$CFLAGS"
21    
22    
23    usage()
24    {
25        cat <<EOF
26    Usage: gedcomparser-config [OPTION]... [LIBRARY]...
27    
28    Generic options
29      --version     output gedcomparser version information
30      --help        display this help and exit
31    
32    Compilation support options
33      --cflags      print pre-processor and compiler flags
34      --libs        print library linking information
35      --libs-only-L only print the -L/-R part of --libs
36      --libs-only-l only print the -l part of --libs
37    
38    Known values for LIBRARY are:
39    
40        gedcomparser       (default)
41    
42    
43    EOF
44    
45        exit $1
46    }
47    
48    if test $# -eq 0; then
49        usage 1
50    fi
51    
52    cflags=false
53    libs_L=false
54    libs_l=false
55    
56    any=no
57    
58    while test $# -gt 0; do
59        case "$1" in
60        -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
61        *) optarg= ;;
62        esac
63    
64        case $1 in
65        --version)
66            echo @VERSION@
67            exit 0
68            ;;
69        --help)
70            usage 0
71            ;;
72        --prefix=*)
73            prefix=$optarg
74            ;;
75        --cflags)
76            cflags=true
77            ;;
78        --libs)
79            libs_L=true
80            libs_l=true
81            ;;
82        --libs-only-L)
83            libs_L=true
84            ;;
85        --libs-only-l)
86            libs_l=true
87            ;;
88        gedcomparser)
89            the_libs="$the_libs $gedcomparser_libs"
90            the_flags="$the_flags $gedcomparser_cflags"
91            any=yes
92            ;;
93        *)
94            usage 1
95            ;;
96        esac
97        shift
98    done
99    
100    # default to gedcomparser
101    if test "x$any" = xno; then
102       the_libs="$the_libs $gedcomparser_libs"
103       the_flags="$the_flags $gedcomparser_cflags"
104    fi
105    
106    if $cflags; then
107        all_flags="$the_flags"
108    fi
109    
110    if $libs_L || $libs_l; then
111        all_flags="$all_flags $the_libs"
112    fi
113    
114    if test -z "$all_flags" || test "x$all_flags" = "x "; then
115        exit 1
116    fi
117    
118    # Straight out any possible duplicates, but be careful to
119    # get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
120    other_flags=
121    lib_L_flags=
122    rev_libs=
123    for i in $all_flags; do
124        case "$i" in
125        # a library, save it for later, in reverse order
126        -l*) rev_libs="$i $rev_libs" ;;
127        -L*|-R*)
128            if $libs_L; then
129                case " $lib_L_flags " in
130                *\ $i\ *) ;;                        # already there
131                *) lib_L_flags="$lib_L_flags $i" ;; # add it to output
132                esac
133            fi;;
134        *)
135            case " $other_flags " in
136            *\ $i\ *) ;;                            # already there
137            *) other_flags="$other_flags $i" ;;     # add it to output
138            esac ;;
139        esac
140    done
141    
142    ord_libs=
143    if $libs_l; then
144        for i in $rev_libs; do
145            case " $ord_libs " in
146            *\ $i\ *) ;;                    # already there
147            *) ord_libs="$i $ord_libs" ;;   # add it to output in reverse order
148            esac
149        done
150    fi
151    
152    echo $other_flags $lib_L_flags $ord_libs
153    
154    exit 0

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26