make --static default if configured with --disable-shared
[wxWidgets.git] / wx-config.in
1 #!/bin/sh
2
3 prefix=@prefix@
4 exec_prefix=@exec_prefix@
5 exec_prefix_set=no
6 CC="@CC@"
7 CXX="@CXX@"
8 LD="@SHARED_LD@"
9 cross_compiling=@cross_compiling@
10 target=@host_alias@
11 static_flag=@STATIC_FLAG@
12
13 usage()
14 {
15     cat <<EOF
16 Usage: wx-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--static]
17                  [--libs] [--gl-libs]
18                  [--cppflags] [--cflags] [--cxxflags] [--ldflags] [--rezflags]
19                  [--cc] [--cxx] [--ld]
20
21 wx-config returns configuration information about the installed
22 version of wxWindows. It may be used to query its version and
23 installation directories and also retrieve the C and C++ compilers
24 and linker which were used for its building and the corresponding
25 flags.
26 EOF
27
28     exit $1
29 }
30
31 cppflags()
32 {
33     if test "@includedir@" != "/usr/include" \
34             -a "@includedir@" != "/usr/include/c++" \
35             -a "@includedir@" != "/usr/local/include" \
36             -a \( "${cross_compiling}" != "yes" \
37                   -o "@includedir@" != "/usr/${target}/include" \) ;
38     then
39         includes=-I@includedir@
40     fi
41
42     includes="-I@libdir@/wx/include/@TOOLCHAIN_NAME@ $includes"
43
44     if test $static_flag = yes ; then
45         echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @WXCONFIG_INCLUDE@
46     else
47         echo $includes @WXDEBUG_DEFINE@ @TOOLCHAIN_DEFS@ @TOOLCHAIN_DLL_DEFS@ @WXCONFIG_INCLUDE@
48     fi
49 }
50
51 if test $# -eq 0; then
52     usage 1 1>&2
53 fi
54
55 while test $# -gt 0; do
56   case "$1" in
57   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
58   *) optarg= ;;
59   esac
60
61   case $1 in
62     --prefix=*)
63       prefix=$optarg
64       if test $exec_prefix_set = no ; then
65         exec_prefix=$optarg
66       fi
67       ;;
68     --prefix)
69       echo $prefix
70       ;;
71     --exec-prefix=*)
72       exec_prefix=$optarg
73       exec_prefix_set=yes
74       ;;
75     --exec-prefix)
76       echo $exec_prefix
77       ;;
78     --version)
79       echo @WX_MAJOR_VERSION_NUMBER@.@WX_MINOR_VERSION_NUMBER@.@WX_RELEASE_NUMBER@
80       ;;
81     --static)
82       static_flag=yes
83       ;;
84     --cppflags)
85       cppflags
86       ;;
87     --cflags)
88       echo `cppflags` @CODE_GEN_FLAGS@
89       ;;
90     --cxxflags)
91       echo `cppflags` @CODE_GEN_FLAGS@ @CODE_GEN_FLAGS_CXX@
92       ;;
93     --ldflags)
94       echo @LDFLAGS_EXE@
95       ;;
96     --rezflags)
97       echo @LIBWXMACRESWXCONFIG@
98       ;;
99     --libs)
100       if test "@libdir@" != "/usr/lib" \
101               -a \( "${cross_compiling}" != "yes" \
102                     -o "@libdir@" != "/usr/${target}/lib" \) ;
103       then
104           libs="-L@libdir@"
105       fi
106
107       if test $static_flag = yes ; then
108           echo "$libs @LDFLAGS@ @WXCONFIG_RPATH@ @libdir@/@WXCONFIG_LIBS_STATIC@ @LIBS@ @DMALLOC_LIBS@"
109       else
110           echo $libs @LDFLAGS@ @WXCONFIG_RPATH@ @WXCONFIG_LIBS@ @DMALLOC_LIBS@
111       fi
112
113       ;;
114     --gl-libs)
115       if test $static_flag = yes -a "x" != "x@WXCONFIG_LIBS_STATIC_GL@" ; then
116           gllibs="@libdir@/@WXCONFIG_LIBS_STATIC_GL@"
117       else
118           gllibs="@WXCONFIG_LIBS_GL@"
119       fi
120       echo @LDFLAGS_GL@ "$gllibs"
121       ;;
122     --cc)
123       echo $CC
124       ;;
125     --cxx)
126       echo $CXX
127       ;;
128     --ld)
129       echo $LD
130       ;;
131     *)
132       usage 1 1>&2
133       ;;
134   esac
135   shift
136 done
137