diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 80755642df47aa359a356f4ce5da021151890d03..958bbbc2d22c9af5a0d1830c4f0291dcc60da8f4 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.285 2003/12/08 20:26:19 pjwilliams Exp $
+$Id: CHANGELOG,v 1.286 2003/12/09 19:57:55 ballen4705 Exp $
 
 The most recent version of this file is:
 http://cvs.sourceforge.net/viewcvs.py/smartmontools/sm5/CHANGELOG?sortby=date&view=markup
@@ -24,6 +24,9 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <ADDITIONS TO THE CHANGE LOG SHOULD BE ADDED JUST BELOW HERE, PLEASE>
 
+  [BA] linux: check for linux/hdreg.h.  If it's there, use it. If
+       not, provide the necessary definitions ourselves.
+
   [PW] Removed warning for IBM Deskstar 40GV & 75GXP series drives
        with TXAOA5AA firmware
 
diff --git a/sm5/configure.in b/sm5/configure.in
index 40951a4381384f4ea77787f981ff610303298e62..0ea64d48051efcec50e489b24e5adf8297012d62 100644
--- a/sm5/configure.in
+++ b/sm5/configure.in
@@ -1,5 +1,5 @@
 #
-# $Id: configure.in,v 1.40 2003/11/30 13:53:14 ballen4705 Exp $
+# $Id: configure.in,v 1.41 2003/12/09 19:57:55 ballen4705 Exp $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
@@ -7,7 +7,7 @@ AC_INIT(smartmontools, 5.27, smartmontools-support@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(smartctl.c)
 
 smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
-smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.40 2003/11/30 13:53:14 ballen4705 Exp $'`
+smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.41 2003/12/09 19:57:55 ballen4705 Exp $'`
 smartmontools_release_date=2003/11/30
 smartmontools_release_time="13:36:20 UTC"
 
@@ -32,7 +32,7 @@ dnl Checks for libraries.
 
 dnl Checks for header files.
 AC_CHECK_HEADER([getopt.h])
-dnl AC_CHECK_HEADER([linux/hdreg.h],, [AC_MSG_ERROR([Need linux/hdreg.h])])
+AC_CHECK_HEADERS([linux/hdreg.h])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 
diff --git a/sm5/os_linux.c b/sm5/os_linux.c
index 58f4817869edfcf66452ab0bab0c53577e6c8064..8f69bbbaa12e9aaeae705eae7f034b08674f72c9 100644
--- a/sm5/os_linux.c
+++ b/sm5/os_linux.c
@@ -52,7 +52,14 @@
 #include <dirent.h>
 #include <sys/stat.h>
 #include <glob.h>
+
+#ifdef HAVE_LINUX_HDREG_H
 #include <linux/hdreg.h>
+#else
+#define HDIO_DRIVE_TASK   0x031e
+#define HDIO_DRIVE_CMD    0x031f
+#define HDIO_GET_IDENTITY 0x030d
+#endif
 
 #include "atacmds.h"
 #include "config.h"
@@ -61,7 +68,7 @@
 #include "smartd.h"
 #include "utility.h"
 
-const char *os_XXXX_c_cvsid="$Id: os_linux.c,v 1.34 2003/12/08 20:36:03 ballen4705 Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_linux.c,v 1.35 2003/12/09 19:57:55 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
diff --git a/sm5/os_linux.cpp b/sm5/os_linux.cpp
index 8ebf437887f102ebc0d210e164175bac58b6a3dd..578c8b4aaa2572e885a4e4f1cf54e290f9071e4f 100644
--- a/sm5/os_linux.cpp
+++ b/sm5/os_linux.cpp
@@ -52,7 +52,14 @@
 #include <dirent.h>
 #include <sys/stat.h>
 #include <glob.h>
+
+#ifdef HAVE_LINUX_HDREG_H
 #include <linux/hdreg.h>
+#else
+#define HDIO_DRIVE_TASK   0x031e
+#define HDIO_DRIVE_CMD    0x031f
+#define HDIO_GET_IDENTITY 0x030d
+#endif
 
 #include "atacmds.h"
 #include "config.h"
@@ -61,7 +68,7 @@
 #include "smartd.h"
 #include "utility.h"
 
-const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.34 2003/12/08 20:36:03 ballen4705 Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.35 2003/12/09 19:57:55 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID SMARTD_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine