  prefix		= @prefix@
  exec_prefix	= @exec_prefix@
  DESTDIR		= 
-@@ -41,7 +42,7 @@
+@@ -34,14 +35,14 @@
+ FC =		@FC@
+ LDFLAGS =	$(CFLAGS)
+ DEFS =		@DEFS@
+-LIBS =		@LIBS@
++LIBS =		@LIBS@ -lnosys
+ FLEX =		flex
+ BISON =		bison
+ 
  SHLIB_LD =	@SHLIB_LD@
  SHLIB_SUFFIX =	@SHLIB_SUFFIX@
  

--- cfitsio/Makefile.in	2009-07-14 13:40:37.000000000 -0700
+++ cfitsio.new/Makefile.in	2011-01-13 11:36:17.241181415 -0800
@@ -18,6 +18,7 @@
 # testprog targets. See also changes and comments in configure.in
 #

 		$(CC) -c $(CFLAGS) $(DEFS) $<
 
 
@@ -99,7 +100,7 @@
 		if [ -f libcfitsio${SHLIB_SUFFIX} ]; then \
 			/bin/mv libcfitsio${SHLIB_SUFFIX} ${CFITSIO_LIB}; \
 		fi; \
-		/bin/cp fitsio.h fitsio2.h longnam.h drvrsmem.h ${CFITSIO_INCLUDE}/; \
+		/bin/cp $(srcdir)/fitsio.h $(srcdir)/fitsio2.h $(srcdir)/longnam.h $(srcdir)/drvrsmem.h ${CFITSIO_INCLUDE}/; \
 		/bin/cp cfitsio.pc ${CFITSIO_LIB}/pkgconfig
 
 smem:		smem.o libcfitsio.a ${OBJECTS}
diff -u cfitsio/configure cfitsio.new/configure
--- cfitsio/configure	2011-01-10 09:07:41.000000000 -0800
+++ cfitsio.new/configure	2011-02-08 15:45:46.156363000 -0800
@@ -3771,7 +3771,7 @@
   darwin)
     SHLIB_LD="$CC -dynamiclib"
     SHLIB_SUFFIX=".dylib"
-    lhea_shlib_cflags="-fPIC -fno-common"
+    lhea_shlib_cflags="-fno-common"
     ;;
   hpu)
     SHLIB_LD="ld -b"
@@ -3800,7 +3800,6 @@
 # if test "x$GCC" = xyes; then
 if test "x$GCC" = xyes && test "x$EXT" != xdarwin && test "x$EXT" != xcygwin; then
   SHLIB_LD="$CC -shared"
-  lhea_shlib_cflags='-fPIC'
 fi
 if test "x$lhea_shlib_cflags" != x; then
   CFLAGS="$CFLAGS $lhea_shlib_cflags"
