Remove mono-abi-info from the .spec file
[mono-project/dkf.git] / scripts / mono-test-install
blob362eed4cf5625515f76f4e9c59884b3eb9a4c15f
1 #!/bin/bash
3 # Does various checks for people that we can use to diagnose
4 # an end user installation
6 temp_cs=temp$$.cs
7 temp_exe=temp$$.exe
8 if test -f $temp_cs; then
9 echo Error: need a temporary file name, and $temp_cs already exists
10 echo Run this program from a different directory, or delete the file and try again.
11 exit 1
14 set `echo $PATH | sed 's/:/ /g'`
16 while test x$1 != x; do
17 if test -x $1/mono; then
18 if test x$monocmd = x; then
19 monocmd=$1/mono
20 else
21 other_monos="$1/mono $other_monos"
24 shift
25 done
27 echo Active Mono: $monocmd
29 if test "x$other_monos" != x; then
30 echo "Other Mono executables: $other_monos"
35 # Check that the pkg-config mono points to this mono
37 if pkg-config --modversion mono >& /dev/null; then
38 pkg_config_mono=`(cd \`pkg-config --variable prefix mono\`/bin; pwd)`/mono
39 if test $pkg_config_mono != $monocmd; then
40 echo "Error: pkg-config Mono installation points to a different install"
41 echo " than the Mono found:"
42 echo " Mono on PATH: $monocmd"
43 echo " Mono from pkg-config: $pkg_config_mono"
44 exit 1
46 else
47 echo "Warning: pkg-config could not find mono installed on this system"
50 ##########################################################################################
52 # Tests below this point require the dotnet install
57 # Check that -pkg:dotnet is available
59 if pkg-config --modversion dotnet >& /dev/null; then
60 echo ""
61 else
62 echo "No dotnet pkgconfig found, Windows.Forms, System.Drawing and others will not work"
63 exit 1
66 case `uname` in
67 Darwin)
68 macos=true
69 libgdiplus=libgdiplus.dylib
70 LD_PATH=DYLD_LIBRARY_PATH
72 *)
73 macos=false;
74 libgdiplus=libgdiplus.so
75 LD_PATH=LD_LIBRARY_PATH
77 esac
79 search_libgdiplus_on_path()
81 libgdiplus_found=false
82 if $macos; then
83 set `echo $DYLD_LIBRARY_PATH | sed 's/:/ /g'`
84 else
85 set `echo $LD_LIBRARY_PATH | sed 's/:/ /g'`
87 while test x$1 != x; do
88 if test -e $1/$libgdiplus; then
89 echo " The $libgdiplus is found on $libdir/$libgdiplus"
90 libgdiplus_found=true
91 libgdiplus_path=$1/$libgdiplus
92 break
94 shift
95 done
99 # Check GDI+ installation
101 cat > $temp_cs <<EOF
102 using System;
103 using System.Drawing;
105 class X {
106 static void Main ()
108 Bitmap b = new Bitmap (100, 100);
112 if mcs -pkg:dotnet $temp_cs >& /dev/null; then
113 if mono $temp_exe >& /dev/null; then
114 echo Your have a working System.Drawing setup
115 else
116 echo Your system has a broken System.Drawing setup
117 if mono $temp_exe 2>&1 | grep 'System.DllNotFoundException: gdiplus.dll' > /dev/null; then
118 echo " your gdiplus.dll can not be loaded"
120 libdir=`dirname $monocmd`/../lib
121 if test -f $libdir/$libgdiplus; then
122 echo " The $libgdiplus is found on $libdir/$libgdiplus"
123 if test -e $libdir/$libgdiplus; then
124 libgdiplus_path=$libdir/$libgdiplus
125 libgdiplus_found=true
126 else
127 echo " but it seems to be a broken link"
129 else
130 search_libgdiplus_on_path
132 if $libgdiplus_found; then
133 echo ssss
134 if which ldd >/dev/null; then
135 LANG=C dirs=`ldd $libgdiplus_path | grep 'not found'`
136 if echo $dirs | grep 'not found' >& /dev/null; then
137 echo " libgdiplus is missing the following dependencies to run:"
138 echo $dirs | sed 's/^/ /'
141 else
142 echo " No libgdiplus was found on your $LD_PATH"
146 else
147 echo Failed to compile sample System.Drawing program, your installation is broken
148 exit 1
151 cat > $temp_cs <<EOF
152 using System;
153 using System.Reflection;
154 using System.IO;
156 class Program {
158 public static void Main()
160 object watcher = new FileSystemWatcher()
161 .GetType ()
162 .GetField ("watcher", BindingFlags.NonPublic | BindingFlags.Static)
163 .GetValue (null);
165 Console.WriteLine ("Your file system watcher is: {0}",
166 watcher != null
167 ? watcher.GetType ().FullName
168 : "unknown");
173 if mcs $temp_cs >& /dev/null; then
174 mono $temp_exe
175 else
176 echo Failed to compile sample test program, your installation is broken
177 exit 1