diff --git a/ChangeLog b/ChangeLog
index f3edce67cbfc1cf915260127760d639699f578a5..db25c8f4afcac0d524361bf6a1538f2b95bc3735 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-08-31  Niels Möller  <nisse@lysator.liu.se>
+
+	* configure.ac: New command line option --disable-pic. Use
+	LSH_CCPIC. 
+
+	* Makefile.am (libnettle_a_CFLAGS): Added $(CCPIC), to attempt to
+	build also the static library as position independent code.
+
 2004-08-24  Niels Möller  <nisse@lysator.liu.se>
 
 	* des-compat.c (des_cbc_cksum): Pad input with NUL:s, if it's not
diff --git a/Makefile.am b/Makefile.am
index 8ea73088a8c88748b164c7f1c32f3acb876bd356..6e1a57e563ef6c30b388b77a1af9ca03117066e4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -61,6 +61,8 @@ libnettle_a_SOURCES = aes.c aes.h aes-internal.h \
 		      nettle-meta.h \
 		      nettle-internal.c nettle-internal.h
 
+libnettle_a_CFLAGS = $(CCPIC)
+
 LIBOBJS = @LIBOBJS@
 libnettle_a_LIBADD = $(LIBOBJS)
 
diff --git a/configure.ac b/configure.ac
index a7a73178b9b009f7e3924e0b13d028ff3ae54065..f9bdc4ac27beba943b9a81dd997ca35070a3a572 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,11 @@ AC_ARG_ENABLE(shared,
   AC_HELP_STRING([--enable-shared], [Build a shared library]),,
   [enable_shared=no])
 
+AC_ARG_ENABLE(pic,
+  AC_HELP_STRING([--disable-pic],
+  [Do not try to compile library files as position independent code]),,
+  [enable_pic=yes])
+
 LSH_RPATH_INIT([`echo $with_lib_path | sed 's/:/ /g'` \
     `echo $exec_prefix | sed "s@^NONE@$prefix/lib@g" | sed "s@^NONE@$ac_default_prefix/lib@g"` \
     /usr/local/lib /sw/local/lib /sw/lib \
@@ -111,14 +116,14 @@ if test "x$enable_assembler" = xyes ; then
   fi
 fi
 
-SHLIBCFLAGS="-fpic"
+LSH_CCPIC
+
+SHLIBCFLAGS="$CCPIC"
 SHLIBFORLINK=libnettle.so
 SHLIBSONAME='$(SHLIBFORLINK).$(SHLIBMAJOR)'
 SHLIBFILE='$(SHLIBSONAME).$(SHLIBMINOR)'
 SHLIBLINK='$(CC) $(LDFLAGS) -shared -Wl,-soname=$(SHLIBSONAME)'
 
-echo "enable_shared: $enable_shared"
-     
 if test "x$enable_shared" = xyes ; then
   SHLIBTARGET='$(SHLIBFORLINK)'
   SHLIBINSTALL=install-shared
@@ -127,6 +132,10 @@ else
   SHLIBINSTALL=''
 fi
 
+if test "x$enable_pic" = xyes; then : ; else
+  CCPIC=''
+fi
+
 AM_CONDITIONAL([ENABLE_ASSEMBLER], [test x$enable_assembler = xyes])
 AM_CONDITIONAL([ENABLE_SHARED],  [test x$enable_shared = xyes])