AC_INIT(Source/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, 1997 Free Software Foundation, Inc. # # Written by: Andrew Kachites McCallum # 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. #-------------------------------------------------------------------- # Use a .h file with #define's, instead of -D command-line switches #-------------------------------------------------------------------- AC_CONFIG_HEADER(Source/include/config.h) #-------------------------------------------------------------------- # Determine the host, build, and target systems #-------------------------------------------------------------------- AC_CANONICAL_SYSTEM #-------------------------------------------------------------------- # Find the compiler #-------------------------------------------------------------------- AC_PROG_CC AC_PROG_CPP #-------------------------------------------------------------------- # -pipe option for compiler #-------------------------------------------------------------------- PIPE='-pipe' AC_SUBST(PIPE) #-------------------------------------------------------------------- # Find out if we\'re using NeXT\'s compiler. # if yes: # add -cpp-traditional to CPP # if no: # include implementations of List, HashTable etc. #-------------------------------------------------------------------- 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_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. gstep-base 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='$(GNU_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) echo "Sorry GNUstep does not yet work with the NeXT runtime." echo "Type \"setenv CC gcc -fgnu-runtime\", and run ./configure again." echo "If you are interested in having GNUstep work with the NeXT" echo "runtime, contact Andrew McCallum ." AC_MSG_ERROR(Unsupported Objective C runtime.) # Not reached, for now... 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 this library. NEXT_INCLUDES='$(GNU_NEXT_INCLUDES)' OBJS_INSTALL='$(GNU_OBJS) $(NEXTSTEP_OBJS) $(GNUSTEP_OBJS)' HEADERS_INSTALL='$(GNU_HEADERS) $(NEXTSTEP_HEADERS) $(GNUSTEP_HEADERS)' NeXT_cc=0 fi fi #---------------------------------------------------------------- # Make sure we can find the -lobjc runtime library #---------------------------------------------------------------- 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="-lobjc $LIBS" fi fi else AC_MSG_RESULT(yes) AC_MSG_ERROR(Sorry, $(LIBRARY_NAME) 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 "$(LIBRARY_NAME) makes extensive use of nested functions. In 3.2," echo "NeXT's cc did not support nested functions. To compile $(LIBRARY_NAME)" 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_DEFINE_UNQUOTED(NeXT_runtime, $NeXT_runtime) AC_DEFINE_UNQUOTED(NeXT_cc, $NeXT_cc) AC_SUBST(NEXT_INCLUDES) #-------------------------------------------------------------------- # Byte order information needed for foundation headers. #-------------------------------------------------------------------- AC_C_BIGENDIAN if test $ac_cv_c_bigendian = yes; then GS_WORDS_BIGENDIAN=1 else GS_WORDS_BIGENDIAN=0 fi AC_SUBST(GS_WORDS_BIGENDIAN) #-------------------------------------------------------------------- # Type size information needed for foundation headers. #-------------------------------------------------------------------- AC_CHECK_SIZEOF(void*) GS_SINT8="signed char" GS_UINT8="unsigned char" AC_SUBST(GS_SINT8) AC_SUBST(GS_UINT8) AC_CHECK_SIZEOF(short) AC_SUBST(ac_cv_sizeof_short) AC_CHECK_SIZEOF(int) AC_SUBST(ac_cv_sizeof_int) AC_CHECK_SIZEOF(long) AC_SUBST(ac_cv_sizeof_long) AC_CHECK_SIZEOF(long long) AC_SUBST(ac_cv_sizeof_long_long) AC_CHECK_SIZEOF(float) AC_SUBST(ac_cv_sizeof_float) AC_CHECK_SIZEOF(double) AC_SUBST(ac_cv_sizeof_double) if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_int; then GS_ADDR="unsigned int" else if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long; then GS_ADDR="unsigned long" else if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long_long; then GS_ADDR="unsigned long long" else echo "Unable to find integer of same size as void* - abort configuration" exit fi fi fi AC_SUBST(GS_ADDR) if test $ac_cv_sizeof_short = 2; then GS_SINT16="signed short" GS_UINT16="unsigned short" else if test $ac_cv_sizeof_int = 2; then GS_SINT16="signed int" GS_UINT16="unsigned int" else echo "Unable to determine type for 16-bit integer - abort configuration" exit fi fi AC_SUBST(GS_SINT16) AC_SUBST(GS_UINT16) if test $ac_cv_sizeof_int = 4; then GS_SINT32="signed int" GS_UINT32="unsigned int" else if test $ac_cv_sizeof_long = 4; then GS_SINT32="signed long" GS_UINT32="unsigned long" else if test $ac_cv_sizeof_short = 4; then GS_SINT32="signed short" GS_UINT32="unsigned short" else echo "Unable to determine type for 32-bit integer - abort configuration" exit fi fi fi AC_SUBST(GS_SINT32) AC_SUBST(GS_UINT32) GS_HAVE_I64=1 if test $ac_cv_sizeof_int = 8; then GS_SINT64="signed int" GS_UINT64="unsigned int" else if test $ac_cv_sizeof_long = 8; then GS_SINT64="signed long" GS_UINT64="unsigned long" else if test $ac_cv_sizeof_long_long = 8; then GS_SINT64="signed long long" GS_UINT64="unsigned long long" else # 64-bit ints not supported - but we need a dummy type for byte-swapping # of 64-bit values arriving from another system. GS_SINT64="struct { gsu8 a[8]; }" GS_SINT64="struct { gsu8 a[9]; }" GS_HAVE_I64=0 fi fi fi AC_SUBST(GS_SINT64) AC_SUBST(GS_UINT64) AC_SUBST(GS_HAVE_I64) GS_HAVE_I128=1 if test $ac_cv_sizeof_long = 16; then GS_SINT128="signed long" GS_UINT128="unsigned long" else if test $ac_cv_sizeof_long_long = 16; then GS_SINT128="signed long long" GS_UINT128="unsigned long long" else # 128-bit ints not supported - but we need a dummy type for byte-swapping # of 128-bit values arriving from another system. GS_SINT128="struct { gsu8 a[16]; }" GS_UINT128="struct { gsu8 a[16]; }" GS_HAVE_I128=0 fi fi AC_SUBST(GS_SINT128) AC_SUBST(GS_UINT128) AC_SUBST(GS_HAVE_I128) if test $ac_cv_sizeof_float = 4; then GS_FLT32="float" else echo "Unable to determine type for 32-bit float - abort configuration" exit fi AC_SUBST(GS_FLT32) if test $ac_cv_sizeof_double = 8; then GS_FLT64="double" else echo "Unable to determine type for 64-bit float - abort configuration" exit fi AC_SUBST(GS_FLT64) #-------------------------------------------------------------------- # Type-size information for encoding into archives using NSArchiver etc. #-------------------------------------------------------------------- if test $ac_cv_sizeof_short = 2; then _GSC_S_SHT=_GSC_I16 else _GSC_S_SHT=_GSC_I32 fi AC_SUBST(_GSC_S_SHT) if test $ac_cv_sizeof_int = 2; then _GSC_S_INT=_GSC_I16 else if test $ac_cv_sizeof_int = 4; then _GSC_S_INT=_GSC_I32 else if test $ac_cv_sizeof_int = 8; then _GSC_S_INT=_GSC_I64 else if test $ac_cv_sizeof_int = 16; then _GSC_S_INT=_GSC_I128 fi fi fi fi AC_SUBST(_GSC_S_INT) if test $ac_cv_sizeof_long = 4; then _GSC_S_LNG=_GSC_I32 else if test $ac_cv_sizeof_long = 8; then _GSC_S_LNG=_GSC_I64 else if test $ac_cv_sizeof_long = 16; then _GSC_S_LNG=_GSC_I128 fi fi fi AC_SUBST(_GSC_S_LNG) if test $ac_cv_sizeof_long_long = 4; then _GSC_S_LNG_LNG=_GSC_I32 else if test $ac_cv_sizeof_long_long = 8; then _GSC_S_LNG_LNG=_GSC_I64 else if test $ac_cv_sizeof_long_long = 16; then _GSC_S_LNG_LNG=_GSC_I128 fi fi fi AC_SUBST(_GSC_S_LNG_LNG) #-------------------------------------------------------------------- # Setup dynamic linking #-------------------------------------------------------------------- OBJC_SYS_DYNAMIC_LINKER() #-------------------------------------------------------------------- # Generic settings needed by NSZone.m #-------------------------------------------------------------------- AC_TYPE_SIZE_T AC_C_INLINE #-------------------------------------------------------------------- # Following header checks needed for bzero in Storage.m and other places #-------------------------------------------------------------------- AC_HEADER_STDC AC_CHECK_HEADERS(string.h memory.h) #-------------------------------------------------------------------- # Following header check needed BinaryCStream.h #-------------------------------------------------------------------- AC_CHECK_HEADERS(values.h) #-------------------------------------------------------------------- # Header files and functions for files and filesystems #-------------------------------------------------------------------- AC_CHECK_HEADERS(sys/stat.h sys/vfs.h sys/statfs.h sys/statvfs.h pwd.h grp.h) AC_CHECK_FUNCS(statvfs) #-------------------------------------------------------------------- # These two headers (functions) needed by Time.m #-------------------------------------------------------------------- dnl AC_REPLACE_FUNCS(getrusage gettimeofday) AC_CHECK_HEADERS(sys/time.h) AC_CHECK_HEADERS(sys/resource.h) if test $ac_cv_header_sys_time_h = no -o $ac_cv_header_sys_resource_h = no ; 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_HEADERS(sys/socket.h) AC_CHECK_HEADERS(netinet/in.h) dnl AC_REPLACE_FUNCS(recvfrom) if test $ac_cv_header_sys_socket_h = no -o $ac_cv_header_netinet_in_h = no ; then AC_MSG_ERROR(Could not find headers needed by class SocketPort) fi #-------------------------------------------------------------------- # These headers/functions needed by NSLog.m #-------------------------------------------------------------------- AC_CHECK_HEADERS(syslog.h) AC_CHECK_FUNCS(syslog) #-------------------------------------------------------------------- # This function needed by StdioStream.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(vsprintf) if test $ac_cv_func_vsprintf = yes ; then AC_TRY_RUN([#include "$srcdir/config/config.vsprintf.c"], VSPRINTF_RETURNS_LENGTH=1, VSPRINTF_RETURNS_LENGTH=0, VSPRINTF_RETURNS_LENGTH=1) AC_DEFINE_UNQUOTED(VSPRINTF_RETURNS_LENGTH, $VSPRINTF_RETURNS_LENGTH) fi #-------------------------------------------------------------------- # This function needed by NSFileManager.m and find_exec.c #-------------------------------------------------------------------- AC_CHECK_FUNCS(getcwd) #-------------------------------------------------------------------- # DIR definitions needed by NSBundle.m #-------------------------------------------------------------------- AC_HEADER_DIRENT #-------------------------------------------------------------------- # This function needed by NSPage.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(valloc) #-------------------------------------------------------------------- # This function needed by Time.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(times) #-------------------------------------------------------------------- # These functions needed by NSData.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(mkstemp) AC_CHECK_FUNCS(shmctl) AC_CHECK_FUNCS(mmap) AC_CHECK_FUNCS(mkstemp) #-------------------------------------------------------------------- # This function needed by UnixFileHandle.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(inet_aton) #-------------------------------------------------------------------- # These functions needed by NSTask.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(killpg setpgrp setpgid) #-------------------------------------------------------------------- # This function needed by NSThread.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(usleep) #-------------------------------------------------------------------- # This function needed by NSDebug.m #-------------------------------------------------------------------- AC_CHECK_FUNCS(strerror) #-------------------------------------------------------------------- # This function needed by NSString for handling of %@ printf directive. #-------------------------------------------------------------------- AC_CHECK_FUNC(register_printf_function, register_printf=1, register_printf=0) if test $register_printf = 1; then AC_TRY_RUN([#include "$srcdir/config/config.printf.c"], working_register_printf=1, working_register_printf=0, working_register_printf=1) if test $working_register_printf = 1; then AC_DEFINE(HAVE_REGISTER_PRINTF_FUNCTION) fi fi #-------------------------------------------------------------------- # Tools for making a DLL. #-------------------------------------------------------------------- DLLTOOL='dlltool' AC_SUBST(DLLTOOL) #-------------------------------------------------------------------- # Custom configuration based upon the target #-------------------------------------------------------------------- # On some platforms, ld doesn't link in the complete library which # can cause problems with the dynamic nature of ObjC. Programs call # methods for classes which don't exist in the executable!! # The variables turn on/off the behaviour of ld to include the # whole archive. # Note that executable sizes will be larger. # Note that these variables are passed to GCC not ld directly whole_archive='' no_whole_archive='' case "${target}" in i[[345]]86-*-cygwin32) whole_archive='-Wl,--whole-archive' no_whole_archive='-Wl,--no-whole-archive' LIBS="$LIBS -ladvapi32" # -pipe not supported PIPE='' ;; i[[345]]86-*-mingw32) whole_archive='-Wl,--whole-archive' no_whole_archive='-Wl,--no-whole-archive' LIBS="$LIBS -lwsock32 -ladvapi32 -luser32" # Shared library is a DLL if [[ x$SHARED_LIBRARY != x ]]; then SHARED_LIBRARY='lib$(LIBRARY_NAME).dll' # Rename static library if also building a shared library if [[ x$STATIC_LIBRARY != x ]]; then STATIC_LIBRARY='lib$(LIBRARY_NAME)_s$(LIBEXT)' IMPORT_LIBRARY='lib$(LIBRARY_NAME)$(LIBEXT)' fi fi # -pipe not supported PIPE='' ;; esac AC_SUBST(whole_archive) AC_SUBST(no_whole_archive) AC_CONFIG_SUBDIRS(Source/mframe) #-------------------------------------------------------------------- # Write the Makefiles #-------------------------------------------------------------------- AC_OUTPUT(config.mak Source/include/GSConfig.h) dnl Local Variables: dnl comment-start: "dnl " dnl comment-end: "" dnl comment-start-skip: "\\bdnl\\b\\s *" dnl compile-command: "autoconf" dnl End: