From 7e5f267ee9baf3f25bf9b5d8af949f12f1ffbde9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 8 Oct 1998 04:52:11 +0000 Subject: auto-detect the right flag for the compiler to produce PIC code (This used to be commit 5d92e003978f02e53c0886508ccefc8c24ec1bbf) --- source3/configure.in | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'source3/configure.in') diff --git a/source3/configure.in b/source3/configure.in index 998479cadb..9c92272e9e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -24,7 +24,6 @@ SAMBA_MAINTAINER_MODE # how to compile C code to produce PIC object files # these are the defaults, good for lots of systems -PICFLAG="-fpic" HOST_OS="$host_os" LDSHFLAGS="-shared" @@ -32,13 +31,13 @@ LDSHFLAGS="-shared" case "$host_os" in *linux*) AC_DEFINE(LINUX);; *solaris*) AC_DEFINE(SUNOS5) - LDSHFLAGS="-G";; + LDSHFLAGS="-G" + ;; *sunos*) AC_DEFINE(SUNOS4) LDSHFLAGS="" ;; *irix*) AC_DEFINE(IRIX) WRAP32=smbwrapper/smbwrapper.32.so - PICFLAG="-KPIC" ;; *aix*) AC_DEFINE(AIX);; *hpux*) AC_DEFINE(HPUX);; @@ -48,6 +47,27 @@ case "$host_os" in *next2*) AC_DEFINE(NEXT2);; esac + +# try to work out how to produce pic code with this compiler +PICFLAG="" +AC_PROG_CC_FLAG(fpic) +if test $ac_cv_prog_cc_fpic = yes; then + PICFLAG="-fpic"; +fi +if test x$PICFLAG = x; then + AC_PROG_CC_FLAG(Kpic) + if test $ac_cv_prog_cc_Kpic = yes; then + PICFLAG="-Kpic"; + fi +fi +if test x$PICFLAG = x; then + AC_PROG_CC_FLAG(KPIC) + if test $ac_cv_prog_cc_KPIC = yes; then + PICFLAG="-KPIC"; + fi +fi + + AC_INLINE AC_HEADER_STDC AC_HEADER_DIRENT -- cgit