# # configure.ac # # Copyright (C) 1997 Free Software Foundation, Inc. # # Author: Scott Christley # Ovidiu Predescu # Rewrite: Adam Fedor # # 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_INIT AC_CONFIG_SRCDIR([application.make]) AC_CONFIG_HEADER(config.h) #-------------------------------------------------------------------- # Setup the library combination #-------------------------------------------------------------------- targetArgument=${target} AC_PROG_CC AC_PROG_CPP AC_CANONICAL_TARGET([]) AC_ARG_WITH(library-combo,[ --with-library-combo Define the default library combination ], 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 else ac_cv_library_combo=gnu-gnu-gnu fi fi AC_SUBST(ac_cv_library_combo) OBJC_RUNTIME_LIB=`echo $ac_cv_library_combo | awk -F- '{print $1}'` #-------------------------------------------------------------------- # 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 #-------------------------------------------------------------------- case $host_os in *cygwin* ) CYGWIN=yes;; *mingw32* ) MINGW32=yes;; * ) MINGW32=no CYGWIN=no;; esac AC_SUBST(CYGWIN) AC_EXEEXT AC_OBJEXT if test "$MINGW32" = yes; then echo "hosted on mingw32 .." export INSTALL=install export SHELL=sh 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_PROG_INSTALL AC_PROG_LN_S([]) AC_CHECK_PROGS(TAR, gnutar gtar, tar) AC_ARG_WITH(tar, [--with-tar Set the name of the tar program to use], TAR="$withval",) AC_CHECK_PROG(CHOWN, chown, chown, none) if test "$MINGW32" = no; then if test "$CHOWN" = "none"; then AC_MSG_ERROR("Could not find chown."); fi fi #------------------------------------------------------------------- # GNUstep specific options follow #------------------------------------------------------------------- #-------------------------------------------------------------------- # The GNUstep root directory. # The user should have the GNUSTEP_SYSTEM_ROOT environment variable # defined, but if not then we have a global default. # Also test for the C: directory, which means we're on Windows #-------------------------------------------------------------------- AC_MSG_CHECKING(for GNUSTEP_SYSTEM_ROOT to use) AC_PREFIX_DEFAULT(`if test "x$GNUSTEP_SYSTEM_ROOT" = "x"; then if test -d C: ; then echo C:/GNUstep; else echo /usr/GNUstep ; fi 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 Don't 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) AC_MSG_RESULT($prefix) # 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 #-------------------------------------------------------------------- # Process --with-defaults-root, --with-user-root, # --with-local-root and --with-network-root #-------------------------------------------------------------------- AC_MSG_CHECKING(for GNUSTEP_LOCAL_ROOT to use) 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_MSG_RESULT($GNUSTEP_LOCAL_ROOT) AC_MSG_CHECKING(for GNUSTEP_NETWORK_ROOT to use) 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_MSG_RESULT($GNUSTEP_NETWORK_ROOT) 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) #-------------------------------------------------------------------- # Build backend bundles (on by default) #-------------------------------------------------------------------- AC_ARG_ENABLE(backend-bundle, [ --disable-backend-bundle Compile gui backend as a library], ac_cv_backend=$enableval, ac_cv_backend="yes") if test "$ac_cv_backend" = "yes"; then BACKEND_BUNDLE=yes; else BACKEND_BUNDLE=; fi AC_SUBST(BACKEND_BUNDLE) #-------------------------------------------------------------------- # 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 shared 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 #gcc_shared_libobjc=`gcc -print-file-name=libobjc.so` #if test -f "$gcc_shared_libobjc"; then # gs_cv_objc_libdir=`dirname $gcc_shared_libobjc` #fi ]) AC_MSG_RESULT($gs_cv_objc_libdir) # The following are needed to compile the test programs if test "$gs_cv_objc_libdir" = "$GNUSTEP_LDIR"; then OBJC_CPPFLAGS="$CPPFLAGS -I$prefix/Headers" OBJC_LDFLAGS="$LDFLAGS -L$gs_cv_objc_libdir" fi # And the following to execute them LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gs_cv_objc_libdir" export LD_LIBRARY_PATH #-------------------------------------------------------------------- # Miscellaneous headers (only used for compiling which_lib.c and user_home.c) #-------------------------------------------------------------------- AC_HEADER_DIRENT AC_CHECK_HEADERS(sys/param.h sys/file.h dir.h string.h stdlib.h sys/types.h dnl fcntl.h limits.h utime.h sys/stat.h pwd.h unistd.h) AC_CHECK_FUNCS(getpwnam getpwuid geteuid getlogin strchr) #-------------------------------------------------------------------- # Check if libobjc was compiled with thread support. #-------------------------------------------------------------------- OBJC_THREAD= AC_ARG_WITH(thread-lib, [--with-thread-lib Specify alternate thread library], OBJC_THREAD=$withval, OBJC_THREAD= ) AC_MSG_CHECKING(whether objc has thread support) extra_LIBS="" case "${target_os}" in solaris*) extra_LIBS="-lposix4" ;; esac saved_CFLAGS="$CFLAGS" saved_LIBS="$LIBS" CFLAGS="$CFLAGS -x objective-c -I$srcdir $OBJC_CPPFLAGS $OBJC_LDFLAGS" if test "$OBJC_RUNTIME_LIB" = "nx"; then CFLAGS="$CFLAGS -DNeXT_RUNTIME" fi if test "$OBJC_THREAD" != ""; then LIBS="-lobjc $LIBS $OBJC_THREAD $extra_LIBS" AC_TRY_RUN([#include "config_thread.m"], objc_threaded="$OBJC_THREAD $extra_LIBS", objc_threaded="", objc_threaded="") elif 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: $objc_threaded) 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) #-------------------------------------------------------------------- # Check if compiler supports -MMD -MP to generate %.d files ... #-------------------------------------------------------------------- AC_MSG_CHECKING(if the compiler supports autodependencies) # What we want to do: set AUTO_DEPENDENCIES to yes if gcc => 3.x if test ! ${GCC} = "yes" ; then AUTO_DEPENDENCIES="" AC_MSG_RESULT(no: it's not gcc) else # Running gcc -dumpversion we get something like 2.95.4 or # egcs-2.91.66 or 3.0.2 or 3.1 20011211 # We want to discard anything but the major number. # Explanation of the regexp - # \(^[^0-9]*\) matches beginning of line and following non numeric chars # \([0-9][0-9]*\) matches 1 or more numeric chars (this is the 2^nd # subpattern) # \([^0-9].*\) matches a non numeric char followed by anything # /\2/ replace the whole lot with the 2^nd subpattern gs_cv_gcc_major_version=`${CC} -dumpversion | sed "s/\(^[[^0-9]]*\)\([[0-9]][[0-9]]*\)\([[^0-9]].*\)/\2/"`; if test "${gs_cv_gcc_major_version}" -ge "3" ; then AUTO_DEPENDENCIES=yes AC_MSG_RESULT(yes: gcc major version is ${gs_cv_gcc_major_version}) else AUTO_DEPENDENCIES="" AC_MSG_RESULT(no: gcc major version is ${gs_cv_gcc_major_version}) fi fi AC_SUBST(AUTO_DEPENDENCIES) #--------------------------------------------------------------------- # Enable/disable warnings for deprecated #import directive as required #--------------------------------------------------------------------- AC_MSG_CHECKING(whether to disable compiler warnings about deprecated import) # # GCC recommends that you use `--disable-import' here, since #import # is seriously deprecated. If you are unsure, please use --disable-import. # AC_ARG_ENABLE(import, [--disable-import Warn about usage of deprecated import directive], ac_cv_import=$enableval, ac_cv_import="yes") AC_MSG_RESULT($ac_cv_import) if test "$ac_cv_import" = "yes"; then OBJC_NO_IMPORT_FLAGS=-Wno-import; fi AC_SUBST(OBJC_NO_IMPORT_FLAGS) #-------------------------------------------------------------------- # Record the version #-------------------------------------------------------------------- AC_MSG_CHECKING(for the version of gnustep-make we are compiling) . "$srcdir/Version" AC_MSG_RESULT($GNUSTEP_MAKE_VERSION) AC_SUBST(GNUSTEP_MAKE_VERSION) AC_SUBST(GNUSTEP_MAKE_MAJOR_VERSION) AC_SUBST(GNUSTEP_MAKE_MINOR_VERSION) AC_SUBST(GNUSTEP_MAKE_SUBMINOR_VERSION) #-------------------------------------------------------------------- # Produce the output files #-------------------------------------------------------------------- AC_CONFIG_FILES([config.h config.make openapp debugapp opentool executable.template GNUmakefile GNUstep.sh GNUstep.csh fixpath.sh gnustep-make.spec Documentation/GNUmakefile]) AC_CONFIG_COMMANDS([default], [[chmod a+x openapp debugapp opentool fixpath.sh executable.template]], [[]]) AC_OUTPUT