source: trunk/third/oaf/oaf-config.in @ 18119

Revision 18119, 2.2 KB checked in by ghudson, 22 years ago (diff)
Merge with oaf 0.6.10.
Line 
1#! /bin/sh
2
3prefix=@prefix@
4exec_prefix=@exec_prefix@
5exec_prefix_set=no
6includedir=@includedir@
7libdir=@libdir@
8
9usage()
10{
11    cat <<EOF
12Usage: oaf-config [OPTION]...
13
14Known values for OPTION are:
15
16  --prefix=DIR          change OAF prefix [default $prefix]
17  --exec-prefix=DIR     change OAF executable prefix [default $exec_prefix]
18  --libs                print library linking information
19  --cflags              print pre-processor and compiler flags
20  --help                display this help and exit
21  --version             output version information
22EOF
23
24    exit $1
25}
26
27if test $# -eq 0; then
28    usage 1
29fi
30
31cflags=false
32libs=false
33
34while test $# -gt 0; do
35    case "$1" in
36    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
37    *) optarg= ;;
38    esac
39
40    case "$1" in
41    --prefix=*)
42        prefix=$optarg
43        if test $exec_prefix_set = no ; then
44            exec_prefix=$optarg
45        fi
46        ;;
47
48    --prefix)
49        echo $prefix
50        ;;
51
52    --exec-prefix=*)
53        exec_prefix=$optarg
54        exec_prefix_set=yes
55        ;;
56
57    --exec-prefix)
58        echo $exec_prefix
59        ;;
60
61    --version)
62        echo @VERSION@
63        exit 0
64        ;;
65
66    --help)
67        usage 0
68        ;;
69
70    --cflags)
71        cflags=true
72        ;;
73
74    --libs)
75        libs=true
76        ;;
77
78    *)
79        usage
80        exit 1
81        ;;
82    esac
83    shift
84done
85
86the_libs="$the_libs -L$libdir -loaf `@ORBIT_CONFIG@ --use-service=name --libs server` @INTLLIBS@"
87
88if test $includedir != /usr/include ; then
89  the_flags="$the_flags -I$includedir `@ORBIT_CONFIG@ --cflags server`"
90else
91  the_flags="$the_flags `@ORBIT_CONFIG@ --cflags server`"
92fi
93
94if $cflags; then
95    all_flags="$the_flags"
96fi
97
98if $libs; then
99    all_flags="$all_flags $services $the_libs"
100fi
101
102if test -z "$all_flags" || test "x$all_flags" = "x "; then
103    exit 1
104fi
105
106# Straight out any possible duplicates, but be careful to
107# get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
108other_flags=
109rev_libs=
110for i in $all_flags; do
111    case "$i" in
112    # a library, save it for later, in reverse order
113    -l*) rev_libs="$i $rev_libs" ;;
114    *)
115        case " $other_flags " in
116        *\ $i\ *) ;;                            # already there
117        *) other_flags="$other_flags $i" ;;     # add it to output
118        esac ;;
119    esac
120done
121
122ord_libs=
123for i in $rev_libs; do
124    case " $ord_libs " in
125    *\ $i\ *) ;;                        # already there
126    *) ord_libs="$i $ord_libs" ;;       # add it to output in reverse order
127    esac
128done
129
130echo $other_flags $ord_libs
131
132exit 0
Note: See TracBrowser for help on using the repository browser.