Improve libgdiplus path handling
authorAndrea Canciani <ranma42@gmail.com>
Tue, 27 May 2014 10:45:14 +0000 (12:45 +0200)
committerAndrea Canciani <ranma42@gmail.com>
Tue, 1 Jul 2014 12:25:21 +0000 (14:25 +0200)
Since libgdiplus is not installed together with Mono, it should not be
assumed to be in the same prefix.

The new policy for the --with-libgdiplus configure option is the
following:

 - --with-libgdiplus=/absolute/path/to/libgdiplus.{so,dylib}

   both during build/check and after installation Mono will try to use
   the specified libgdiplus library; the rationale is that when an
   absolute path is given, it can be assumed to be the full path to
   the library that is already installed (possibly in a non-default
   path).

 - default, --with-libgdiplus=no, --with-libgdiplus=installed

   both during build/check and after installation Mono will try to use
   a system-wide libgdiplus library, that is assumed to reside in the
   paths that are automatically searched by the dynamic linker; the
   library is supposed to be already installed in the default path and
   to be useable both during the build and afterwards.

 - --with-libgdiplus=sibling, --with-libgdiplus=yes

   during build/check Mono will try to use the libgdiplus library that
   is assumed to be in the sibling folder (../libgdiplus), but after
   the installation it will try to use a system-wide libgdiplus
   library, that should be in the paths that are automatically
   searched by the dynamic linker; the assumption is that the library
   is not yet installed, but it will go to the default prefix after
   installing it.

 - --with-libgdiplus=../some/relative/path/to/libgdiplus.{so,dylib,la}

   during build/check Mono will try to use the specified libgdiplus
   library, but after the installation it will try to use a
   system-wide libgdiplus library, that should be in the paths that
   are automatically searched by the dynamic linker; the assumption is
   that the library is not yet installed, but it will go to the
   default prefix after installing it.

configure.ac
data/config.in
runtime/Makefile.am

index c2d36bc8822f4863d4d04f14a004f633a23a76d1..16b9301d511766121b5235bac0536b974b354c95 100644 (file)
@@ -649,18 +649,6 @@ if test "x$USE_NLS" = "xyes"; then
    fi
 fi
 
-AC_ARG_WITH([libgdiplus], 
-       [  --with-libgdiplus=installed|sibling|<path>   Override the libgdiplus used for System.Drawing tests (defaults to installed)], 
-       [], [with_libgdiplus=installed])
-
-case $with_libgdiplus in
-no|installed) libgdiplus_loc= ;;
-yes|sibling) libgdiplus_loc=`cd ../libgdiplus && pwd`/src/libgdiplus.la ;;
-/*) libgdiplus_loc=$with_libgdiplus ;;
-*) libgdiplus_loc=`pwd`/$with_libgdiplus ;;
-esac
-AC_SUBST([libgdiplus_loc])
-
 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
 
 pkg_config_path=
@@ -3006,6 +2994,33 @@ esac
 
 AC_SUBST(libsuffix)
 
+AC_ARG_WITH([libgdiplus],
+       [  --with-libgdiplus=installed|sibling|<path>   Override the libgdiplus used for System.Drawing tests (defaults to installed)],
+       [], [with_libgdiplus=installed])
+
+# default install location
+libgdiplus_install_loc=libgdiplus${libsuffix}
+case $with_libgdiplus in
+    no|installed)
+    libgdiplus_loc=
+    ;;
+
+    yes|sibling)
+    libgdiplus_loc=`cd ../libgdiplus && pwd`/src/libgdiplus.la
+    ;;
+
+    /*) # absolute path, assume it is an install location
+    libgdiplus_loc=$with_libgdiplus
+    libgdiplus_install_loc=$with_libgdiplus
+    ;;
+
+    *)
+    libgdiplus_loc=`pwd`/$with_libgdiplus
+    ;;
+esac
+AC_SUBST([libgdiplus_loc])
+AC_SUBST([libgdiplus_install_loc])
+
 AC_ARG_ENABLE(icall-symbol-map,[  --enable-icall-symbol-map Generate tables which map icall functions to their C symbols], icall_symbol_map=$enableval, icall_symbol_map=no)
 if test "x$icall_symbol_map" = "xyes"; then
    AC_DEFINE(ENABLE_ICALL_SYMBOL_MAP, 1, [Icall symbol map enabled])
index fc764c7a02943f75a25fe94dad4950eabd58ae79..51cac3f0b4323d9ff0d2818010964d122a59fa88 100644 (file)
@@ -29,8 +29,8 @@
                <dllentry dll="__Internal" name="MoveMemory" target="mono_win32_compat_MoveMemory"/>
                <dllentry dll="__Internal" name="ZeroMemory" target="mono_win32_compat_ZeroMemory"/>
        </dllmap>
-       <dllmap dll="gdiplus" target="@prefix@/lib/libgdiplus@libsuffix@" os="!windows"/>
-       <dllmap dll="gdiplus.dll" target="@prefix@/lib/libgdiplus@libsuffix@"  os="!windows"/>
-       <dllmap dll="gdi32" target="@prefix@/lib/libgdiplus@libsuffix@" os="!windows"/>
-       <dllmap dll="gdi32.dll" target="@prefix@/lib/libgdiplus@libsuffix@" os="!windows"/>
+       <dllmap dll="gdiplus" target="@libgdiplus_install_loc@" os="!windows"/>
+       <dllmap dll="gdiplus.dll" target="@libgdiplus_install_loc@"  os="!windows"/>
+       <dllmap dll="gdi32" target="@libgdiplus_install_loc@" os="!windows"/>
+       <dllmap dll="gdi32.dll" target="@libgdiplus_install_loc@" os="!windows"/>
 </configuration>
index 7c9b6006673d0c11190037859c7cf967e41e1a78..2d9c2886dbccf2adea07be5586c47375c626238a 100644 (file)
@@ -170,7 +170,7 @@ etc/mono/config: ../data/config Makefile $(symlinks)
        d=`cd ../support && pwd`; \
        sed 's,target="$(prefix)/lib/libMonoPosixHelper$(libsuffix)",target="'$$d'/libMonoPosixHelper.la",' ../data/config > $@t
        if test -z "$(libgdiplus_loc)"; then :; else \
-         sed 's,target="[^"]*libgdiplus[^"]*",target="$(libgdiplus_loc)",' $@t > $@tt; \
+         sed 's,target="$(libgdiplus_install_loc)",target="$(libgdiplus_loc)",' $@t > $@tt; \
          mv -f $@tt $@t; fi
        mv -f $@t $@