don't print some old PCSX version
[pcsx_rearmed.git] / deps / mman / configure
CommitLineData
81c4586f
PC
1#!/bin/sh
2# mmap-win32 configure script
3#
4# Parts copied from FFmpeg's configure
5#
6
7set_all(){
8 value=$1
9 shift
10 for var in $*; do
11 eval $var=$value
12 done
13}
14
15enable(){
16 set_all yes $*
17}
18
19disable(){
20 set_all no $*
21}
22
23enabled(){
24 eval test "x\$$1" = "xyes"
25}
26
27disabled(){
28 eval test "x\$$1" = "xno"
29}
30
31show_help(){
32 echo "Usage: configure [options]"
33 echo "Options: [defaults in brackets after descriptions]"
34 echo "All \"enable\" options have \"disable\" counterparts"
35 echo
36 echo " --help print this message"
37 echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
38 echo " --bindir=DIR install binaries in DIR [$PREFIX/bin]"
39 echo " --libdir=DIR install libs in DIR [$PREFIX/lib]"
40 echo " --incdir=DIR install includes in DIR [$PREFIX/include]"
41 echo " --enable-static build static libraries [yes]"
42 echo " --enable-shared build shared libraries [no]"
43 echo " --enable-msvc create msvc-compatible import lib [auto]"
44 echo
45 echo " --cc=CC use C compiler CC [$cc_default]"
46 echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
47 exit 1
48}
49
50die_unknown(){
51 echo "Unknown option \"$1\"."
52 echo "See $0 --help for available options."
53 exit 1
54}
55
56PREFIX="/mingw"
57ar="ar"
58cc_default="gcc"
59ranlib="ranlib"
60strip="strip"
61
62DEFAULT="msvc
63"
64
65DEFAULT_YES="static
66 stripping
67"
68
69DEFAULT_NO="shared
70"
71
72CMDLINE_SELECT="$DEFAULT
73 $DEFAULT_NO
74 $DEFAULT_YES
75"
76
77enable $DEFAULT_YES
78disable $DEFAULT_NO
79
80for opt do
81 optval="${opt#*=}"
82 case "$opt" in
83 --help)
84 show_help
85 ;;
86 --prefix=*)
87 PREFIX="$optval"
88 ;;
89 --bindir=*)
90 bindir="$optval"
91 ;;
92 --libdir=*)
93 libdir="$optval"
94 ;;
95 --incdir=*)
96 incdir="$optval"
97 ;;
98 --cc=*)
99 cc="$optval"
100 ;;
101 --cross-prefix=*)
102 cross_prefix="$optval"
103 ;;
104 --enable-?*|--disable-?*)
105 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
106 echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
107 $action $option
108 ;;
109 *)
110 die_unknown $opt
111 ;;
112 esac
113done
114
115bindir="${PREFIX}/bin"
116libdir="${PREFIX}/lib"
117incdir="${PREFIX}/include/sys"
118ar="${cross_prefix}${ar}"
119cc_default="${cross_prefix}${cc_default}"
120ranlib="${cross_prefix}${ranlib}"
121strip="${cross_prefix}${strip}"
122
123if ! test -z $cc; then
124 cc_default="${cc}"
125fi
126cc="${cc_default}"
127
128disabled static && disabled shared && {
129 echo "At least one library type must be set.";
130 exit 1;
131}
132
133if enabled msvc; then
134 lib /? > /dev/null 2>&1 /dev/null || {
135 echo "MSVC's lib command not found."
136 echo "Make sure MSVC is installed and its bin folder is in your \$PATH."
137 exit 1
138 }
139fi
140
141if ! enabled stripping; then
142 strip="echo ignoring strip"
143fi
144
145enabled msvc && libcmd="lib" || libcmd="echo ignoring lib"
146
147echo "# Automatically generated by configure" > config.mak
148echo "PREFIX=$PREFIX" >> config.mak
149echo "bindir=$bindir" >> config.mak
150echo "libdir=$libdir" >> config.mak
151echo "incdir=$incdir" >> config.mak
152echo "AR=$ar" >> config.mak
153echo "CC=$cc" >> config.mak
154echo "RANLIB=$ranlib" >> config.mak
155echo "STRIP=$strip" >> config.mak
156echo "BUILD_STATIC=$static" >> config.mak
157echo "BUILD_SHARED=$shared" >> config.mak
158echo "BUILD_MSVC=$msvc" >> config.mak
159echo "LIBCMD=$libcmd" >> config.mak
160
161echo "prefix: $PREFIX"
162echo "bindir: $bindir"
163echo "libdir: $libdir"
164echo "incdir: $incdir"
165echo "ar: $ar"
166echo "cc: $cc"
167echo "ranlib: $ranlib"
168echo "strip: $strip"
169echo "static: $static"
170echo "shared: $shared"