diff --git a/configure.ac b/configure.ac
index 765eff2..8da54b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,7 +5,7 @@ dnl
dnl This file is part of gtatool, a tool to manipulate Generic Tagged Arrays
dnl (GTAs).
dnl
-dnl Copyright (C) 2010, 2011, 2012, 2013, 2014
+dnl Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015
dnl Martin Lambers <marlam@marlam.de>
dnl
dnl This program is free software; you can redistribute it and/or modify
@@ -487,6 +487,12 @@ if test "$pfs" = "yes"; then
AC_MSG_WARN([$libpfs_PKG_ERRORS])
AC_MSG_WARN([Disabled the from-pfs and to-pfs commands.])])
fi
+if test "$pfs" = "yes"; then
+ CPPFLAGS_bak="$CPPFLAGS"
+ CPPFLAGS="$libpfs_CFLAGS $CPPFLAGS"
+ AC_CHECK_HEADERS([pfs/pfs.h])
+ CPPFLAGS="$CPPFLAGS_bak"
+fi
AC_DEFINE_UNQUOTED([WITH_PFS], [`if test "$pfs" = "yes"; then echo "1"; else echo "0"; fi`], [Use pfs?])
AM_CONDITIONAL([WITH_PFS], [test "$pfs" = "yes"])
diff --git a/src/conv-pfs/from-pfs.cpp b/src/conv-pfs/from-pfs.cpp
index 2d47e58..e002f25 100644
--- a/src/conv-pfs/from-pfs.cpp
+++ b/src/conv-pfs/from-pfs.cpp
@@ -2,7 +2,7 @@
* This file is part of gtatool, a tool to manipulate Generic Tagged Arrays
* (GTAs).
*
- * Copyright (C) 2010, 2011, 2012, 2013
+ * Copyright (C) 2010, 2011, 2012, 2013, 2015
* Martin Lambers <marlam@marlam.de>
*
* This program is free software; you can redistribute it and/or modify
@@ -23,8 +23,6 @@
#include <string>
-#include <pfs-1.2/pfs.h>
-
#include <gta/gta.hpp>
#include "base/msg.h"
@@ -35,6 +33,12 @@
#include "lib.h"
+#ifdef HAVE_PFS_PFS_H
+# include <pfs/pfs.h>
+#else
+# include <pfs-1.2/pfs.h>
+#endif
+
extern "C" void gtatool_from_pfs_help(void)
{
diff --git a/src/conv-pfs/to-pfs.cpp b/src/conv-pfs/to-pfs.cpp
index f6d5c1a..4a74720 100644
--- a/src/conv-pfs/to-pfs.cpp
+++ b/src/conv-pfs/to-pfs.cpp
@@ -2,7 +2,7 @@
* This file is part of gtatool, a tool to manipulate Generic Tagged Arrays
* (GTAs).
*
- * Copyright (C) 2010, 2011, 2012, 2013, 2014
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015
* Martin Lambers <marlam@marlam.de>
*
* This program is free software; you can redistribute it and/or modify
@@ -24,8 +24,6 @@
#include <string>
#include <limits>
-#include <pfs-1.2/pfs.h>
-
#include <gta/gta.hpp>
#include "base/msg.h"
@@ -37,6 +35,12 @@
#include "lib.h"
+#ifdef HAVE_PFS_PFS_H
+# include <pfs/pfs.h>
+#else
+# include <pfs-1.2/pfs.h>
+#endif
+
extern "C" void gtatool_to_pfs_help(void)
{