tools-make/configure.in
Adam Fedor a27430b892 Update
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/branches/freeze-1_0_0@9521 72102866-910b-0410-8b05-ffd578937521
2001-04-05 02:24:09 +00:00

356 lines
11 KiB
Text

AC_INIT(application.make)
#
# configure.in
#
# Copyright (C) 1997 Free Software Foundation, Inc.
#
# Author: Scott Christley <scottc@net-community.com>
# Ovidiu Predescu <ovidiu@net-community.com>
#
# This file is part of the GNUstep Makefile Package.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# You should have received a copy of the GNU General Public
# License along with this library; see the file COPYING.LIB.
# If not, write to the Free Software Foundation,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AC_CONFIG_HEADER(config.h)
#--------------------------------------------------------------------
# The GNUstep root directory.
# The user should have the GNUSTEP_SYSTEM_ROOT environment variable
# defined, but if not then we have a global default.
#--------------------------------------------------------------------
AC_PREFIX_DEFAULT(`if test "x$GNUSTEP_SYSTEM_ROOT" = "x"; then
echo /usr/GNUstep ;
else
echo $GNUSTEP_SYSTEM_ROOT ;
fi`)
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix ;
fi
AC_ARG_WITH(system-root,
[ --without-system-root Dont use separate system root directory],
ac_cv_system_root=$withval,
ac_cv_system_root=yes)
GNUSTEP_ROOT=$prefix
root_prefix='${prefix}'
if test $ac_cv_system_root = yes; then
if test "x`basename $prefix`" = xSystem; then
GNUSTEP_ROOT=`dirname $prefix`
else
if test "x$prefix" = "x/"; then
prefix=/System
else
prefix=$prefix/System
fi
fi
root_prefix='${prefix}/..'
fi
AC_SUBST(GNUSTEP_ROOT)
AC_SUBST(root_prefix)
#--------------------------------------------------------------------
# Process --with-local-root and --with-network-root options
#--------------------------------------------------------------------
AC_ARG_WITH(local-root,[
--with-local-root
Set the GNUSTEP_LOCAL_ROOT directory. Use this option if you want
to have the GNUSTEP_LOCAL_ROOT directory in a non-standard place. Example:
--with-local-root=/usr/local/GNUstep/Local
],
GNUSTEP_LOCAL_ROOT=$withval,
GNUSTEP_LOCAL_ROOT=$GNUSTEP_ROOT/Local
)
AC_ARG_WITH(network-root,[
--with-network-root
Set the GNUSTEP_NETWORK_ROOT directory. Use this option if you want
to have the GNUSTEP_NETWORK_ROOT directory in a non-standard place. Example:
--with-network-root=/usr/local/GNUstep/Network
],
GNUSTEP_NETWORK_ROOT=$withval,
GNUSTEP_NETWORK_ROOT=$GNUSTEP_ROOT/Network
)
AC_SUBST(GNUSTEP_LOCAL_ROOT)
AC_SUBST(GNUSTEP_NETWORK_ROOT)
#--------------------------------------------------------------------
# Is the system flattened?
#--------------------------------------------------------------------
AC_ARG_ENABLE(flattened,
[ --enable-flattened Use flattened directory structure],
ac_cv_flattened=$enableval,
ac_cv_flattened="undefined")
if test "$ac_cv_flattened" = "yes"; then
GNUSTEP_FLATTENED=yes;
else
if test "$ac_cv_flattened" = "no"; then
GNUSTEP_FLATTENED=;
else
GNUSTEP_FLATTENED=$GNUSTEP_FLATTENED;
fi
fi
AC_SUBST(GNUSTEP_FLATTENED)
#--------------------------------------------------------------------
# Setup the library combination
#--------------------------------------------------------------------
targetArgument=${target}
AC_PROG_CC
AC_PROG_CPP
AC_CANONICAL_SYSTEM
AC_ARG_WITH(library-combo,[
--with-library-combo
Define the default library combinations that will be used when you
type 'make'. You can still change the library combination at runtime
by specifying the 'library_combo' make variable. For example:
$ make library_combo=nx-pdo-nx-nil
],
ac_cv_library_combo=$withval,
ac_cv_library_combo=$ac_cv_library_combo
)
if test "$ac_cv_library_combo" = ""; then
if test $host_os = nextstep4; then
ac_cv_library_combo=nx-nx-nx-nil
elif test $host_os = cygwin; then
ac_cv_library_combo=gnu-gnu-gnu-win32
elif test $host_os = mingw32; then
ac_cv_library_combo=gnu-gnu-gnu-win32
elif test $host_os = mingw; then
ac_cv_library_combo=gnu-gnu-gnu-win32
else
ac_cv_library_combo=gnu-gnu-gnu-xgps
fi
fi
AC_SUBST(ac_cv_library_combo)
#--------------------------------------------------------------------
# specific target_os options
#--------------------------------------------------------------------
case "$target_os" in
freebsd*) CPPFLAGS="$CPPFLAGS -I/usr/local/include"
LIBS="$LIBS -L/usr/local/lib";;
esac
#--------------------------------------------------------------------
# Determine the host, build, and target systems
#--------------------------------------------------------------------
AC_CYGWIN
AC_MINGW32
AC_EXEEXT
AC_OBJEXT
if test "$MINGW32" = yes; then
echo "hosted on mingw32 .."
export SHELL=zsh
export CC=${CC:-gcc}
export AR=${AR:-ar}
export RANLIB=${RANLIB:-ranlib}
export DLLTOOL=${DLLTOOL:-dlltool}
elif test "$CYGWIN" = yes; then
echo "hosted on cygwin .."
export CC=${CC:-gcc}
export AR=${AR:-ar}
export RANLIB=${RANLIB:-ranlib}
export DLLTOOL=${DLLTOOL:-dlltool}
fi
#--------------------------------------------------------------------
# Find the binary and compile tools
#--------------------------------------------------------------------
if test "x$target" != "x$host"; then
echo "cross compiling from $host to $target .."
cross_compiling="yes"
AC_CHECK_PROG(CC, "${targetArgument}-gcc", dnl
"${targetArgument}-gcc", gcc)
AC_CHECK_PROG(RANLIB, "${targetArgument}-ranlib", dnl
"${targetArgument}-ranlib", ranlib)
AC_CHECK_PROG(AR, "${targetArgument}-ar", dnl
"${targetArgument}-ar", ar)
AC_CHECK_PROG(DLLTOOL, "${targetArgument}-dlltool", dnl
"${targetArgument}-dlltool", dlltool)
else
AC_CHECK_PROG(AR, ar, ar)
AC_CHECK_PROG(DLLTOOL, dlltool, dlltool)
AC_PROG_RANLIB
fi
AC_PATH_PROG(PERL, perl, none)
AC_PROG_INSTALL
# HOST_INSTALL is the name of the install program in config.make so set it up
# to point to the install-sh script in the GNUstep tree if no system install is
# found.
AC_SUBST(HOST_INSTALL)
if test "$INSTALL" = "$ac_install_sh"; then
HOST_INSTALL=$prefix/Makefiles/$INSTALL
else
HOST_INSTALL=$INSTALL
fi
AC_LN_S
TAR=
AC_CHECK_PROG(TAR, gtar, gtar)
if test "$TAR" = ""; then
TAR=tar
fi
#--------------------------------------------------------------------
# Miscellaneous flags and setup
#--------------------------------------------------------------------
# Strip '-g' off of CFLAGS, since debug=yes adds that anyway
CFLAGS=`echo $CFLAGS | sed -e 's/-g //'`
# CPPFLAGS are used throughout for additional includes, which eventually
# goes in the SYSTEM_CONFIG_INCL variable. If someone really wants to
# set CPPFLAGS, set FORCE_CPPFLAGS instead (see config.make.in)
if test "$FORCE_CPPFLAGS" = ""; then
FORCE_CPPFLAGS=
fi
AC_SUBST(FORCE_CPPFLAGS)
# Set location of GNUstep dirs for later use
GNUSTEP_HDIR=$prefix/Headers
if test "$GNUSTEP_FLATTENED" = yes; then
GNUSTEP_LDIR=$prefix/Libraries
else
clean_target_os=`$srcdir/clean_os.sh $target_os`
clean_target_cpu=`$srcdir/clean_cpu.sh $target_cpu`
obj_dir=$clean_target_cpu/$clean_target_os
GNUSTEP_LDIR=$prefix/Libraries/$obj_dir
fi
# Check to see if the libobjc library is in our GNUSTEP_SYSTEM_ROOT.
# If so, there are probably other libraries that we want there also, so
# leave the proper includes in CPPFLAGS and LDFLAGS
AC_MSG_CHECKING(for alternate objc library)
AC_CACHE_VAL(gs_cv_objc_libdir,
[dnl
gs_cv_objc_libdir=NONE
if test -f $GNUSTEP_HDIR/objc/objc.h; then
if test -f $GNUSTEP_LDIR/libobjc.a -o -f $GNUSTEP_LDIR/libobjc.so; then
gs_cv_objc_libdir=$GNUSTEP_LDIR
else
gs_cv_objc_libdir=NONE
fi
fi
])
AC_MSG_RESULT($gs_cv_objc_libdir)
# FIXME: There is a reference problem here, since gnustep-make
# needs to be installed before other libraries, but if so, then
# we will end up not including these dirs. For now, just include them
# all the time:
#if test "$gs_cv_objc_libdir" != "NONE"; then
# The following are needed to compile the test programs
CPPFLAGS="$CPPFLAGS -I$prefix/Headers"
LDFLAGS="$LDFLAGS -L$GNUSTEP_LDIR"
# And the following to execute them
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GNUSTEP_LDIR"
export LD_LIBRARY_PATH
#fi
#--------------------------------------------------------------------
# Miscellaneous headers (for make programs only)
#--------------------------------------------------------------------
AC_HEADER_DIRENT
AC_HAVE_HEADERS(sys/param.h sys/file.h dir.h string.h stdlib.h sys/types.h dnl
sys/stat.h sys/errno.h)
#--------------------------------------------------------------------
# Check if libobjc was compiled with thread support.
#--------------------------------------------------------------------
AC_MSG_CHECKING(whether objc has thread support)
extra_LIBS=""
case "${target_os}" in
solaris*)
extra_LIBS="-lposix4"
;;
esac
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -x objective-c"
saved_LIBS="$LIBS"
if test "$host_os" = linux-gnu; then
LIBS="-lobjc -lpthread"
AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpthread",
objc_threaded="", objc_threaded="-lpthread")
elif test "`echo $host_os|sed 's/[[0-9]].*//'|sed s/elf//`" = freebsd; then
LIBS="-pthread -lobjc"
AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-pthread",
objc_threaded="", objc_threaded="-pthread")
if test x"$objc_threaded" = x""; then
LIBS="-lpthread -lobjc"
AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpthread",
objc_threaded="", objc_threaded="-lpthread")
fi
if test x"$objc_threaded" = x""; then
LIBS="-lobjc -lpcthread"
AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpcthread",
objc_threaded="", objc_threaded="-lpcthread")
fi
elif test "$MINGW32" = yes; then
# Mingw doesn't need anything extra for threads
LIBS="-lobjc $LIBS $extra_LIBS"
AC_TRY_RUN([#include "config_thread.m"],
objc_threaded="works",
objc_threaded="", objc_threaded="works")
else
LIBS="-lobjc $LIBS -lthread $extra_LIBS"
AC_TRY_RUN([#include "config_thread.m"],
objc_threaded="-lthread $extra_LIBS",
objc_threaded="", objc_threaded="")
fi
LIBS="$saved_LIBS"
CFLAGS="$saved_CFLAGS"
if test x"$objc_threaded" = x""; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
if test x"$objc_threaded" = x"works"; then
objc_threaded=""
fi
fi
ac_cv_objc_threaded="$objc_threaded"
AC_SUBST(objc_threaded)
AC_SUBST(ac_cv_objc_threaded)
#--------------------------------------------------------------------
# Record the version
#--------------------------------------------------------------------
. ./Version
if test -f "../Version"; then
. ../Version
fi
DATE=`date +"%Y%m%d"`
AC_SUBST(GNUSTEP_VERSION)
AC_SUBST(GNUSTEP_MAKE_VERSION)
AC_SUBST(GNUSTEP_MAJOR_VERSION)
AC_SUBST(GNUSTEP_MINOR_VERSION)
AC_SUBST(DATE)
#--------------------------------------------------------------------
# Produce the output files
#--------------------------------------------------------------------
AC_OUTPUT(config.h config.make openapp debugapp which_lib.pl opentool
executable.template GNUmakefile GNUstep.sh GNUstep.csh gnustep-make.spec
Documentation/GNUmakefile, chmod a+x openapp debugapp which_lib.pl \
opentool executable.template)