AC_INIT(application.make) # # configure.in # # Copyright (C) 1997 Free Software Foundation, Inc. # # Author: Scott Christley # Ovidiu Predescu # # 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 #-------------------------------------------------------------------- # Determine the host, build, and target systems #-------------------------------------------------------------------- targetArgument=${target} AC_CANONICAL_SYSTEM 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, /usr/local/bin/perl) 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 #-------------------------------------------------------------------- # Find for X windows #-------------------------------------------------------------------- AC_PATH_XTRA X_INCLUDE="" if test -n "$x_includes"; then X_INCLUDE="-I$x_includes" fi X_LIBS="" if test -n "$x_libraries"; then X_LIBS="-L$x_libraries" fi if test -r $x_includes/X11/DPS; then X_INCLUDE="$X_INCLUDE -I$x_includes/X11" fi #-------------------------------------------------------------------- # 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 X_INCLUDE="$X_INCLUDE -I$with_dps_include" if test -n "$with_dps_library"; then X_LIBS="$X_LIBS -L$with_dps_library" fi fi CPPFLAGS="${CPPFLAGS} ${X_INCLUDE}" # 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) AC_SUBST(X_INCLUDE) AC_SUBST(X_LIBS) AC_SUBST(X_PRE_LIBS) 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) #-------------------------------------------------------------------- # 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 #undef PACKAGE #undef VERSION #undef HAVE_STDLIB_H #include ], jpeg_ok=yes, jpeg_ok=no) AC_MSG_RESULT($jpeg_ok) if test "$jpeg_ok" = yes; then JPEG_LIB="-L$1" export JPEG_LIB JPEG_INCLUDE="-I$2" export JPEG_INCLUDE fi fi CPPFLAGS="${jpeg_check_lib_save_header}"]) if test "x$JPEG_LIB" = x; then AC_CHECK_JPEGLIB(${with_jpeg_library}, ${with_jpeg_include}) fi AC_SUBST(JPEG_LIB) AC_SUBST(JPEG_INCLUDE) #-------------------------------------------------------------------- # 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 TIFF_LIB="-L$1" export TIFF_LIB TIFF_INCLUDE="-I$2" export TIFF_INCLUDE 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 "x$TIFF_LIB" = x; then AC_CHECK_TIFFLIB(${with_tiff_library}, ${with_tiff_include}) fi AC_SUBST(JPEG) AC_SUBST(TIFF_LIB) AC_SUBST(TIFF_INCLUDE) #-------------------------------------------------------------------- # Setup the library combination #-------------------------------------------------------------------- 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 = cygwin32; then ac_cv_library_combo=gnu-gnu-gnu-w32gui else ac_cv_library_combo=gnu-gnu-gnu-xgps fi fi AC_SUBST(ac_cv_library_combo) #-------------------------------------------------------------------- # 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_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="-lpthread -lobjc" AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpthread", objc_threaded="", objc_threaded="-lpthread") 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)