tools-make/configure.in
Adam Fedor 2ec95f23d8 Final fixes for DLLs
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@6847 72102866-910b-0410-8b05-ffd578937521
2000-06-30 22:29:10 +00:00

484 lines
15 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
GNUSTEP_SYSTEM_ROOT=/usr/GNUstep ;
echo $GNUSTEP_SYSTEM_ROOT ;
else
echo $GNUSTEP_SYSTEM_ROOT ;
fi`)
if test "x$prefix" = "xNONE"; then
prefix=$ac_default_prefix ;
fi
GNUSTEP_ROOT=$prefix
GNUSTEP_PREFIX='$(prefix)'
AC_ARG_WITH(system-root,
[ --without-system-root Dont use separate system root directory],
ac_cv_system_root=$withval,
ac_cv_system_root=yes)
if test $ac_cv_system_root = yes; then
if test `basename $prefix` = System; then
GNUSTEP_ROOT=`dirname $prefix`
else
prefix=$prefix/System
GNUSTEP_PREFIX='$(prefix)/..'
fi
else
if test `basename $prefix` = System; then
GNUSTEP_ROOT=`dirname $prefix`
GNUSTEP_PREFIX="$(prefix)/.."
fi
fi
AC_SUBST(GNUSTEP_ROOT)
AC_SUBST(GNUSTEP_PREFIX)
#--------------------------------------------------------------------
# Setup the library combination
#--------------------------------------------------------------------
targetArgument=${target}
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
else
ac_cv_library_combo=gnu-gnu-gnu-xgps
fi
fi
AC_SUBST(ac_cv_library_combo)
#--------------------------------------------------------------------
# Determine the host, build, and target systems
#--------------------------------------------------------------------
if test $host_os = mingw32 ; then
echo "hosted on mingw32 .."
export MINGW32=1
export SHELL=zsh
export CC=${CC:-gcc}
export AR=${AR:-ar}
export RANLIB=${RANLIB:-ranlib}
export DLLTOOL=${DLLTOOL:-dlltool}
export program_suffix=${program_suffix:-.exe}
if test "x$program_suffix" = "xNONE"; then
export program_suffix=.exe
fi
elif test $host_os = cygwin; then
echo "hosted on cygwin .."
export MINGW32=0
export CC=${CC:-gcc}
export AR=${AR:-ar}
export RANLIB=${RANLIB:-ranlib}
export DLLTOOL=${DLLTOOL:-dlltool}
export program_suffix=${program_suffix:-.exe}
if test "x$program_suffix" = "xNONE"; then
export program_suffix=.exe
fi
else
MINGW32=0
export MINGW32
fi
EXEEXT=
if test "x$program_suffix" != "xNONE"; then
EXEEXT=$program_suffix
fi
AC_SUBST(EXEEXT)
#--------------------------------------------------------------------
# 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_PROG_CC
AC_PROG_CPP
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
#--------------------------------------------------------------------
# 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)
#--------------------------------------------------------------------
# Look for WindowMaker's wraster library
#--------------------------------------------------------------------
SYSTEM_DEFS=
AC_ARG_WITH(wraster,
[ --with-wraster=PREFIX wraster directory prefix])
if test "x$with_wraster" = "x"; then
wprefix=""
else
wprefix=${with_wraster}/
fi
GRAPHIC_LIBS=`${wprefix}get-wraster-flags --libs`
GRAPHIC_CFLAGS=`${wprefix}get-wraster-flags --cflags`
GRAPHIC_LFLAGS=`${wprefix}get-wraster-flags --ldflags`
AC_DEFUN(AC_CHECK_WRASTER,
[dnl
AC_MSG_CHECKING(for current libwraster support)
AC_CACHE_VAL(gs_cv_have_wraster,
[wraster_check_save_header=${CPPFLAGS}
wraster_check_save_libs=${LIBS}
CPPFLAGS="$1 $2 ${CPPFLAGS}"
LIBS="$3 $LIBS"
# Check for RFillImage which is only in version 2.0 or libwraster
AC_CHECK_LIB(wraster, RFillImage, wraster_ok=yes, wraster_ok=no)
if test "$wraster_ok" = yes; then
AC_CHECK_HEADERS(wraster.h, wraster_ok=yes, wraster_ok=no)
fi
if test "$wraster_ok" = yes; then
SYSTEM_DEFS="-DHAVE_WRASTER_H $SYSTEM_DEFS"
gs_cv_have_wraster=yes
else
GRAPHIC_LIBS=
GRAPHIC_CFLAGS=
GRAPHIC_LFLAGS=
gs_cv_have_wraster=no
fi
CPPFLAGS="${wraster_check_save_header}"
LIBS="${wraster_check_save_libs}"
])
AC_MSG_RESULT($gs_cv_have_wraster)
])
AC_CHECK_WRASTER(${GRAPHIC_CFLAGS}, ${GRAPHIC_LFLAGS}, ${GRAPHIC_LIBS})
AC_SUBST(GRAPHIC_LIBS)
AC_SUBST(GRAPHIC_CFLAGS)
AC_SUBST(GRAPHIC_LFLAGS)
AC_SUBST(SYSTEM_DEFS)
#--------------------------------------------------------------------
# Find for X windows
#--------------------------------------------------------------------
AC_PATH_XTRA
if test $gs_cv_have_wraster = no; then
GRAPHIC_CFLAGS="$X_CFLAGS"
GRAPHIC_LFLAGS="$X_LIBS"
GRAPHIC_LIBS="-lXext -lX11 $X_EXTRA_LIBS"
lib_save_header=${CPPFLAGS}
lib_save_libs=${LIBS}
CPPFLAGS="${GRAPHIC_CFLAGS} ${GRAPHIC_LFLAGS} ${CPPFLAGS}"
LIBS="${GRAPHIC_LIBS} ${LIBS}"
AC_CHECK_LIB(Xmu, main, have_xmu=1, have_xmu=0)
CPPFLAGS="${lib_save_header}"
LIBS="${lib_save_libs}"
if test $have_xmu = 1; then
GRAPHIC_LIBS="-lXmu ${GRAPHIC_LIBS}"
fi
fi
if test -r $x_includes/X11/DPS; then
GRAPHIC_CFLAGS="-I$x_includes/X11 $GRAPHIC_CFLAGS"
fi
AC_SUBST(X_PRE_LIBS)
#--------------------------------------------------------------------
# Find for DPS
#--------------------------------------------------------------------
AC_ARG_WITH(dps_library,
[ --with-dps-library=DIR DPS library file are in DIR], ,
with_dps_library=)
AC_ARG_WITH(dps_include,
[ --with-dps-include=DIR DPS include files are in DIR], ,
with_dps_include=)
# Add the target header file directory as an include path so that the
# check for dpsNXargs.h below looks at the appropriate target includes
ORIG_CPPFLAGS=${CPPFLAGS}
if test -n "$with_dps_include"; then
GRAPHIC_CFLAGS="-I$with_dps_include $GRAPHIC_CFLAGS"
fi
if test -n "$with_dps_library"; then
GRAPHIC_LFLAGS="-L$with_dps_library $GRAPHIC_LFLAGS"
fi
CPPFLAGS="${CPPFLAGS} ${GRAPHIC_CFLAGS}"
# We care about this header file on the target not host system
AC_HAVE_HEADERS(DPS/dpsclient.h, DPS_DEFINE=' -DHAVE_DPS_CLIENT_H=1',
DPS_DEFINE=' -DHAVE_DPS_CLIENT_H=0')
AC_HAVE_HEADERS(DPS/dpsNXargs.h,
DPS_DEFINE="$DPS_DEFINE -DHAVE_DPS_DPSNXARGS_H=1",
DPS_DEFINE="$DPS_DEFINE -DHAVE_DPS_DPSNXARGS_H=0")
# Restore back to the original
CPPFLAGS=${ORIG_CPPFLAGS}
AC_SUBST(DPS_DEFINE)
#--------------------------------------------------------------------
# Find for JPEG
#--------------------------------------------------------------------
AC_ARG_WITH(jpeg_library,
[ --with-jpeg-library=DIR JPEG library file are in DIR], ,
with_jpeg_library=/usr/local/lib)
AC_ARG_WITH(jpeg_include,
[ --with-jpeg-include=DIR JPEG include files are in DIR], ,
with_jpeg_include=/usr/local/include)
AC_DEFUN(AC_CHECK_JPEGLIB,
[jpeg_check_lib_save_header=${CPPFLAGS}
CPPFLAGS="-L$1 -I$2 ${CPPFLAGS}"
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
jpeg_ok=yes,
jpeg_ok=no)
if test "$jpeg_ok" = yes; then
AC_MSG_CHECKING([for jpeglib.h])
AC_TRY_CPP([#include <stdio.h>
#undef PACKAGE
#undef VERSION
#undef HAVE_STDLIB_H
#include <jpeglib.h>],
jpeg_ok=yes,
jpeg_ok=no)
AC_MSG_RESULT($jpeg_ok)
if test "$jpeg_ok" = yes; then
GRAPHIC_LFLAGS="-L$1 $GRAPHIC_LFLAGS"
GRAPHIC_CFLAGS="-I$1 $GRAPHIC_CFLAGS"
fi
fi
CPPFLAGS="${jpeg_check_lib_save_header}"])
if test $gs_cv_have_wraster = no; then
AC_CHECK_JPEGLIB(${with_jpeg_library}, ${with_jpeg_include})
fi
#--------------------------------------------------------------------
# Find for TIFF
#--------------------------------------------------------------------
AC_ARG_WITH(tiff_library,
[ --with-tiff-library=DIR TIFF library file are in DIR], ,
with_tiff_library=/usr/local/lib)
AC_ARG_WITH(tiff_include,
[ --with-tiff-include=DIR TIFF include files are in DIR], ,
with_tiff_include=/usr/local/include)
AC_DEFUN(AC_CHECK_TIFFLIB,
[tiff_check_lib_save_header=${CPPFLAGS}
tiff_check_lib_save_libs=${LIBS}
CPPFLAGS="-L$1 ${JPEG_LIB} -I$2 ${JPEG_INCLUDE} ${CPPFLAGS}"
AC_CHECK_LIB(z, main, HAVE_LIBZ=1, HAVE_LIBZ=0)
AC_MSG_CHECKING(for -ltiff without -ljpeg nor -lz)
LIBS="-ltiff -lm $LIBS"
AC_TRY_LINK([char TIFFReadScanline();], [TIFFReadScanline()],
jpeg_notneeded=yes,
jpeg_notneeded=no)
AC_MSG_RESULT($jpeg_notneeded)
LIBS=${tiff_check_lib_save_libs}
JPEG=
if test "$jpeg_notneeded" = no; then
JPEG=-ljpeg
fi
if test $HAVE_LIBZ = 1; then
AC_MSG_CHECKING(for -ltiff without -lz)
LIBS="-ltiff $JPEG -lm $LIBS"
AC_TRY_LINK([char TIFFReadScanline();], [TIFFReadScanline()],
libz_notneeded=yes,
libz_notneeded=no)
AC_MSG_RESULT($libz_notneeded)
LIBS=${tiff_check_lib_save_libs}
if test "$libz_notneeded" = no; then
JPEG="$JPEG -lz"
fi
fi
AC_CHECK_LIB(tiff, TIFFReadScanline,
tiff_ok=yes,
tiff_ok=no
AC_MSG_WARN(Cannot find libtiff)
echo "* The GUI library reqiures the TIFF library"
echo "* Use --with-tiff-library to specify the tiff library"
echo "* directory if it is not in the usual place(s)"
echo "* You may also have to specify --with-jpeg-library if the jpeg"
echo "* Library is needed by tiff"
if test "x$CONFIGURING_CORE_LIBRARIES" != x; then
AC_MSG_ERROR(You must have proper libraries installed to compile core)
fi,
$JPEG -lm)
if test "$tiff_ok" = yes; then
AC_CHECK_HEADER(tiffio.h,
tiff_ok=yes,
tiff_ok=no)
if test "$tiff_ok" = yes; then
GRAPHIC_LFLAGS="-L$1 $GRAPHIC_LFLAGS"
GRAPHIC_CFLAGS="-I$1 $GRAPHIC_CFLAGS"
GRAPHIC_LIBS="-ltiff $JPEG $GRAPHIC_LIBS"
else
AC_MSG_WARN(Cannot find libtiff header tiffio)
echo "* The GUI library requres the TIFF library"
echo "* Use --with-tiff-include to specify the tiff header directory"
echo "* if it is not in the usual place(s)"
if test "x$CONFIGURING_CORE_LIBRARIES" != x; then
AC_MSG_ERROR(You must have proper libraries installed to compile core)
fi
fi
fi
CPPFLAGS="${tiff_check_lib_save_header}"])
if test $gs_cv_have_wraster = no; then
AC_CHECK_TIFFLIB(${with_tiff_library}, ${with_tiff_include})
fi
#--------------------------------------------------------------------
# Check if libobjc was compiled with thread support.
#--------------------------------------------------------------------
AC_MSG_CHECKING(for alternate objc library)
AC_CACHE_VAL(gs_cv_objc_libdir,
[dnl
gs_cv_objc_libdir=NONE
if test -f $GNUSTEP_SYSTEM_ROOT/Headers/objc/objc.h; then
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/$ac_cv_library_combo
if test -f $GNUSTEP_SYSTEM_ROOT/Libraries/$obj_dir/libobjc.a; then
gs_cv_objc_libdir=$GNUSTEP_SYSTEM_ROOT/Libraries/$obj_dir
else
gs_cv_objc_libdir=NONE
fi
fi
])
AC_MSG_RESULT($gs_cv_objc_libdir)
if test "$gs_cv_objc_libdir" != "NONE"; then
CPPFLAGS="$CPPFLAGS -I$GNUSTEP_SYSTEM_ROOT/Headers/"
LDFLAGS="$LDFLAGS -L$gs_cv_objc_libdir"
fi
AC_MSG_CHECKING(whether objc has thread support)
extra_LIBS=""
case "${target_os}" in
solaris*)
extra_LIBS="-lposix4"
;;
esac
saved_LIBS="$LIBS"
objc_thread_lib=""
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
else
LIBS="-lobjc $LIBS $extra_LIBS"
AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lthread",
objc_threaded="", objc_threaded="-lthread")
fi
LIBS="$saved_LIBS"
if test x"$objc_threaded" = x""; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
ac_cv_objc_threaded=$objc_threaded
AC_SUBST(objc_threaded)
AC_SUBST(ac_cv_objc_threaded)
#--------------------------------------------------------------------
# Record the version
#--------------------------------------------------------------------
if test -f "../Version"; then
. ../Version
fi
AC_SUBST(GNUSTEP_VERSION)
AC_SUBST(GNUSTEP_MAJOR_VERSION)
AC_SUBST(GNUSTEP_MINOR_VERSION)
#--------------------------------------------------------------------
# Produce the output files
#--------------------------------------------------------------------
AC_OUTPUT(config.h config.make openapp debugapp which_lib.pl opentool
executable.template GNUmakefile GNUstep.sh GNUstep.csh,
chmod a+x openapp debugapp which_lib.pl opentool executable.template)