diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-04-29 12:39:19 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:05:15 -0500 |
commit | e572bbb94cb8a23d366647bcf584cc75029e8def (patch) | |
tree | 0e63adf94037542fc38f178e43f02bfdb0b35a4b /source4/build/m4 | |
parent | 657325d684b838ee7dd6379a4a6034c1fedabcae (diff) | |
download | samba-e572bbb94cb8a23d366647bcf584cc75029e8def.tar.gz samba-e572bbb94cb8a23d366647bcf584cc75029e8def.tar.bz2 samba-e572bbb94cb8a23d366647bcf584cc75029e8def.zip |
r15321: Reduce the size of rewrite.m4 a bit more
(This used to be commit c83e4b166534278c335254aa8890a50635bbf1b7)
Diffstat (limited to 'source4/build/m4')
-rw-r--r-- | source4/build/m4/check_ld.m4 | 196 | ||||
-rw-r--r-- | source4/build/m4/rewrite.m4 | 241 |
2 files changed, 197 insertions, 240 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4 index 3840459894..b98c2dab3c 100644 --- a/source4/build/m4/check_ld.m4 +++ b/source4/build/m4/check_ld.m4 @@ -1,6 +1,7 @@ dnl SMB Build Environment LD Checks dnl ------------------------------------------------------- dnl Copyright (C) Stefan (metze) Metzmacher 2004 +dnl Copyright (C) Jelmer Vernooij 2006 dnl Released under the GNU GPL dnl ------------------------------------------------------- dnl @@ -8,3 +9,198 @@ dnl Check if we use GNU ld AC_PATH_PROG(LD, ld) AC_PROG_LD_GNU AC_PATH_PROG(AR, ar) + +AC_SUBST(SHLIBEXT) +AC_SUBST(LDSHFLAGS) +AC_SUBST(SONAMEFLAG) +AC_SUBST(DYNEXP) +AC_SUBST(PICFLAG) + +AC_SUBST(BLDSHARED) +# Assume non-shared by default and override below +BLDSHARED="false" + +# these are the defaults, good for lots of systems +DYNEXP= +HOST_OS="$host_os" +LDSHFLAGS="-shared" +SONAMEFLAG="" +SHLD="\${CC}" +PICFLAG="" +PICSUFFIX="po" +SHLIBEXT="so" + +AC_MSG_CHECKING([ability to build shared libraries]) + +# and these are for particular systems +case "$host_os" in + *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux]) + BLDSHARED="true" + LDSHFLAGS="-shared" + DYNEXP="-Wl,--export-dynamic" + PICFLAG="-fPIC" + SONAMEFLAG="-Wl,-soname=" + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris]) + BLDSHARED="true" + LDSHFLAGS="-G" + if test "${GCC}" = "yes"; then + PICFLAG="-fPIC" + if test "${ac_cv_prog_gnu_ld}" = "yes"; then + DYNEXP="-Wl,-E" + fi + else + PICFLAG="-KPIC" + ## ${CFLAGS} added for building 64-bit shared + ## libs using Sun's Compiler + LDSHFLAGS="-G \${CFLAGS}" + PICSUFFIX="po.o" + fi + AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) + ;; + *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4]) + BLDSHARED="true" + LDSHFLAGS="-G" + PICFLAG="-KPIC" # Is this correct for SunOS + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *netbsd* | *freebsd*) BLDSHARED="true" + LDSHFLAGS="-shared" + DYNEXP="-Wl,--export-dynamic" + PICFLAG="-fPIC -DPIC" + AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) + ;; + *openbsd*) BLDSHARED="true" + LDSHFLAGS="-shared" + DYNEXP="-Wl,-Bdynamic" + PICFLAG="-fPIC" + AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) + ;; + *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix]) + ATTEMPT_WRAP32_BUILD=yes + BLDSHARED="true" + LDSHFLAGS="-set_version sgi1.0 -shared" + SONAMEFLAG="-soname " + SHLD="\${LD}" + if test "${GCC}" = "yes"; then + PICFLAG="-fPIC" + else + PICFLAG="-KPIC" + fi + AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) + ;; + *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix]) + BLDSHARED="true" + LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok" + DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc" + PICFLAG="-O2" + if test "${GCC}" != "yes"; then + ## for funky AIX compiler using strncpy() + CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" + fi + + AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block]) + ;; + *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX]) + SHLIBEXT="sl" + # Use special PIC flags for the native HP-UX compiler. + if test $ac_cv_prog_cc_Ae = yes; then + BLDSHARED="true" + SHLD="/usr/bin/ld" + LDSHFLAGS="-B symbolic -b -z" + SONAMEFLAG="+h " + PICFLAG="+z" + fi + DYNEXP="-Wl,-E" + AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block]) + ;; + *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx]) + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1]) + BLDSHARED="true" + LDSHFLAGS="-shared" + SONAMEFLAG="-Wl,-soname," + PICFLAG="-fPIC" + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix]) + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware]) + BLDSHARED="true" + LDSHFLAGS="-shared" + SONAMEFLAG="-Wl,-soname," + PICFLAG="-KPIC" + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2]) + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]) + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system]) + case "$host" in + *-univel-*) if [ test "$GCC" != yes ]; then + AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available]) + fi + LDSHFLAGS="-G" + DYNEXP="-Bexport" + ;; + *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);; + esac + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + + *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system]) + if [ test "$GCC" != yes ]; then + AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available]) + fi + LDSHFLAGS="-G" + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; + *-vms) + BLDSHARED="false" + LDSHFLAGS="" + ;; + *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096) + BLDSHARED="false" + LDSHFLAGS="" + ;; + *) + AC_DEFINE(STAT_ST_BLOCKSIZE,512) + ;; +esac +AC_MSG_RESULT($BLDSHARED) +AC_MSG_CHECKING([linker flags for shared libraries]) +AC_MSG_RESULT([$LDSHFLAGS]) +AC_MSG_CHECKING([compiler flags for position-independent code]) +AC_MSG_RESULT([$PICFLAGS]) + +####################################################### +# test whether building a shared library actually works +if test $BLDSHARED = true; then +AC_CACHE_CHECK([whether building shared libraries actually works], + [ac_cv_shlib_works],[ + ac_cv_shlib_works=no + # try building a trivial shared library + if test "$PICSUFFIX" = "po"; then + $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c && + $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po && + ac_cv_shlib_works=yes + else + $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c && + mv shlib.$PICSUFFIX shlib.po && + $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po && + ac_cv_shlib_works=yes + fi + rm -f shlib.so shlib.po +]) +if test $ac_cv_shlib_works = no; then + BLDSHARED=false +fi +fi + + diff --git a/source4/build/m4/rewrite.m4 b/source4/build/m4/rewrite.m4 index deac542e2b..cca933b8da 100644 --- a/source4/build/m4/rewrite.m4 +++ b/source4/build/m4/rewrite.m4 @@ -1,12 +1,6 @@ dnl Checks for programs. dnl Unique-to-Samba variables we'll be playing with. -AC_SUBST(SHLIBEXT) -AC_SUBST(LDSHFLAGS) -AC_SUBST(SONAMEFLAG) -AC_SUBST(DYNEXP) -AC_SUBST(PICFLAG) - AC_SYS_LARGEFILE # @@ -46,21 +40,7 @@ case "$host_os" in esac - -AC_HEADER_DIRENT -AC_HEADER_TIME -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(sys/select.h fcntl.h sys/fcntl.h sys/time.h stdarg.h) -AC_CHECK_HEADERS(utime.h grp.h sys/id.h limits.h compat.h math.h) -AC_CHECK_HEADERS(ctype.h sys/wait.h sys/resource.h sys/ioctl.h sys/ipc.h sys/mode.h) -AC_CHECK_HEADERS(sys/mman.h sys/filio.h sys/priv.h sys/shm.h string.h strings.h stdlib.h) -AC_CHECK_HEADERS(sys/fs/s5param.h sys/filsys.h termios.h termio.h) -AC_CHECK_HEADERS(fnmatch.h pwd.h sys/termio.h sys/time.h) -AC_CHECK_HEADERS(locale.h shadow.h) -AC_CHECK_HEADERS(nss.h nss_common.h ns_api.h sys/security.h) -AC_CHECK_HEADERS(sys/acl.h) - -AC_CHECK_HEADERS(sys/capability.h) +AC_CHECK_HEADERS(stdarg.h string.h ) AC_TYPE_SIGNAL @@ -76,20 +56,6 @@ AC_CHECK_TYPE(loff_t,off_t) AC_CHECK_TYPE(offset_t,loff_t) AC_CHECK_TYPES(long long) - -AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [ - AC_TRY_COMPILE([ -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -#include <signal.h>],[sig_atomic_t i = 0], - samba_cv_sig_atomic_t=yes,samba_cv_sig_atomic_t=no)]) -if test x"$samba_cv_sig_atomic_t" = x"yes"; then - AC_DEFINE(HAVE_SIG_ATOMIC_T_TYPE,1,[Whether we have the atomic_t variable type]) -fi - AC_FUNC_MEMCMP AC_CHECK_FUNCS(setsid pipe crypt16 getauthuid) @@ -97,193 +63,6 @@ AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction) AC_CHECK_FUNCS(setgroups sysconf getpwanam srandom random srand rand usleep) AC_CHECK_FUNCS(backtrace setbuffer) -AC_SUBST(BLDSHARED) -# Assume non-shared by default and override below -BLDSHARED="false" - -# these are the defaults, good for lots of systems -DYNEXP= -HOST_OS="$host_os" -LDSHFLAGS="-shared" -SONAMEFLAG="" -SHLD="\${CC}" -PICFLAG="" -PICSUFFIX="po" -SHLIBEXT="so" - -AC_MSG_CHECKING([ability to build shared libraries]) - -# and these are for particular systems -case "$host_os" in - *linux*) AC_DEFINE(LINUX,1,[Whether the host os is linux]) - BLDSHARED="true" - LDSHFLAGS="-shared" - DYNEXP="-Wl,--export-dynamic" - PICFLAG="-fPIC" - SONAMEFLAG="-Wl,-soname=" - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *solaris*) AC_DEFINE(SUNOS5,1,[Whether the host os is solaris]) - BLDSHARED="true" - LDSHFLAGS="-G" - if test "${GCC}" = "yes"; then - PICFLAG="-fPIC" - if test "${ac_cv_prog_gnu_ld}" = "yes"; then - DYNEXP="-Wl,-E" - fi - else - PICFLAG="-KPIC" - ## ${CFLAGS} added for building 64-bit shared - ## libs using Sun's Compiler - LDSHFLAGS="-G \${CFLAGS}" - PICSUFFIX="po.o" - fi - AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) - ;; - *sunos*) AC_DEFINE(SUNOS4,1,[Whether the host os is sunos4]) - BLDSHARED="true" - LDSHFLAGS="-G" - PICFLAG="-KPIC" # Is this correct for SunOS - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *netbsd* | *freebsd*) BLDSHARED="true" - LDSHFLAGS="-shared" - DYNEXP="-Wl,--export-dynamic" - PICFLAG="-fPIC -DPIC" - AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) - ;; - *openbsd*) BLDSHARED="true" - LDSHFLAGS="-shared" - DYNEXP="-Wl,-Bdynamic" - PICFLAG="-fPIC" - AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) - ;; - *irix*) AC_DEFINE(IRIX,1,[Whether the host os is irix]) - ATTEMPT_WRAP32_BUILD=yes - BLDSHARED="true" - LDSHFLAGS="-set_version sgi1.0 -shared" - SONAMEFLAG="-soname " - SHLD="\${LD}" - if test "${GCC}" = "yes"; then - PICFLAG="-fPIC" - else - PICFLAG="-KPIC" - fi - AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) - ;; - *aix*) AC_DEFINE(AIX,1,[Whether the host os is aix]) - BLDSHARED="true" - LDSHFLAGS="-Wl,-bexpall,-bM:SRE,-bnoentry,-berok" - DYNEXP="-Wl,-brtl,-bexpall,-bbigtoc" - PICFLAG="-O2" - if test "${GCC}" != "yes"; then - ## for funky AIX compiler using strncpy() - CFLAGS="$CFLAGS -D_LINUX_SOURCE_COMPAT -qmaxmem=32000" - fi - - AC_DEFINE(STAT_ST_BLOCKSIZE,DEV_BSIZE,[The size of a block]) - ;; - *hpux*) AC_DEFINE(HPUX,1,[Whether the host os is HPUX]) - SHLIBEXT="sl" - # Use special PIC flags for the native HP-UX compiler. - if test $ac_cv_prog_cc_Ae = yes; then - BLDSHARED="true" - SHLD="/usr/bin/ld" - LDSHFLAGS="-B symbolic -b -z" - SONAMEFLAG="+h " - PICFLAG="+z" - fi - DYNEXP="-Wl,-E" - AC_DEFINE(STAT_ST_BLOCKSIZE,8192,[The size of a block]) - ;; - *qnx*) AC_DEFINE(QNX,1,[Whether the host os is qnx]) - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *osf*) AC_DEFINE(OSF1,1,[Whether the host os is osf1]) - BLDSHARED="true" - LDSHFLAGS="-shared" - SONAMEFLAG="-Wl,-soname," - PICFLAG="-fPIC" - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *sco*) AC_DEFINE(SCO,1,[Whether the host os is sco unix]) - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *unixware*) AC_DEFINE(UNIXWARE,1,[Whether the host os is unixware]) - BLDSHARED="true" - LDSHFLAGS="-shared" - SONAMEFLAG="-Wl,-soname," - PICFLAG="-KPIC" - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *next2*) AC_DEFINE(NEXT2,1,[Whether the host os is NeXT v2]) - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *dgux*) AC_CHECK_PROG( ROFF, groff, [groff -etpsR -Tascii -man]) - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *sysv4*) AC_DEFINE(SYSV,1,[Whether this is a system V system]) - case "$host" in - *-univel-*) if [ test "$GCC" != yes ]; then - AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available]) - fi - LDSHFLAGS="-G" - DYNEXP="-Bexport" - ;; - *mips-sni-sysv4*) AC_DEFINE(RELIANTUNIX,1,[Whether the host os is reliantunix]);; - esac - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - - *sysv5*) AC_DEFINE(SYSV,1,[Whether this is a system V system]) - if [ test "$GCC" != yes ]; then - AC_DEFINE(HAVE_MEMSET,1,[Whether memset() is available]) - fi - LDSHFLAGS="-G" - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; - *-vms) - BLDSHARED="false" - LDSHFLAGS="" - ;; - *vos*) AC_DEFINE(STAT_ST_BLOCKSIZE,4096) - BLDSHARED="false" - LDSHFLAGS="" - ;; - *) - AC_DEFINE(STAT_ST_BLOCKSIZE,512) - ;; -esac -AC_MSG_RESULT($BLDSHARED) -AC_MSG_CHECKING([linker flags for shared libraries]) -AC_MSG_RESULT([$LDSHFLAGS]) -AC_MSG_CHECKING([compiler flags for position-independent code]) -AC_MSG_RESULT([$PICFLAGS]) - -####################################################### -# test whether building a shared library actually works -if test $BLDSHARED = true; then -AC_CACHE_CHECK([whether building shared libraries actually works], - [ac_cv_shlib_works],[ - ac_cv_shlib_works=no - # try building a trivial shared library - if test "$PICSUFFIX" = "po"; then - $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.po ${srcdir-.}/build/tests/shlib.c && - $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po && - ac_cv_shlib_works=yes - else - $CC $CPPFLAGS $CFLAGS $PICFLAG -c -o shlib.$PICSUFFIX ${srcdir-.}/build/tests/shlib.c && - mv shlib.$PICSUFFIX shlib.po && - $CC $CPPFLAGS $CFLAGS `eval echo $LDSHFLAGS` -o shlib.so shlib.po && - ac_cv_shlib_works=yes - fi - rm -f shlib.so shlib.po -]) -if test $ac_cv_shlib_works = no; then - BLDSHARED=false -fi -fi - AC_CACHE_CHECK([for Linux kernel oplocks],samba_cv_HAVE_KERNEL_OPLOCKS_LINUX,[ AC_TRY_RUN([ #include <sys/types.h> @@ -369,24 +148,6 @@ if test x"$samba_cv_HAVE_MMAP" = x"yes"; then AC_DEFINE(HAVE_MMAP,1,[Whether mmap works]) fi -case "$host_os" in -*linux*) -AC_CACHE_CHECK([for broken RedHat 7.2 system header files],samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS,[ -AC_TRY_COMPILE([ -#ifdef HAVE_SYS_VFS_H -#include <sys/vfs.h> -#endif -#ifdef HAVE_SYS_CAPABILITY_H -#include <sys/capability.h> -#endif -],[int i;], - samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=no,samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS=yes)]) -if test x"$samba_cv_BROKEN_REDHAT_7_SYSTEM_HEADERS" = x"yes"; then - AC_DEFINE(BROKEN_REDHAT_7_SYSTEM_HEADERS,1,[Broken RedHat 7.2 system header files]) -fi -;; -esac - AC_CACHE_CHECK([for O_DIRECT flag to open(2)],samba_cv_HAVE_OPEN_O_DIRECT,[ AC_TRY_COMPILE([ #include <unistd.h> |