diff --git a/Makefile.am b/Makefile.am
index fa764c1e189bb27f8648223d0d9df8adb0a6debc..83a0e6c4d8faca403f8b54fcaff4fe49366bc0a4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@ SUBDIRS = src include doc debian
 
 m4datadir = $(datadir)/aclocal
 m4data_DATA = ao.m4
-
+mandir = @MANDIR@
 man_MANS = libao.conf.5
 
 EXTRA_DIST = README AUTHORS CHANGES COPYING libao.spec ao.m4 acinclude.m4 $(man_MANS)
diff --git a/configure.in b/configure.in
index 9f02cf8e941611861f972466936d04118b47d751..cad50e7b764c3fa25215998ccf0caee40213011a 100644
--- a/configure.in
+++ b/configure.in
@@ -85,6 +85,17 @@ dnl ==============================
 dnl Checks for header files
 dnl ==============================
 
+dnl --------------------------------------------------
+dnl Work around FHS stupidity
+dnl --------------------------------------------------
+
+if test "$prefix" = "/usr"; then
+    MANDIR='$(datadir)/man'
+else
+    MANDIR='$(prefix)/man'
+fi
+AC_SUBST(MANDIR)
+
 dnl ==============================
 dnl Checks for types
 dnl ==============================