libs-base/configure.in
mccallum ebe82a8bbc (register_printf_function): Check for this function.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@793 72102866-910b-0410-8b05-ffd578937521
1996-01-24 03:24:33 +00:00

256 lines
10 KiB
Text

AC_INIT(src/Collection.m)
# configure.in for GNU Objective-C library
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 1993,1994, 1995, 1996 Free Software Foundation, Inc.
#
# Written by: R. Andrew McCallum <mccallum@cs.rochester.edu>
# Dept. of Computer Science, U. of Rochester, Rochester, NY 14627
#
# This file is part of the GNU Objective-C library.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#--------------------------------------------------------------------
# Find the compiler
#--------------------------------------------------------------------
AC_PROG_CC
AC_PROG_CPP
#--------------------------------------------------------------------
# Find out if we\'re using NeXT\'s compiler.
# if yes:
# add -cpp-traditional to CPP
# if no:
# include implementations of List, HashTable etc. objects
#--------------------------------------------------------------------
AC_MSG_CHECKING(whether we are using NeXT's compiler)
AC_TRY_CPP([#include "$srcdir/config/config.nextcc.h"], NeXTCC=0, NeXTCC=1)
# Was using this too: -o `basename $CC` = "gcc" -o `basename $CC` = "xgcc"
if test $NeXTCC = 0; then
AC_MSG_RESULT(no)
#----------------------------------------------------------------
# Find out if nested functions work on this machine
#----------------------------------------------------------------
AC_C_CROSS
AC_MSG_CHECKING(whether nested functions work)
AC_TRY_RUN([#include "$srcdir/config/config.nested.c"],
gcc_nested=1, gcc_nested=0,
gcc_nested=1)
if test $gcc_nested = 0; then
echo "aborting"
echo
echo "The GCC 'nested functions' feature does not seem to be working on"
echo "this machine. Libobjects makes extensive use of nested functions."
echo "Read the bug-report instructions in the GCC texinfo manual"
echo "and submit a bug report."
echo "The program this configure script used to test nested functions"
echo "can be found in the file 'config/config.nested.c' in this"
echo "distribution. Under sparc-sun-sunos4.1.3 with gcc-2.6.1 the"
echo "file compiles, runs and returns exit status 0."
exit
else
AC_MSG_RESULT(yes)
fi
#----------------------------------------------------------------
# Find out if we're on a NEXTSTEP machine
#----------------------------------------------------------------
AC_MSG_CHECKING(whether we are running under NEXTSTEP)
AC_TRY_CPP([#if defined(NeXT)
#error
#endif], NeXTSTEP=0, NeXTSTEP=1)
if test $NeXTSTEP = 0; then
AC_MSG_RESULT(no)
OBJS_INSTALL='$(GNU_OBJS) $(NEXTSTEP_OBJS) $(GNUSTEP_OBJS)'
HEADERS_INSTALL='$(GNU_HEADERS) $(NEXTSTEP_HEADERS) $(GNUSTEP_HEADERS)'
NEXT_INCLUDES='$(OBJECTS_NEXT_INCLUDES)'
NeXT_runtime=0
NeXT_cc=0
else
AC_MSG_RESULT(yes)
#----------------------------------------------------------------
# Find out if we are using NeXT or GNU runtime
#----------------------------------------------------------------
saved_ac_ext=$ac_ext
ac_ext=m
AC_MSG_CHECKING(whether we are using GNU Objective C runtime)
AC_TRY_LINK([#include "$srcdir/config/config.nextrt.m"], ;,
NeXT_runtime=1, NeXT_runtime=0)
ac_ext=$saved_ac_ext
if test $NeXT_runtime = 1; then
AC_MSG_RESULT(no: NeXT runtime)
LIBOBJC=''
CC="$CC -fnext-runtime"
# Make sure that we get NeXTs objc/*.h files
NEXT_INCLUDES='$(NEXT_NEXT_INCLUDES)'
OBJS_INSTALL='$(GNU_OBJS)'
HEADERS_INSTALL='$(GNU_HEADERS)'
NeXT_cc=0
else
AC_MSG_RESULT(yes)
LIBOBJC='-lobjc'
CC="$CC -fgnu-runtime"
# Get objc/List.h, etc. files from libobjects.
NEXT_INCLUDES='$(OBJECTS_NEXT_INCLUDES)'
OBJS_INSTALL='$(GNU_OBJS) $(NEXTSTEP_OBJS) $(GNUSTEP_OBJS)'
HEADERS_INSTALL='$(GNU_HEADERS) $(NEXTSTEP_HEADERS) $(GNUSTEP_HEADERS)'
NeXT_cc=0
fi
fi
#----------------------------------------------------------------
# Find out if we have sel_types_match
# (i.e. the necessary patch has been applied)
#----------------------------------------------------------------
if test $NeXT_runtime = 0; then
AC_CHECK_LIB(objc, main, HAVE_LIBOBJC=1, HAVE_LIBOBJC=0)
if test $HAVE_LIBOBJC = 0; then
AC_MSG_ERROR(Couldn't find GCC Objective C runtime library, libobjc.a)
else
LIBS="$LIBS -lobjc"
fi
AC_CHECK_FUNC(sel_types_match, have_sel=1, have_sel=0)
if test $have_sel = 0; then
AC_MSG_ERROR(Could not find sel_types_match in libobjc.a.
GCC version less than 2.6.1?)
fi
fi
else
AC_MSG_RESULT(yes)
AC_MSG_ERROR(Sorry, libobjects does not currently work with NeXT's cc; use gcc)
#----------------------------------------------------------------
# Find out if we have NEXTSTEP 3.2 or lower
#----------------------------------------------------------------
AC_CHECKING(NEXTSTEP version)
AC_TRY_CPP([#if NX_CURRENT_COMPILER_RELEASE < 320
#error
#endif], NeXT32plus=1, NeXT32plus=0)
if test $NeXT32plus = 0; then
echo "aborting"
echo
echo "It looks like your compiler is NEXTSTEP 3.2 or earlier."
echo "Libobjects makes extensive use of nested functions. In 3.2,"
echo "NeXT's cc did not support nested functions. To compile libobjects"
echo "you can either (1) use gcc instead of NeXT's cc (no loss, since"
echo "gcc can compile AppKit programs without problems), or (2) upgrade"
echo "to the later release of NEXTSTEP when it is available."
exit
fi
OBJS_INSTALL='$(GNU_OBJS)'
HEADERS_INSTALL='$(GNU_HEADERS)'
LIBOBJC=''
NeXT_runtime=1
NeXT_cc=1
# NeXT default cpp doesn't accept nested functions
CC='cc -traditional-cpp'
fi
AC_SUBST(OBJS_INSTALL)
AC_SUBST(HEADERS_INSTALL)
AC_SUBST(LIBOBJC)
AC_SUBST(NeXT_runtime)
AC_SUBST(NeXT_cc)
AC_SUBST(NEXT_INCLUDES)
#--------------------------------------------------------------------
# Setup dynamic linking
#--------------------------------------------------------------------
OBJC_SYS_DYNAMIC_FLAGS()
#--------------------------------------------------------------------
# Find some programs
#--------------------------------------------------------------------
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_LN_S
#--------------------------------------------------------------------
# Following header checks needed for bzero in Storage.m and other places
#--------------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADERS(string.h memory.h)
#--------------------------------------------------------------------
# These two headers (functions) needed by Time.m
#--------------------------------------------------------------------
dnl AC_REPLACE_FUNCS(getrusage gettimeofday)
AC_CHECK_HEADER(sys/time.h, TIME_H=1, TIME_H=0)
AC_CHECK_HEADER(sys/resource.h, RESOURCE_H=1, RESOURCE_H=0)
if test TIME_H = 0 -o RESOURCE_H = 0 ; then
AC_MSG_ERROR(Could not find headers needed by class Time)
fi
AC_CHECK_HEADERS(sys/rusage.h ucbinclude/sys/resource.h)
#--------------------------------------------------------------------
# These headers/functions needed by SocketPort.m
#--------------------------------------------------------------------
AC_CHECK_HEADER(sys/socket.h, SOCKET_H=1, SOCKET_H=0)
AC_CHECK_HEADER(netinet/in.h, IN_H=1, IN_H=0)
dnl AC_REPLACE_FUNCS(recvfrom)
if test SOCKET_H = 0 -o IN_H = 0 ; then
AC_MSG_ERROR(Could not find headers needed by class SocketPort)
fi
#--------------------------------------------------------------------
# This function needed by StdioStream.m
#--------------------------------------------------------------------
AC_CHECK_FUNCS(vsprintf)
#--------------------------------------------------------------------
# This function needed by objc-malloc.c
#--------------------------------------------------------------------
AC_CHECK_FUNCS(valloc)
#--------------------------------------------------------------------
# This function needed by Time.m
#--------------------------------------------------------------------
AC_CHECK_FUNCS(times)
#--------------------------------------------------------------------
# This function needed by NSString for handling of %@ printf directive.
#--------------------------------------------------------------------
AC_CHECK_FUNCS(register_printf_function)
#--------------------------------------------------------------------
# These libraries needed by the check programs for distributed objects
# on Solaris where the socket/network code isn't the regular place. Yuck!
# I'm assuming that if the socket/network code is in the regular place,
# we won't find these libraries, or if we do find them, they aren't
# something weird I wouldn't want to link with.
# It's just for the programs in "checks" and "examples" anyway; it
# doesn't affect the compilation of libobjects.
#--------------------------------------------------------------------
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, main)
#--------------------------------------------------------------------
# Make a shared library?
#--------------------------------------------------------------------
AC_ARG_ENABLE(shared, Build libobjects as a shared library,
LIBOBJECTS_SO='libobjects.so.$(OBJECTS_VERSION)',
LIBOBJECTS_SO=)
AC_SUBST(LIBOBJECTS_SO)
#--------------------------------------------------------------------
# Write the Makefiles
#--------------------------------------------------------------------
AC_OUTPUT(Makefile src/Makefile checks/Makefile examples/Makefile
doc/Makefile NSCharacterSets/Makefile admin/Makefile src/objects/config.h)