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: xslt-config [OPTION]...
13
14Known 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
23EOF
24
25    exit $1
26}
27
28if test $# -eq 0; then
29    usage 1
30fi
31
32cflags=false
33libs=false
34
35while 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
90done
91
92the_libs="@XSLT_LIBDIR@ @XSLT_LIBS@"
93if test "$includedir" != "/usr/include"; then
94    the_flags="$the_flags -I$includedir `@XML_CONFIG@ --cflags`"
95else
96    the_flags="$the_flags `@XML_CONFIG@ --cflags`"
97fi
98
99if $cflags; then
100    all_flags="$the_flags"
101fi
102
103if $libs; then
104    all_flags="$all_flags $services $the_libs"
105fi
106
107if test -z "$all_flags" || test "x$all_flags" = "x "; then
108    exit 1
109fi
110
111# Straight out any possible duplicates, but be careful to
112# get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
113other_flags=
114rev_libs=
115for 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
125done
126
127ord_libs=
128for 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
133done
134
135echo $other_flags $ord_libs
136
137exit 0
138