From 6797ac43b92f15e85031240c107ec89f00fdb392 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Tue, 31 Aug 2004 00:21:26 +0200
Subject: [PATCH] * 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.

Rev: src/nettle/ChangeLog:1.274
Rev: src/nettle/Makefile.am:1.78
Rev: src/nettle/configure.ac:1.41
---
 ChangeLog    |  8 ++++++++
 Makefile.am  |  2 ++
 configure.ac | 15 ++++++++++++---
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f3edce67..db25c8f4 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 8ea73088..6e1a57e5 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 a7a73178..f9bdc4ac 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])
 
-- 
GitLab