summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/Makefile.am3
-rwxr-xr-xconfigure.ac28
-rw-r--r--guile/Makefile.am3
-rw-r--r--isisd/Makefile.am4
-rw-r--r--ospf6d/Makefile.am3
-rw-r--r--ospfclient/Makefile.am2
-rw-r--r--ripd/Makefile.am3
-rw-r--r--ripngd/Makefile.am3
-rw-r--r--tests/Makefile.am3
-rw-r--r--vtysh/Makefile.am3
-rw-r--r--watchquagga/Makefile.am3
-rw-r--r--zebra/Makefile.am3
12 files changed, 60 insertions, 1 deletions
diff --git a/bgpd/Makefile.am b/bgpd/Makefile.am
index 80e93284..1b17d386 100644
--- a/bgpd/Makefile.am
+++ b/bgpd/Makefile.am
@@ -4,6 +4,9 @@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
noinst_LIBRARIES = libbgp.a
sbin_PROGRAMS = bgpd
diff --git a/configure.ac b/configure.ac
index 746b5cea..5c6c0d7d 100755
--- a/configure.ac
+++ b/configure.ac
@@ -60,9 +60,10 @@ fi
dnl --------------------
dnl Check CC and friends
dnl --------------------
+AC_LANG([C])
AC_PROG_CC
AC_PROG_CPP
-
+AM_PROG_CC_C_O
AC_PROG_EGREP
dnl autoconf 2.59 appears not to support AC_PROG_SED
@@ -1395,6 +1396,31 @@ dnl ----------
CONFDATE=`date '+%Y%m%d'`
AC_SUBST(CONFDATE)
+dnl Conditionally enable PIE support for GNU toolchains.
+enable_pie=yes
+
+AC_ARG_ENABLE(pie, AS_HELP_STRING([--disable-pie], [Do not build tools as a Position Independent Executables]))
+if test "$enable_pie" = "yes"; then
+ AC_CACHE_CHECK([whether $CC accepts PIE flags], [ap_cv_cc_pie], [
+ save_CFLAGS=$CFLAGS
+ save_LDFLAGS=$LDFLAGS
+ CFLAGS="$CFLAGS -fPIE"
+ LDFLAGS="$LDFLAGS -pie"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[static int foo[30000]; int main () { return 0; }]])],
+ [ap_cv_cc_pie=yes], [ap_cv_cc_pie=no]
+ )
+ CFLAGS=$save_CFLAGS
+ LDFLAGS=$save_LDFLAGS
+ ])
+ if test "$ap_cv_cc_pie" = "yes"; then
+ PICFLAGS="-fPIE"
+ PILDFLAGS="-pie"
+ fi
+fi
+
+AC_SUBST(PICFLAGS)
+AC_SUBST(PILDFLAGS)
+
dnl ------------------------------
dnl set paths for state directory
dnl ------------------------------
diff --git a/guile/Makefile.am b/guile/Makefile.am
index ecdb8f32..5beb71c4 100644
--- a/guile/Makefile.am
+++ b/guile/Makefile.am
@@ -3,6 +3,9 @@
INCLUDES = @GUILE_CFLAGS@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib
DEFS = @DEFS@ -I. -I$(srcdir)
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
bin_PROGRAMS = zebra-guile
zebra_guile_SOURCES = zebra-guile.c zebra-support.c guile-bgp.c
noinst_HEADERS = zebra-guile.h
diff --git a/isisd/Makefile.am b/isisd/Makefile.am
index 859facd6..9c303390 100644
--- a/isisd/Makefile.am
+++ b/isisd/Makefile.am
@@ -5,6 +5,10 @@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib \
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
LIBS = @LIBS@
+
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
noinst_LIBRARIES = libisis.a
sbin_PROGRAMS = isisd
SUBDIRS = topology
diff --git a/ospf6d/Makefile.am b/ospf6d/Makefile.am
index ad828713..01bc6fe0 100644
--- a/ospf6d/Makefile.am
+++ b/ospf6d/Makefile.am
@@ -4,6 +4,9 @@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
noinst_LIBRARIES = libospf6.a
sbin_PROGRAMS = ospf6d
diff --git a/ospfclient/Makefile.am b/ospfclient/Makefile.am
index ab2a3786..b8aae84b 100644
--- a/ospfclient/Makefile.am
+++ b/ospfclient/Makefile.am
@@ -21,4 +21,6 @@ ospfclient_SOURCES = \
ospfclient_LDADD = libospfapiclient.la \
../ospfd/libospf.la ../lib/libzebra.la @LIBCAP@
+ospfclient_CFLAGS = $(AM_CFLAGS) $(PICFLAGS)
+ospfclient_LDFLAGS = $(AM_LDFLAGS) $(PILDFLAGS)
diff --git a/ripd/Makefile.am b/ripd/Makefile.am
index c36b58c6..2fa26659 100644
--- a/ripd/Makefile.am
+++ b/ripd/Makefile.am
@@ -4,6 +4,9 @@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
noinst_LIBRARIES = librip.a
sbin_PROGRAMS = ripd
diff --git a/ripngd/Makefile.am b/ripngd/Makefile.am
index ad1e2788..c6bd4868 100644
--- a/ripngd/Makefile.am
+++ b/ripngd/Makefile.am
@@ -4,6 +4,9 @@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
INSTALL_SDATA=@INSTALL@ -m 600
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
noinst_LIBRARIES = libripng.a
sbin_PROGRAMS = ripngd
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d00485f1..c93fa08c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,9 @@
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib
DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\"
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
noinst_PROGRAMS = testsig testbuffer testmemory heavy heavywq heavythread \
aspathtest testprivs teststream testbgpcap ecommtest \
testbgpmpattr
diff --git a/vtysh/Makefile.am b/vtysh/Makefile.am
index dbd1d3d2..4886a642 100644
--- a/vtysh/Makefile.am
+++ b/vtysh/Makefile.am
@@ -5,6 +5,9 @@ DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
LIBS = @LIBS@ @CURSES@ @LIBPAM@
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
bin_PROGRAMS = vtysh
vtysh_SOURCES = vtysh_main.c vtysh.c vtysh_user.c vtysh_config.c
diff --git a/watchquagga/Makefile.am b/watchquagga/Makefile.am
index e422535a..a49f62e8 100644
--- a/watchquagga/Makefile.am
+++ b/watchquagga/Makefile.am
@@ -3,6 +3,9 @@
INCLUDES = @INCLUDES@ -I$(top_srcdir) -I$(top_srcdir)/lib
DEFS = @DEFS@ -DSTATEDIR=\"$(localstatedir)/\"
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
sbin_PROGRAMS = watchquagga
watchquagga_SOURCES = watchquagga.c
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 5d8db411..542f36f4 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -19,6 +19,9 @@ ioctl_method = @IOCTL_METHOD@
otherobj = $(ioctl_method) $(ipforward) $(if_method) $(if_proc) \
$(rt_method) $(rtread_method) $(kernel_method) $(other_method)
+AM_CFLAGS = $(PICFLAGS)
+AM_LDFLAGS = $(PILDFLAGS)
+
sbin_PROGRAMS = zebra
noinst_PROGRAMS = testzebra