1#!/bin/sh 2 3af_libs= 4af_cflags= 5prefix=@prefix@ 6exec_prefix=@exec_prefix@ 7 8 9## 10## Define usage() 11## 12usage() 13{ 14 cat <<EOF 15Usage: autotrace-config [OPTIONS] [LIBRARIES] 16Options: 17 --cflags print pre-processor and compiler flags 18 --libs print library linking information 19 --libs-dirs only print the -L/-R part of --libs 20 --libs-names only print the -l part of --libs 21 --help display this help and exit 22 --prefix[=DIR] 23 --exec_prefix[=DIR] 24 --version output autotrace version information 25Libraries: 26 autotrace 27EOF 28 exit $1 29} 30 31## 32## Process options 33## 34parse() 35{ 36# we must be called with at least one argument 37if test $# -eq 0; then 38 usage 1 1>&2 39fi 40 41# at least one option should be selected 42case "$1" in 43 --*) 44 ;; 45 *) 46 usage 1 1>&2 47 ;; 48esac 49 50# grab all -- arguments 51while test $# -gt 0; do 52 case "$1" in 53 -*=*) af_optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 54 *) af_optarg= ;; 55 esac 56 57 case $1 in 58 --help) 59 usage 0 0>&2 60 ;; 61 --cflags) 62 af_echo_cflags=yes 63 ;; 64 --libs) 65 af_echo_libs_L=yes 66 af_echo_libs_l=yes 67 ;; 68 --libs-dirs) 69 af_echo_libs_L=yes 70 ;; 71 --libs-names) 72 af_echo_libs_l=yes 73 ;; 74 --prefix=*) 75 prefix=$af_optarg 76 af_prefix_set=yes 77 ;; 78 --prefix) 79 af_echo_prefix=yes 80 ;; 81 --exec_prefix=*) 82 exec_prefix=$af_optarg 83 af_exec_prefix_set=yes 84 ;; 85 --exec_prefix) 86 af_echo_exec_prefix=yes 87 ;; 88 --version) 89 af_echo_version=yes 90 ;; 91 --*) 92 usage 1 1>&2 93 ;; 94 *) 95 break 96 ;; 97 esac 98 shift 99done 100 101# if we have a default library use it 102if test $# -eq 0; then 103if test "X$af_lib_default" != "X"; then 104 af_lib__AF_LIB_DEFAULT=yes 105 return 106fi 107fi 108 109while test $# -gt 0; do 110 case $1 in 111 autotrace) 112 af_lib_autotrace=yes 113 ;; 114 *) 115 usage 1 1>&2 116 ;; 117 esac 118 shift 119done 120} 121 122print_result() 123{ 124if test "X$af_echo_cflags" = "Xyes"; then 125 af_all_flags="$af_cflags" 126fi 127 128if test "X$af_echo_libs_L" = "Xyes" || test "X$af_echo_libs_l" = "Xyes"; then 129 af_all_flags="$af_all_flags $af_libs" 130fi 131 132if test -z "$af_all_flags" || test "X$af_all_flags" = "X "; then 133 exit 1 134fi 135 136# Straight out any possible duplicates, but be careful to 137# get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz' 138af_other_flags= 139af_lib_L_flags= 140af_rev_libs= 141for i in $af_all_flags; do 142 case "$i" in 143 # a library, save it for later, in reverse order 144 -l*) af_rev_libs="$i $af_rev_libs" ;; 145 -L*|-R*) 146 if test "X$af_echo_libs_L" = "Xyes"; then 147 case " $af_lib_L_flags " in 148 *\ $i\ *) ;; # already there 149 *) af_lib_L_flags="$af_lib_L_flags $i" ;; # add it to output 150 esac 151 fi;; 152 *) 153 case " $af_other_flags " in 154 *\ $i\ *) ;; # already there 155 *) af_other_flags="$af_other_flags $i" ;; # add it to output 156 esac ;; 157 esac 158done 159 160af_ord_libs= 161if test "X$af_echo_libs_l" = "Xyes"; then 162 for i in $af_rev_libs; do 163 case " $af_ord_libs " in 164 *\ $i\ *) ;; # already there 165 *) af_ord_libs="$i $af_ord_libs" ;; # add it to output in reverse order 166 esac 167 done 168fi 169 170echo $af_other_flags $af_lib_L_flags $af_ord_libs 171} 172 173## 174## Main Body 175## 176 177parse $* 178 179 180## 181## Initialize names 182## 183 184 185## 186## Available options 187## 188if test "X$af_echo_prefix" = "Xyes"; then 189 echo $prefix 190fi 191 192if test "X$af_echo_exec_prefix" = "Xyes"; then 193 echo $exec_prefix 194fi 195 196if test "X$af_echo_version" = "Xyes"; then 197 echo @VERSION@ 198 exit 0 199fi 200 201 202## 203## Libraries 204## 205#dummy because this should always be selected 206 207af_cflags="$af_cflags -I@includedir@" 208af_libs="-L@libdir@ -lautotrace @LIBPNG_LDFLAGS@ @MAGICK_LDFLAGS@ @LIBSWF_LDFLAGS@ @LIBPSTOEDIT_LIBS@ $af_libs" 209 210 211 212print_result 213 214exit 0 215 216