diff options
-rw-r--r-- | common/Makefile.am | 2 | ||||
-rw-r--r-- | compat/Makefile.am | 2 | ||||
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | nss/Makefile.am | 2 | ||||
-rw-r--r-- | pam/Makefile.am | 2 |
5 files changed, 17 insertions, 6 deletions
diff --git a/common/Makefile.am b/common/Makefile.am index df90b8e..925f717 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -20,7 +20,7 @@ noinst_LIBRARIES = libtio.a libprot.a libdict.a libexpr.a AM_CPPFLAGS=-I$(top_srcdir) -AM_CFLAGS = -fPIC +AM_CFLAGS = $(PIC_CFLAGS) libtio_a_SOURCES = tio.c tio.h diff --git a/compat/Makefile.am b/compat/Makefile.am index bc8e4cc..0e7ad69 100644 --- a/compat/Makefile.am +++ b/compat/Makefile.am @@ -20,7 +20,7 @@ noinst_LIBRARIES = libcompat.a AM_CPPFLAGS=-I$(top_srcdir) -AM_CFLAGS = -fPIC +AM_CFLAGS = $(PIC_CFLAGS) EXTRA_DIST = getopt_long.c getopt_long.h \ ether.c ether.h \ diff --git a/configure.ac b/configure.ac index a0b85c2..92be7f7 100644 --- a/configure.ac +++ b/configure.ac @@ -106,9 +106,8 @@ AC_ARG_ENABLE(debug, [enable extensive debugging and logging]), [if test "x$enableval" != "xno" ; then CFLAGS="-g -DDEBUG $CFLAGS" ; fi]) -DESIRED_CFLAGS="" - # check for extra compiler warnings +DESIRED_CFLAGS="" AC_ARG_ENABLE(warnings, AS_HELP_STRING([--enable-warnings], [enable extra compiler warnings (gcc)]), @@ -136,6 +135,18 @@ do fi done +# check for Position Independent Code compiler option +PIC_CFLAGS="" +if test "$ac_cv_prog_gcc" = "yes" +then + PIC_CFLAGS="-fPIC" +else + case "$target_os" in + sysv5*) PIC_CFLAGS="-KPIC" ;; + esac +fi +AC_SUBST(PIC_CFLAGS) + # add --disable-maintainer-mode option AM_MAINTAINER_MODE([enable]) diff --git a/nss/Makefile.am b/nss/Makefile.am index 1a8f35a..5a2967f 100644 --- a/nss/Makefile.am +++ b/nss/Makefile.am @@ -23,7 +23,7 @@ noinst_PROGRAMS = nss_ldap.so AM_CPPFLAGS=-I$(top_srcdir) -AM_CFLAGS = -fPIC +AM_CFLAGS = $(PIC_CFLAGS) nss_ldap_so_SOURCES = common.c common.h prototypes.h solnss.h \ ../nslcd.h ../common/nslcd-prot.h \ diff --git a/pam/Makefile.am b/pam/Makefile.am index ce2fabf..f054e04 100644 --- a/pam/Makefile.am +++ b/pam/Makefile.am @@ -21,7 +21,7 @@ noinst_PROGRAMS = pam_ldap.so AM_CPPFLAGS=-I$(top_srcdir) -AM_CFLAGS = -fPIC +AM_CFLAGS = $(PIC_CFLAGS) pam_ldap_so_SOURCES = ../nslcd.h ../common/nslcd-prot.h \ ../compat/attrs.h pam.c common.h |