add configure test for xdg-programs to install mime types; can be disabled for buildi...
authorArun Persaud <arun@nubati.net>
Tue, 14 Feb 2012 06:29:48 +0000 (22:29 -0800)
committerArun Persaud <arun@nubati.net>
Tue, 14 Feb 2012 07:00:10 +0000 (23:00 -0800)
in case the target system doesn't have the xdg-programs available, we test for them.
Distributions often have their own macros to install these, so we add an enable option to configure

Makefile.am
configure.ac

index 88df0b9..3f0e37d 100644 (file)
@@ -174,7 +174,7 @@ xboard.man: xboard.texi copyright.texi gpl.texinfo version.texi
 install-data-hook: install-mime-database
 uninstall-hook: uninstall-mime-database
 install-mime-database:
 install-data-hook: install-mime-database
 uninstall-hook: uninstall-mime-database
 install-mime-database:
-       @-if test -z "$(DESTDIR)"; then \
+       -if test -z "$(DESTDIR)" -a -n "$(XDG_MIME)" -a -n "$(XDG_DESKTOP_MENU)" -a -n "$(XDG_ICON_RESOURCE)" ; then \
                xdg-mime install --mode system --novendor xboard.xml ;\
                xdg-desktop-menu install --mode system --novendor xboard-pgn-viewer.desktop;\
                xdg-desktop-menu install --mode system --novendor xboard-fen-viewer.desktop;\
                xdg-mime install --mode system --novendor xboard.xml ;\
                xdg-desktop-menu install --mode system --novendor xboard-pgn-viewer.desktop;\
                xdg-desktop-menu install --mode system --novendor xboard-fen-viewer.desktop;\
@@ -185,7 +185,7 @@ install-mime-database:
                xdg-icon-resource install --context mimetypes --size 48 pixmaps/cross48.xpm application-x-xboard-trn;\
        fi
 uninstall-mime-database:
                xdg-icon-resource install --context mimetypes --size 48 pixmaps/cross48.xpm application-x-xboard-trn;\
        fi
 uninstall-mime-database:
-       @-if test -z "$(DESTDIR)"; then \
+       -if test -z "$(DESTDIR)" -a -n "$(XDG_MIME)" -a -n "$(XDG_DESKTOP_MENU)" -a -n "$(XDG_ICON_RESOURCE)" ; then \
                xdg-mime uninstall --mode system --novendor xboard.xml;\
                xdg-desktop-menu uninstall --mode system --novendor xboard-pgn-viewer.desktop;\
                xdg-desktop-menu uninstall --mode system --novendor xboard-fen-viewer.desktop;\
                xdg-mime uninstall --mode system --novendor xboard.xml;\
                xdg-desktop-menu uninstall --mode system --novendor xboard-pgn-viewer.desktop;\
                xdg-desktop-menu uninstall --mode system --novendor xboard-fen-viewer.desktop;\
index 52c7946..37bae05 100644 (file)
@@ -416,6 +416,14 @@ X_LIBS="$X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS -lXmu -lX11 -lXt "
 AC_SUBST(X_CFLAGS)
 AC_SUBST(X_LIBS)
 
 AC_SUBST(X_CFLAGS)
 AC_SUBST(X_LIBS)
 
+dnl | can we install desktop icons and mime associations?
+AC_PATH_PROG([XDG_MIME],[xdg-mime])
+AC_SUBST(XDG_MIME)
+AC_PATH_PROG([XDG_DESKTOP_MENU],[xdg-desktop-menu])
+AC_SUBST(XDG_DESKTOP_MENU)
+AC_PATH_PROG([XDG_ICON_RESOURCE],[xdg-icon-resource])
+AC_SUBST(XDG_ICON_RESOURCE)
+
 
 AC_CONFIG_FILES([Makefile cmail po/Makefile.in])
 AC_CONFIG_COMMANDS([test-stamp-h],[test -z "$CONFIG_HEADERS" || date > stamp-h])
 
 AC_CONFIG_FILES([Makefile cmail po/Makefile.in])
 AC_CONFIG_COMMANDS([test-stamp-h],[test -z "$CONFIG_HEADERS" || date > stamp-h])