Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
| 3 | # libpng-config |
| 4 | # provides configuration info for libpng. |
| 5 | |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 6 | # Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson |
Glenn Randers-Pehrson | 3e61d79 | 2009-06-24 09:31:28 -0500 | [diff] [blame] | 7 | |
Glenn Randers-Pehrson | bfbf865 | 2009-06-26 21:46:52 -0500 | [diff] [blame] | 8 | # This code is released under the libpng license. |
Glenn Randers-Pehrson | c332bbc | 2009-06-25 13:43:50 -0500 | [diff] [blame] | 9 | # For conditions of distribution and use, see the disclaimer |
Glenn Randers-Pehrson | 037023b | 2009-06-24 10:27:36 -0500 | [diff] [blame] | 10 | # and license in png.h |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 11 | |
| 12 | # Modeled after libxml-config. |
| 13 | |
| 14 | version="@PNGLIB_VERSION@" |
| 15 | prefix="@prefix@" |
| 16 | exec_prefix="@exec_prefix@" |
| 17 | libdir="@libdir@" |
Glenn Randers-Pehrson | a7dbcba | 2007-05-15 16:16:34 -0500 | [diff] [blame] | 18 | includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" |
| 19 | libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" |
Glenn Randers-Pehrson | eb58091 | 2008-07-30 14:47:09 -0500 | [diff] [blame] | 20 | all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 21 | I_opts="-I${includedir}" |
| 22 | L_opts="-L${libdir}" |
Glenn Randers-Pehrson | e647462 | 2006-03-04 16:50:47 -0600 | [diff] [blame] | 23 | R_opts="" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 24 | cppflags="" |
Glenn Randers-Pehrson | bb0f557 | 2009-11-15 05:49:13 -0600 | [diff] [blame] | 25 | ccopts="" |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 26 | ldopts="" |
| 27 | |
| 28 | usage() |
| 29 | { |
| 30 | cat <<EOF |
| 31 | Usage: $0 [OPTION] ... |
| 32 | |
| 33 | Known values for OPTION are: |
| 34 | |
| 35 | --prefix print libpng prefix |
| 36 | --libdir print path to directory containing library |
| 37 | --libs print library linking information |
| 38 | --ccopts print compiler options |
| 39 | --cppflags print pre-processor flags |
| 40 | --cflags print preprocessor flags, I_opts, and compiler options |
| 41 | --I_opts print "-I" include options |
| 42 | --L_opts print linker "-L" flags for dynamic linking |
| 43 | --R_opts print dynamic linker "-R" or "-rpath" flags |
| 44 | --ldopts print linker options |
| 45 | --ldflags print linker flags (ldopts, L_opts, R_opts, and libs) |
| 46 | --static revise subsequent outputs for static linking |
| 47 | --help print this help and exit |
| 48 | --version print version information |
| 49 | EOF |
| 50 | |
| 51 | exit $1 |
| 52 | } |
| 53 | |
| 54 | if test $# -eq 0; then |
| 55 | usage 1 |
| 56 | fi |
| 57 | |
| 58 | while test $# -gt 0; do |
| 59 | case "$1" in |
| 60 | |
| 61 | --prefix) |
| 62 | echo ${prefix} |
| 63 | ;; |
| 64 | |
| 65 | --version) |
| 66 | echo ${version} |
| 67 | exit 0 |
| 68 | ;; |
| 69 | |
| 70 | --help) |
| 71 | usage 0 |
| 72 | ;; |
| 73 | |
| 74 | --ccopts) |
| 75 | echo ${ccopts} |
| 76 | ;; |
| 77 | |
| 78 | --cppflags) |
| 79 | echo ${cppflags} |
| 80 | ;; |
| 81 | |
| 82 | --cflags) |
| 83 | echo ${I_opts} ${cppflags} ${ccopts} |
| 84 | ;; |
| 85 | |
| 86 | --libdir) |
| 87 | echo ${libdir} |
| 88 | ;; |
| 89 | |
| 90 | --libs) |
| 91 | echo ${libs} |
| 92 | ;; |
| 93 | |
| 94 | --I_opts) |
| 95 | echo ${I_opts} |
| 96 | ;; |
| 97 | |
| 98 | --L_opts) |
| 99 | echo ${L_opts} |
| 100 | ;; |
| 101 | |
| 102 | --R_opts) |
| 103 | echo ${R_opts} |
| 104 | ;; |
| 105 | |
| 106 | --ldopts) |
Glenn Randers-Pehrson | a313751 | 2010-08-18 20:25:36 -0500 | [diff] [blame] | 107 | echo ${ldopts} |
| 108 | ;; |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 109 | |
| 110 | --ldflags) |
| 111 | echo ${ldopts} ${L_opts} ${R_opts} ${libs} |
| 112 | ;; |
| 113 | |
| 114 | --static) |
| 115 | R_opts="" |
Glenn Randers-Pehrson | a313751 | 2010-08-18 20:25:36 -0500 | [diff] [blame] | 116 | libs=${all_libs} |
Glenn Randers-Pehrson | c3d51c1 | 2006-03-02 07:23:18 -0600 | [diff] [blame] | 117 | ;; |
| 118 | |
| 119 | *) |
| 120 | usage |
| 121 | exit 1 |
| 122 | ;; |
| 123 | esac |
| 124 | shift |
| 125 | done |
| 126 | |
| 127 | exit 0 |