diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 92303c3df32cf12cddedae2c24b1644e026d650a..a23c8c47b30a78a77ec2cb6d50814b3613f7b947 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -46,7 +46,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <thread.h>
 #endif
 
+#if defined(HAVE_DAHDI)
 #include <dahdi/user.h>
+#endif
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"