configure.ac: don't allow installation in source or build directory
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 10 Aug 2012 07:36:30 +0000 (09:36 +0200)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 10 Aug 2012 07:40:36 +0000 (09:40 +0200)
This will fail at some point during the installation anyway,
so it's better to check early.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
configure.ac

index f84ee54..10aa00c 100644 (file)
@@ -6,6 +6,18 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 AC_SUBST(versioninfo)
 versioninfo=10:0:0
 
+if test "x$prefix" != "xNONE"; then
+       prefix_wd=`cd $prefix && pwd`
+       srcdir_wd=`cd $srcdir && pwd`
+       wd=`pwd`
+       if test "x$prefix_wd" = "x$srcdir_wd"; then
+               AC_MSG_ERROR(Installation in source directory not supported)
+       fi
+       if test "x$prefix_wd" = "x$wd"; then
+               AC_MSG_ERROR(Installation in build directory not supported)
+       fi
+fi
+
 AC_PROG_CC
 AC_PROG_CXX