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