aboutsummaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2007-06-28 05:50:08 +0000
committerRamiro Polla <ramiro.polla@gmail.com>2007-06-28 05:50:08 +0000
commit4c4b268c43f61ec03f07eb883b739135df3f6eb4 (patch)
tree9b3433d5e6fb2c62fb25dc8e83d8982f29bfa968 /configure
downloaddlfcn-win32-4c4b268c43f61ec03f07eb883b739135df3f6eb4.tar.gz
dlfcn-win32-4c4b268c43f61ec03f07eb883b739135df3f6eb4.tar.bz2
dlfcn-win32-4c4b268c43f61ec03f07eb883b739135df3f6eb4.zip
Initial Revision
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure151
1 files changed, 151 insertions, 0 deletions
diff --git a/configure b/configure
new file mode 100755
index 0000000..f5d8c64
--- /dev/null
+++ b/configure
@@ -0,0 +1,151 @@
1#!/bin/sh
2# dlfcn-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 " --enable-shared build shared libraries [no]"
39 echo " --enable-static build static libraries [yes]"
40 echo " --enable-msvc create msvc-compatible import lib [auto]"
41 echo " --enable-strip strip shared library [yes]"
42 echo
43 echo " --cc=CC use C compiler CC [$cc]"
44 echo " --make=MAKE use specified make [$make]"
45 exit 1
46}
47
48die_unknown(){
49 echo "Unknown option \"$1\"."
50 echo "See $0 --help for available options."
51 exit 1
52}
53
54PREFIX="/mingw"
55cc="gcc"
56
57DEFAULT="msvc
58"
59
60DEFAULT_NO="shared
61"
62
63DEFAULT_YES="static
64 strip
65"
66
67CMDLINE_SELECT="$DEFAULT
68 $DEFAULT_NO
69 $DEFAULT_YES
70"
71
72enable $DEFAULT_YES
73disable $DEFAULT_NO
74
75for opt do
76 optval="${opt#*=}"
77 case "$opt" in
78 --help)
79 show_help
80 ;;
81 --prefix=*)
82 PREFIX="$optval"
83 ;;
84 --cc=*)
85 cc="$optval"
86 ;;
87 --make=*)
88 make="$optval"
89 ;;
90 --enable-?*|--disable-?*)
91 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
92 echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt
93 $action $option
94 ;;
95 *)
96 die_unknown $opt
97 ;;
98 esac
99done
100
101disabled shared && disabled static && {
102 echo "At least one library type must be set.";
103 exit 1;
104}
105
106# simple cc test
107cat > /tmp/test.c << EOF
108int function(void)
109{ return 0; }
110EOF
111$cc -shared -o /tmp/test.dll /tmp/test.c
112
113test "$?" = !0 && {
114 echo "$cc could not create shared file.";
115 echo "Make sure your system is working properly.";
116 exit 1;
117}
118
119if enabled msvc; then
120 disabled shared && {
121 echo "MSVC understands static libraries created by gcc."
122 echo "There's no need to create an import lib."
123 exit 1
124 }
125 lib /? >& /dev/null || {
126 echo "MSVC's lib command not found."
127 echo "Make sure MSVC is installed and its bin folder is in your \$PATH."
128 exit 1
129 }
130fi
131
132if enabled shared; then
133 lib /? >& /dev/null && enable msvc || disable msvc
134fi
135
136echo "# Automatically generated by configure" > config.mak
137echo "PREFIX=$PREFIX" >> config.mak
138echo "CC=$cc" >> config.mak
139echo "BUILD_SHARED=$shared" >> config.mak
140echo "BUILD_STATIC=$static" >> config.mak
141echo "BUILD_MSVC=$msvc" >> config.mak
142echo "DO_STRIP=$strip" >> config.mak
143
144echo "prefix: $PREFIX"
145echo "cc: $cc"
146echo "static: $static"
147echo "shared: $shared"
148enabled shared && {
149 echo "msvc: $msvc";
150 echo "strip: $strip";
151}