1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-05 20:58:40 +03:00

auto-detect the right flag for the compiler to produce PIC code

(This used to be commit 5d92e003978f02e53c0886508ccefc8c24ec1bbf)
This commit is contained in:
Andrew Tridgell 1998-10-08 04:52:11 +00:00
parent 4750ce1760
commit 7e5f267ee9
3 changed files with 466 additions and 368 deletions

13
source3/aclocal.m4 vendored
View File

@ -48,3 +48,16 @@ if test $ac_cv_dirent_d_off = yes; then
AC_DEFINE(HAVE_DIRENT_D_OFF)
fi
])
dnl AC_PROG_CC_FLAG(flag)
AC_DEFUN(AC_PROG_CC_FLAG,
[AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
[echo 'void f(){}' > conftest.c
if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
ac_cv_prog_cc_$1=yes
else
ac_cv_prog_cc_$1=no
fi
rm -f conftest*
])])

795
source3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -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