1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-20 22:50:26 +03:00

libreplace: Remove autoconf build system

This leaves the parts required to build libreplace as a static lib for the autoconf build

Andrew Bartlett
This commit is contained in:
Andrew Bartlett 2012-06-02 23:51:39 +10:00
parent 4accd2396e
commit 5f583591db
9 changed files with 0 additions and 3648 deletions

View File

@ -1,70 +0,0 @@
#!gmake
#
CC = @CC@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
VPATH = @libreplacedir@
srcdir = @srcdir@
builddir = @builddir@
sharedbuilddir = @sharedbuilddir@
INSTALLCMD = @INSTALL@
LIBS = @LIBS@
.PHONY: test all showflags install installcheck clean distclean realdistclean
CFLAGS=-I. @CFLAGS@
LDFLAGS=@LDFLAGS@
OBJS = @LIBREPLACEOBJ@
all: showflags libreplace.a testsuite
showflags:
@echo 'libreplace will be compiled with flags:'
@echo ' CC = $(CC)'
@echo ' CFLAGS = $(CFLAGS)'
@echo ' LDFLAGS= $(LDFLAGS)'
@echo ' LIBS = $(LIBS)'
install: all
${INSTALLCMD} -d $(libdir)
${INSTALLCMD} -m 644 libreplace.a $(libdir)
shared-build: all
${INSTALLCMD} -d $(sharedbuilddir)/include
${INSTALLCMD} -m 644 replace.h $(sharedbuilddir)/include
${INSTALLCMD} -d $(sharedbuilddir)/lib
${INSTALLCMD} -m 644 libreplace.a $(sharedbuilddir)/lib
libreplace.a: $(OBJS)
ar -rcsv $@ $(OBJS)
test: all
./testsuite
installcheck: install test
TEST_OBJS = test/main.o test/testsuite.o test/os2_delete.o test/strptime.o test/getifaddrs.o
testsuite: libreplace.a $(TEST_OBJS)
$(CC) -o testsuite $(TEST_OBJS) -L. -lreplace $(LDFLAGS) $(LIBS)
.c.o:
@echo Compiling $*.c
@mkdir -p `dirname $@`
@$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f *.o test/*.o *.a testsuite
rm -f testfile.dat
distclean: clean
rm -f *~ */*~
rm -f config.log config.status config.h config.cache
rm -f Makefile
realdistclean: distclean
rm -f configure config.h.in

View File

@ -1 +0,0 @@
m4_include(libreplace.m4)

View File

@ -1,236 +0,0 @@
# AC_GNU_SOURCE
# --------------
AC_DEFUN([AC_GNU_SOURCE],
[AH_VERBATIM([_GNU_SOURCE],
[/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif])dnl
AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
AC_DEFINE([_GNU_SOURCE])
])
# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
# --------------------------------------------------------------
# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
# try again with each compiler option in the space-separated OPTION-LIST; if one
# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
# else ACTION-IF-UNAVAILABLE.
AC_DEFUN([_AC_C_STD_TRY],
[AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C]))
AC_CACHE_VAL(ac_cv_prog_cc_$1,
[ac_cv_prog_cc_$1=no
ac_save_CC=$CC
AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
for ac_arg in '' $4
do
CC="$ac_save_CC $ac_arg"
_AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
test "x$ac_cv_prog_cc_$1" != "xno" && break
done
rm -f conftest.$ac_ext
CC=$ac_save_CC
])# AC_CACHE_VAL
case "x$ac_cv_prog_cc_$1" in
x)
AC_MSG_RESULT([none needed]) ;;
xno)
AC_MSG_RESULT([unsupported]) ;;
*)
CC="$CC $ac_cv_prog_cc_$1"
AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
esac
AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
])# _AC_C_STD_TRY
# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
# ----------------------------------------------------------------
# If the C compiler is not in ISO C99 mode by default, try to add an
# option to output variable CC to make it so. This macro tries
# various options that select ISO C99 on some system or another. It
# considers the compiler to be in ISO C99 mode if it handles mixed
# code and declarations, _Bool, inline and restrict.
AC_DEFUN([_AC_PROG_CC_C99],
[_AC_C_STD_TRY([c99],
[[#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wchar.h>
#include <stdio.h>
struct incomplete_array
{
int datasize;
double data[];
};
struct named_init {
int number;
const wchar_t *name;
double average;
};
typedef const char *ccp;
static inline int
test_restrict(ccp restrict text)
{
// See if C++-style comments work.
// Iterate through items via the restricted pointer.
// Also check for declarations in for loops.
for (unsigned int i = 0; *(text+i) != '\0'; ++i)
continue;
return 0;
}
// Check varargs and va_copy work.
static void
test_varargs(const char *format, ...)
{
va_list args;
va_start(args, format);
va_list args_copy;
va_copy(args_copy, args);
const char *str;
int number;
float fnumber;
while (*format)
{
switch (*format++)
{
case 's': // string
str = va_arg(args_copy, const char *);
break;
case 'd': // int
number = va_arg(args_copy, int);
break;
case 'f': // float
fnumber = (float) va_arg(args_copy, double);
break;
default:
break;
}
}
va_end(args_copy);
va_end(args);
}
]],
[[
// Check bool and long long datatypes.
_Bool success = false;
long long int bignum = -1234567890LL;
unsigned long long int ubignum = 1234567890uLL;
// Check restrict.
if (test_restrict("String literal") != 0)
success = true;
char *restrict newvar = "Another string";
// Check varargs.
test_varargs("s, d' f .", "string", 65, 34.234);
// Check incomplete arrays work.
struct incomplete_array *ia =
malloc(sizeof(struct incomplete_array) + (sizeof(double) * 10));
ia->datasize = 10;
for (int i = 0; i < ia->datasize; ++i)
ia->data[i] = (double) i * 1.234;
// Check named initialisers.
struct named_init ni = {
.number = 34,
.name = L"Test wide string",
.average = 543.34343,
};
ni.number = 58;
int dynamic_array[ni.number];
dynamic_array[43] = 543;
// work around unused variable warnings
return bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x';
]],
dnl Try
dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99)
dnl Intel ICC -c99
dnl IRIX -c99
dnl Solaris (unused because it causes the compiler to assume C99 semantics for
dnl library functions, and this is invalid before Solaris 10: -xc99)
dnl Tru64 -c99
dnl with extended modes being tried first.
[[-std=gnu99 -c99 -qlanglvl=extc99]], [$1], [$2])[]dnl
])# _AC_PROG_CC_C99
# AC_PROG_CC_C99
# --------------
AC_DEFUN([AC_PROG_CC_C99],
[ AC_REQUIRE([AC_PROG_CC])dnl
_AC_PROG_CC_C99
])
# AC_USE_SYSTEM_EXTENSIONS
# ------------------------
# Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues.
m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[
AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
if test "$MINIX" = yes; then
AC_DEFINE([_POSIX_SOURCE], [1],
[Define to 1 if you need to in order for `stat' and other
things to work.])
AC_DEFINE([_POSIX_1_SOURCE], [2],
[Define to 2 if the system does not provide POSIX.1 features
except with this defined.])
AC_DEFINE([_MINIX], [1],
[Define to 1 if on MINIX.])
fi
AH_VERBATIM([__EXTENSIONS__],
[/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
])
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
[ac_cv_safe_to_define___extensions__],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
# define __EXTENSIONS__ 1
]AC_INCLUDES_DEFAULT])],
[ac_cv_safe_to_define___extensions__=yes],
[ac_cv_safe_to_define___extensions__=no])])
test $ac_cv_safe_to_define___extensions__ = yes &&
AC_DEFINE([__EXTENSIONS__])
AC_DEFINE([_ALL_SOURCE])
AC_DEFINE([_GNU_SOURCE])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
AC_DEFINE([_TANDEM_SOURCE])
])# AC_USE_SYSTEM_EXTENSIONS
])

View File

@ -1,13 +0,0 @@
#!/bin/sh
rm -rf autom4te.cache
rm -f configure config.h.in
autoheader || exit 1
autoconf || exit 1
rm -rf autom4te.cache
echo "Now run ./configure and then make."
exit 0

View File

@ -1,14 +0,0 @@
AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
[ AC_ARG_WITH([shared-build-dir],
[AC_HELP_STRING([--with-shared-build-dir=DIR],
[temporary build directory where libraries are installed [$srcdir/sharedbuild]])])
sharedbuilddir="$srcdir/sharedbuild"
if test x"$with_shared_build_dir" != x; then
sharedbuilddir=$with_shared_build_dir
CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
fi
AC_SUBST(sharedbuilddir)
])

1561
lib/replace/config.guess vendored

File diff suppressed because it is too large Load Diff

1686
lib/replace/config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
AC_PREREQ(2.50)
AC_INIT(replace.c)
AC_CONFIG_SRCDIR([replace.c])
AC_CONFIG_HEADER(config.h)
CFLAGS="$CFLAGS -I$srcdir"
AC_LIBREPLACE_ALL_CHECKS
AC_LIBREPLACE_NETWORK_CHECKS
if test "$ac_cv_prog_gcc" = yes; then
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -W"
CFLAGS="$CFLAGS -Wshadow"
CFLAGS="$CFLAGS -Wstrict-prototypes"
CFLAGS="$CFLAGS -Wpointer-arith"
CFLAGS="$CFLAGS -Wcast-qual"
CFLAGS="$CFLAGS -Wcast-align"
CFLAGS="$CFLAGS -Wwrite-strings"
CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
CFLAGS="$CFLAGS -Wformat=2"
CFLAGS="$CFLAGS -Wno-format-y2k"
fi
m4_include(build_macros.m4)
BUILD_WITH_SHARED_BUILD_DIR
LIBS="${LIBREPLACE_NETWORK_LIBS}"
AC_SUBST(LIBS)
AC_SUBST(LDFLAGS)
AC_OUTPUT(Makefile)

View File

@ -1,34 +0,0 @@
AC_LIBREPLACE_BROKEN_CHECKS
AC_LIBREPLACE_NETWORK_CHECKS
SMB_EXT_LIB(LIBREPLACE_EXT, [${LIBDL} ${CRYPT_LIBS}])
SMB_ENABLE(LIBREPLACE_EXT)
SMB_EXT_LIB(LIBREPLACE_NETWORK, [${LIBREPLACE_NETWORK_LIBS}])
SMB_ENABLE(LIBREPLACE_NETWORK)
# remove leading ./
LIBREPLACE_DIR=`echo ${libreplacedir} |sed -e 's/^\.\///g'`
# remove leading srcdir .. we are looking for the relative
# path within the samba source tree or wherever libreplace is.
# We need to make sure the object is not forced to end up in
# the source directory because we might be using a separate
# build directory.
LIBREPLACE_DIR=`echo ${LIBREPLACE_DIR} | sed -e "s|^$srcdir/||g"`
LIBREPLACE_OBJS="${LIBREPLACEOBJ}"
SMB_SUBSYSTEM(LIBREPLACE,
[${LIBREPLACE_OBJS}],
[LIBREPLACE_EXT LIBREPLACE_NETWORK],
[-Ilib/replace])
LIBREPLACE_HOSTCC_OBJS=`echo ${LIBREPLACE_OBJS} |sed -e 's/\.o/\.ho/g'`
SMB_SUBSYSTEM(LIBREPLACE_HOSTCC,
[${LIBREPLACE_HOSTCC_OBJS}],
[],
[-Ilib/replace])
AC_CHECK_FUNCS([syslog],,[AC_MSG_ERROR([Required function not found])])