4 # Copyright (C) 1997-2004 Free Software Foundation, Inc.
6 # Author: Scott Christley <scottc@net-community.com>
7 # Ovidiu Predescu <ovidiu@net-community.com>
8 # Rewrite: Adam Fedor <fedor@gnu.org>
9 # Nicola Pero <n.pero@mi.flashnet.it>
11 # This file is part of the GNUstep Makefile Package.
13 # This library is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License
15 # as published by the Free Software Foundation; either version 2
16 # of the License, or (at your option) any later version.
18 # You should have received a copy of the GNU General Public
19 # License along with this library; see the file COPYING.LIB.
20 # If not, write to the Free Software Foundation,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 AC_CONFIG_SRCDIR([application.make])
25 AC_CONFIG_HEADER(config.h)
27 #--------------------------------------------------------------------
28 # Setup the library combination
29 #--------------------------------------------------------------------
30 targetArgument=${target}
33 AC_CANONICAL_TARGET([])
35 AC_MSG_CHECKING(for library combo)
36 AC_ARG_WITH(library-combo,[
38 Define the default "library combo". The library combo is a string
39 of the form aaa-bbb-ccc where 'aaa' is the Objective-C runtime
40 library to use (examples are 'gnu' and 'apple'),
41 'bbb' is the Foundation library to use (examples are 'gnu' for
42 gnustep-base, and 'apple' for Apple Cocoa FoundationKit),
43 and 'ccc' is the ApplicationKit to use (examples are 'gnu'
44 for gnustep-gui and 'apple' for Apple Cocoa AppKit). Use this
45 option if you want to force a different default library combo than
46 the one that would be used by default. For example, on Darwin GNUstep
47 will automatically use the Apple Objective-C frameworks by
48 default (library-combo=apple-apple-apple); if you are planning
49 on installing and using gnustep-base on there, you would need
50 to use --with-library-combo=gnu-gnu-gnu instead. Please notice
51 that if --disable-flattened is used, gnustep-make can have fat
52 binaries that support multiple library combos. In that case,
53 this flag will only configure the default one, but you can still
54 use other ones at run-time.
56 ac_cv_library_combo=$withval,
57 ac_cv_library_combo=$ac_cv_library_combo
60 if test "$ac_cv_library_combo" = "" -o "$ac_cv_library_combo" = "no"; then
62 darwin*) ac_cv_library_combo=apple-apple-apple ;;
63 nextstep4) ac_cv_library_combo=nx-nx-nx ;;
64 openstep4) ac_cv_library_combo=nx-nx-nx ;;
65 *) ac_cv_library_combo=gnu-gnu-gnu ;;
69 case "$ac_cv_library_combo" in
70 apple) ac_cv_library_combo=apple-apple-apple ;;
71 gnu) ac_cv_library_combo=gnu-gnu-gnu ;;
72 nx) ac_cv_library_combo=nx-nx-nx ;;
75 AC_SUBST(ac_cv_library_combo)
76 AC_MSG_RESULT($ac_cv_library_combo)
78 OBJC_RUNTIME_LIB=`echo $ac_cv_library_combo | awk -F- '{print $1}'`
80 #--------------------------------------------------------------------
81 # Check if we are using Apple cc
82 #--------------------------------------------------------------------
85 AC_MSG_CHECKING([for apple compiler flags])
86 cc_cppprecomp=`${CC} -no-cpp-precomp 2>&1 | grep -c "unrecognized"`
87 cc_bundle=`${CC} -bundle 2>&1 | grep -c "couldn"`
88 # 0 means we have the flag
89 if test $cc_cppprecomp = 0; then
94 if test $cc_bundle = 0; then
99 AC_MSG_RESULT($cc_bundle)
100 AC_SUBST(cc_cppprecomp)
103 #--------------------------------------------------------------------
104 # specific target_os options
105 #--------------------------------------------------------------------
107 freebsd* | openbsd* )
108 INCLUDES="$INCLUDES -I/usr/local/include"
109 LIB_DIR="$LIB_DIR -L/usr/local/lib";;
110 netbsd*) INCLUDES="$INCLUDES -I/usr/pkg/include"
111 LIB_DIR="$LIB_DIR -Wl,-R/usr/pkg/lib -L/usr/pkg/lib";;
114 #--------------------------------------------------------------------
115 # Determine the host, build, and target systems
116 #--------------------------------------------------------------------
135 if test "$MINGW32" = yes; then
136 echo "hosted on mingw32 .."
137 export INSTALL="install -p"
141 export RANLIB=${RANLIB:-ranlib}
142 export DLLTOOL=${DLLTOOL:-dlltool}
143 elif test "$CYGWIN" = yes; then
144 echo "hosted on cygwin .."
147 export RANLIB=${RANLIB:-ranlib}
148 export DLLTOOL=${DLLTOOL:-dlltool}
151 #--------------------------------------------------------------------
152 # Find the binary and compile tools
153 #--------------------------------------------------------------------
154 if test "x$target" != "x$host"; then
155 echo "cross compiling from $host to $target .."
156 cross_compiling="yes"
157 AC_CHECK_PROG(CC, "${targetArgument}-gcc", dnl
158 "${targetArgument}-gcc", gcc)
159 AC_CHECK_PROG(RANLIB, "${targetArgument}-ranlib", dnl
160 "${targetArgument}-ranlib", ranlib)
161 AC_CHECK_PROG(AR, "${targetArgument}-ar", dnl
162 "${targetArgument}-ar", ar)
163 AC_CHECK_PROG(DLLTOOL, "${targetArgument}-dlltool", dnl
164 "${targetArgument}-dlltool", dlltool)
166 AC_CHECK_PROG(AR, ar, ar)
167 AC_CHECK_PROG(DLLTOOL, dlltool, dlltool)
174 AC_CHECK_PROGS(TAR, gnutar gtar, tar)
177 Set the name of the tar program to use. Use this option if the
178 default choice does not work for you.
182 AC_CHECK_PROG(CHOWN, chown, chown, none)
183 if test "$MINGW32" = no; then
184 if test "$CHOWN" = "none"; then
185 AC_MSG_ERROR("Could not find chown.");
189 #-------------------------------------------------------------------
190 # GNUstep specific options follow
191 #-------------------------------------------------------------------
193 #---------------------------------------------------------------------
194 # Location of the GNUstep.conf config file (--with-config-file)
195 #---------------------------------------------------------------------
196 AC_MSG_CHECKING([for GNUstep configuration file to use])
197 AC_ARG_WITH(config-file,[
198 --with-config-file=PATH
199 Set the path of the system GNUstep config file. Use this option
200 if you want to have the GNUstep config file in a non-standard place.
201 Example: --with-config-file=/usr/GNUstep/GNUstep.conf
203 GNUSTEP_CONFIG_FILE="$withval",)
204 if test "$GNUSTEP_CONFIG_FILE" = "" -o "$GNUSTEP_CONFIG_FILE" = "no"; then
206 freebsd* | openbsd* ) GNUSTEP_CONFIG_FILE=/usr/etc/GNUstep.conf ;;
207 netbsd* ) GNUSTEP_CONFIG_FILE=/usr/pkg/etc/GNUstep.conf ;;
208 mingw32* ) GNUSTEP_CONFIG_FILE=/c/GNUstep/GNUstep.conf-dev ;;
209 *) GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf ;;
212 if echo "$GNUSTEP_CONFIG_FILE" | grep -q '[[ \\]]'
214 echo "found a backslash or space (illegal) in '$GNUSTEP_CONFIG_FILE'"
215 echo "Please try again using --with-config-file= to specify a valid path."
216 if test "$MSWIND" = "yes"
218 echo "Please note that on windows you must use unix-style paths within"
219 echo "the make package even though gnustep programs built in the mingw32"
220 echo "environment use native paths throughout."
224 AC_MSG_RESULT($GNUSTEP_CONFIG_FILE)
225 AC_SUBST(GNUSTEP_CONFIG_FILE)
227 #---------------------------------------------------------------------
228 # Now read/import the existing configuration file, if any
229 #---------------------------------------------------------------------
231 # Reading/importing the existing configuration file is good as a
232 # default because it means that you don't have to type in your
233 # GNUSTEP_SYSTEM_ROOT, GNUSTEP_LOCAL_ROOT, etc. settings every time
234 # you configure gnustep-make. (please note we only read the
235 # system-wide one, not the user one. Reason being that the settings
236 # we read will be used to generate the new system-wide one, while the
237 # user one will be left untouched).
239 # It can be annoying in certain cases though; this option lets you
241 AC_MSG_CHECKING([if we should import an existing configuration file])
242 AC_ARG_ENABLE(importing-config-file, [
243 --disable-importing-config-file
244 Disable importing the existing system GNUstep configuration file.
245 Use this option to prevent an existing configuration file from being
246 parsed and used when configure is being run.
248 ac_cv_importing_config_file=$enableval,
249 ac_cv_importing_config_file="yes")
251 # If importing the file is disabled, don't import it.
252 if test "$ac_cv_importing_config_file" = "no"; then
253 AC_MSG_RESULT([no: disabled from the command-line])
256 # Check that the file exists
257 if test ! -f "$GNUSTEP_CONFIG_FILE"; then
258 AC_MSG_RESULT([no: file "$GNUSTEP_CONFIG_FILE" does not exist])
260 AC_MSG_RESULT([yes: trying to import "$GNUSTEP_CONFIG_FILE"])
261 AC_MSG_NOTICE([If this fails, please run configure again with the --disable-importing-config-file option])
262 . "$GNUSTEP_CONFIG_FILE"
266 #--------------------------------------------------------------------
267 # Important - from now on, any variable that is set in the
268 # configuration file (eg, GNUSTEP_SYSTEM_ROOT) could already have a
269 # value that we have imported from the previous file. ./configure
270 # command line options should override those values, but otherwise we
273 # Those could also be env variables, which is really a backwards
274 # compatibility hack that won't necessarily be kept in the future!
275 #--------------------------------------------------------------------
278 #--------------------------------------------------------------------
280 #--------------------------------------------------------------------
285 # ./configure --prefix=/usr/GNUstep
289 # ./configure --with-system-root=/usr/GNUstep/System
290 # --with-local-root=/usr/GNUstep/Local
292 # plus it has the side-effect that a config.site will be loaded by
293 # ./configure from $prefix/share/config.site, if it exists. Our
294 # config.site is in $prefix/System/share/config.site though, so it
295 # won't be found. It doesn't really matter though, as the config.site
296 # is irrelevant for us in this context.
299 # Please note that AC_PREFIX_DEFAULT will not appear in this position
300 # in the generated configure file; it will appear at the very
301 # beginning. So we can't check for GNUSTEP_SYSTEM_ROOT or anything
302 # similar in the implementation of AC_PREFIX_DEFAULT because we will
303 # not have read GNUstep.conf yet ...
305 # PS: This is the default GNUSTEP_ROOT that is used when installing
306 # GNUstep with no other indication. Test for the C: directory, which
307 # means we're on Windows
308 AC_PREFIX_DEFAULT(`if test -d C: ; then
315 # GNUSTEP_ROOT is only used to set default values for
316 # GNUSTEP_SYSTEM_ROOT and GNUSTEP_LOCAL_ROOT if they are not set in
317 # config file or as a command-line argument.
319 if test "x$prefix" = "xNONE"; then
320 GNUSTEP_ROOT="$ac_default_prefix" ;
322 GNUSTEP_ROOT="$prefix";
324 # Set the values for all those variables ovverriding anything read
325 # from the configuration file or inherited from the environment.
326 # The --prefix=xxx option should overwrite those. Please notice
327 # that the --with-system-root=xxx (and similar) options are
328 # processed later as overwrite --prefix=xxx in their specific area.
329 GNUSTEP_SYSTEM_ROOT="$GNUSTEP_ROOT/System";
330 GNUSTEP_LOCAL_ROOT="$GNUSTEP_ROOT/Local";
331 GNUSTEP_NETWORK_ROOT="$GNUSTEP_LOCAL_ROOT";
334 #--------------------------------------------------------------------
335 # Process --with-system-root
336 #--------------------------------------------------------------------
337 AC_MSG_CHECKING(for GNUSTEP_SYSTEM_ROOT to use)
338 AC_ARG_WITH(system-root,[
340 Set the GNUSTEP_SYSTEM_ROOT directory. Use this option if you want
341 to have the GNUSTEP_SYSTEM_ROOT directory in a non-standard place.
342 Example: --with-system-root=/usr/GNUstep/System
344 GNUSTEP_SYSTEM_ROOT="$withval",)
345 if test "$GNUSTEP_SYSTEM_ROOT" = "" -o "$GNUSTEP_SYSTEM_ROOT" = "no"; then
346 GNUSTEP_SYSTEM_ROOT="$GNUSTEP_ROOT/System"
348 if echo "$GNUSTEP_SYSTEM_ROOT" | grep -q '[[ \\]]'
350 echo "found a backslash or space (illegal) in '$GNUSTEP_SYSTEM_ROOT'"
351 echo "Please try again using --with-system-root= to specify a valid path."
352 if test "$MSWIND" = "yes"
354 echo "Please note that on windows you must use unix-style paths within"
355 echo "the make package even though gnustep programs built in the mingw32"
356 echo "environment use native paths throughout."
360 AC_MSG_RESULT($GNUSTEP_SYSTEM_ROOT)
361 AC_SUBST(GNUSTEP_SYSTEM_ROOT)
363 #--------------------------------------------------------------------
364 # Process --with-local-root
365 #--------------------------------------------------------------------
366 AC_MSG_CHECKING(for GNUSTEP_LOCAL_ROOT to use)
367 AC_ARG_WITH(local-root,[
369 Set the GNUSTEP_LOCAL_ROOT directory. Use this option if you want
370 to have the GNUSTEP_LOCAL_ROOT directory in a non-standard place.
371 Example: --with-local-root=/usr/local/GNUstep/Local
373 GNUSTEP_LOCAL_ROOT="$withval",)
374 # If GNUSTEP_LOCAL_ROOT is explicitly set to 'no', we effectively disable it
375 # by setting it to be the same as GNUSTEP_SYSTEM_ROOT
376 if test "$GNUSTEP_LOCAL_ROOT" = "no"; then
377 GNUSTEP_LOCAL_ROOT="$GNUSTEP_SYSTEM_ROOT"
379 if test "$GNUSTEP_LOCAL_ROOT" = ""; then
380 GNUSTEP_LOCAL_ROOT="$GNUSTEP_ROOT/Local"
382 if echo "$GNUSTEP_LOCAL_ROOT" | grep -q '[[ \\]]'
384 echo "found a backslash or space (illegal) in '$GNUSTEP_LOCAL_ROOT'"
385 echo "Please try again using --with-local-root= to specify a valid path."
386 if test "$MSWIND" = "yes"
388 echo "Please note that on windows you must use unix-style paths within"
389 echo "the make package even though gnustep programs built in the mingw32"
390 echo "environment use native paths throughout."
394 AC_MSG_RESULT($GNUSTEP_LOCAL_ROOT)
395 AC_SUBST(GNUSTEP_LOCAL_ROOT)
397 #--------------------------------------------------------------------
398 # Process --with-network-root
399 #--------------------------------------------------------------------
400 AC_MSG_CHECKING(for GNUSTEP_NETWORK_ROOT to use)
401 AC_ARG_WITH(network-root,[
403 Set the GNUSTEP_NETWORK_ROOT directory. Use this option if you
404 want to have the GNUSTEP_NETWORK_ROOT directory.
405 Example: --with-network-root=/usr/local/GNUstep/Network
407 GNUSTEP_NETWORK_ROOT="$withval",)
408 # By default we disable network root, by setting GNUSTEP_NETWORK_ROOT
409 # to be the same as GNUSTEP_LOCAL_ROOT. GNUSTEP_NETWORK_ROOT is very
410 # rarely used, and most users prefer simpler systems with shorter
411 # paths and shorter command lines. To turn on GNUSTEP_NETWORK_ROOT
412 # again, you can use the --with-network-root=xxx option; pass
413 # something like --with-network-root=/usr/GNUstep/Network on the
414 # configure command line.
415 if test "$GNUSTEP_NETWORK_ROOT" = "" -o "$GNUSTEP_NETWORK_ROOT" = "no"; then
416 GNUSTEP_NETWORK_ROOT="$GNUSTEP_LOCAL_ROOT"
418 if echo "$GNUSTEP_NETWORK_ROOT" | grep -q '[[ \\]]'
420 echo "found a backslash or space (illegal) in '$GNUSTEP_NETWORK_ROOT'"
421 echo "Please try again using --with-network-root= to specify a valid path."
422 if test "$MSWIND" = "yes"
424 echo "Please note that on windows you must use unix-style paths within"
425 echo "the make package even though gnustep programs built in the mingw32"
426 echo "environment use native paths throughout."
430 AC_MSG_RESULT($GNUSTEP_NETWORK_ROOT)
431 AC_SUBST(GNUSTEP_NETWORK_ROOT)
433 #--------------------------------------------------------------------
434 # Process --with-user-config-file
435 #--------------------------------------------------------------------
436 AC_MSG_CHECKING(for user config file to use)
437 AC_ARG_WITH(user-config-file,[
438 --with-user-config-file
439 Set the name of the user config file to use. This can be
440 relative to the user's home directory if it is a relative path,
441 or an absolute directory (the same for all users) if it is an
442 absolute path. Use '' if you want to disable user config files.
443 The default is .GNUstep.conf if not specified.
444 Example: --with-user-config-file=GNUstep/GNUstep.conf
446 GNUSTEP_USER_CONFIG_FILE="$withval",)
447 if test "$GNUSTEP_USER_CONFIG_FILE" = "" -o "$GNUSTEP_USER_CONFIG_FILE" = "no"; then
448 GNUSTEP_USER_CONFIG_FILE=".GNUstep.conf"
450 if echo "$GNUSTEP_USER_CONFIG_FILE" | grep -q '[[ \\]]'
452 echo "found a backslash or space (illegal) in '$GNUSTEP_USER_CONFIG_FILE'"
453 echo "Please try again using --with-user-config-file= to specify a value."
454 if test "$MSWIND" = "yes"
456 echo "Please note that on windows you must use unix-style paths within"
457 echo "the make package even though gnustep programs built in the mingw32"
458 echo "environment use native paths throughout."
462 AC_MSG_RESULT($GNUSTEP_NETWORK_ROOT)
463 AC_MSG_RESULT($GNUSTEP_USER_CONFIG_FILE)
464 AC_SUBST(GNUSTEP_USER_CONFIG_FILE)
466 #--------------------------------------------------------------------
467 # Process --with-user-dir
468 #--------------------------------------------------------------------
469 AC_MSG_CHECKING(for user dir to use)
470 AC_ARG_WITH(user-dir,[
472 Set the GNUSTEP_USER_DIR directory for all users. This can be
473 relative to the user's home directory if it is a relative path,
474 or an absolute directory (the same for all users) if it is an
475 absolute path. Use this option if you want to have the
476 GNUSTEP_USER_DIR directory in a non default place for all users.
477 The default is 'GNUstep'.
478 Example: --with-user-dir='gnustep'
480 GNUSTEP_USER_DIR="$withval",)
481 if test "$GNUSTEP_USER_DIR" = "" -o "$GNUSTEP_USER_DIR" = "no"; then
482 GNUSTEP_USER_DIR="GNUstep"
484 if echo "$GNUSTEP_USER_DIR" | grep -q '[[ \\]]'
486 echo "found a backslash or space (illegal) in '$GNUSTEP_USER_DIR'"
487 echo "Please try again using --with-user-dir= to specify a value."
488 if test "$MSWIND" = "yes"
490 echo "Please note that on windows you must use unix-style paths within"
491 echo "the make package even though gnustep programs built in the mingw32"
492 echo "environment use native paths throughout."
496 AC_MSG_RESULT($GNUSTEP_USER_DIR)
497 AC_SUBST(GNUSTEP_USER_DIR)
499 #--------------------------------------------------------------------
500 # Process --with-user-defaults-dir
501 #--------------------------------------------------------------------
502 AC_MSG_CHECKING(for user defaults dir to use)
503 AC_ARG_WITH(user-defaults-dir,[
504 --with-user-defaults-dir
505 Set the GNUstep user defaults directory for all users. This can be
506 relative to the user's home directory if it is a relative path,
507 or an absolute directory (the same for all users) if it is an
508 absolute path. Use this option if you want to have the
509 GNUSTEP_USER_DEFAULTS_DIR directory in a non default place for
510 all users. The default is 'GNUstep/Defaults'
511 Example: --with-user-defaults-dir='GNUstep/Library/Defaults'
513 GNUSTEP_USER_DEFAULTS_DIR="$withval",)
514 if test "$GNUSTEP_USER_DEFAULTS_DIR" = "" -o "$GNUSTEP_USER_DEFAULTS_DIR" = "no"; then
515 GNUSTEP_USER_DEFAULTS_DIR="GNUstep/Defaults"
517 if echo "$GNUSTEP_USER_DEFAULTS_DIR" | grep -q '[[ \\]]'
519 echo "found a backslash or space (illegal) in '$GNUSTEP_USER_DEFAULTS_DIR'"
520 echo "Please try again using --with-user-defaults-dir= to specify a value."
521 if test "$MSWIND" = "yes"
523 echo "Please note that on windows you must use unix-style paths within"
524 echo "the make package even though gnustep programs built in the mingw32"
525 echo "environment use native paths throughout."
529 AC_MSG_RESULT($GNUSTEP_USER_DEFAULTS_DIR)
530 AC_SUBST(GNUSTEP_USER_DEFAULTS_DIR)
532 #--------------------------------------------------------------------
533 # Setting up GNUSTEP_MAKEFILES
534 #--------------------------------------------------------------------
536 # Please note that we do an explicit check in preparation for the (not
537 # so far) future when this directory (like any other GNUstep
538 # directory, eg, Applications or Tools or Libraries) will be
539 # relocatable to anywhere you like.
541 AC_MSG_CHECKING(for GNUSTEP_MAKEFILES to use)
542 GNUSTEP_MAKEFILES="$GNUSTEP_SYSTEM_ROOT/Library/Makefiles"
543 AC_SUBST(GNUSTEP_MAKEFILES)
544 AC_MSG_RESULT($GNUSTEP_MAKEFILES)
546 #--------------------------------------------------------------------
547 # Setting up the install-sh script
548 #--------------------------------------------------------------------
550 # HOST_INSTALL is the name of the install program in config.make so set it up
551 # to point to the install-sh script in the GNUstep tree if no system install is
553 AC_SUBST(HOST_INSTALL)
554 if test "$INSTALL" = "$ac_install_sh"; then
555 HOST_INSTALL="$GNUSTEP_MAKEFILES/$INSTALL"
557 HOST_INSTALL="$INSTALL"
560 #--------------------------------------------------------------------
561 # Is the system flattened?
562 #--------------------------------------------------------------------
563 AC_MSG_CHECKING(for flattened directory structure)
564 AC_ARG_ENABLE(flattened, [
566 Disable flattened directory structure. Use this option if you want
567 to have support for multiple library combos and fat binaries. A
568 library combo specifies the Objective-C frameworks to use to compile
569 a program, so having multiple library combos is only useful if you
570 have (or plan to have) multiple OpenStep-like Objective-C frameworks
571 installed on your machine, for example both the Apple Cocoa Objective-C
572 frameworks and the GNUstep frameworks. Fat binaries allow you to
573 have multiple versions for different CPUs and Operating Systems.
574 Please note that using the fat directory structure will not blend
575 easily with native filesystems and so if you want the non-flattened
576 directory structure you probably want to install GNUstep using its
577 own default filesystem layout. To switch between different
578 library-combos, you also need to source GNUstep.sh after
579 setting the LIBRARY_COMBO environment variable. Please refer to
580 the documentation for more information on library-combos and fat
583 ac_cv_flattened=$enableval,
584 ac_cv_flattened="undefined")
586 if test "$ac_cv_flattened" = "no"; then
589 GNUSTEP_FLATTENED=yes;
591 AC_SUBST(GNUSTEP_FLATTENED)
593 if test "$GNUSTEP_FLATTENED" = "yes"; then
600 #--------------------------------------------------------------------
601 # Is the system multi-platform?
602 #--------------------------------------------------------------------
604 # Multi-platform means that GNUstep.sh will determine the host
605 # platform (by running config.guess) each time that it is sourced.
606 # This is good if you are sharing your GNUstep.sh across your network
607 # (for example, mounting the makefiles via NFS), but it requires you
608 # to be able to run config.guess on your machine(s), which usually
609 # requires a development environment (compiler, libc etc).
611 # The default instead is not using multi-platform, which means the
612 # local host os, cpu and version is hardcoded in GNUstep.sh. This
613 # works nicely for a single machine using this gnustep-make
614 # installation, and it works even if you don't have development
615 # packages (gcc, binutils, libc-dev etc) installed. We had to make
616 # this the default after end-users (with no development packages
617 # installed) complained that binary packages wouldn't work (and the
618 # reason turned out to be that GNUstep.sh was running config.guess
619 # which was returning the wrong platform because the development
620 # tools needed/used to determine the platform were not available).
622 # Unless you know what you are doing, stick with the default, which is
623 # also much faster when sourcing GNUstep.sh.
625 AC_ARG_ENABLE(multi-platform, [
626 --enable-multi-platform
627 Enable run-time multi-platform support. If this option is enabled,
628 then every time GNUstep.sh is run it will determine/guess the type
629 of local host machine instead of using the hardcoded value. Use
630 this together with --disable-flattened if you have a single GNUstep
631 installation with fat binaries that is being shared over the network
632 by a variety of machines with different hardware and o/s.
634 ac_cv_multi_platform=$enableval,
635 ac_cv_multi_platform="undefined")
637 if test "$ac_cv_multi_platform" = "yes"; then
638 GNUSTEP_MULTI_PLATFORM=yes;
640 GNUSTEP_MULTI_PLATFORM=;
642 AC_SUBST(GNUSTEP_MULTI_PLATFORM)
644 #--------------------------------------------------------------------
645 # Build backend bundles (on by default)
646 #--------------------------------------------------------------------
647 AC_ARG_ENABLE(backend-bundle, [
648 --disable-backend-bundle
649 Compile GUI backend as a library. Use this option if the default
650 compilation of the GUI backend as a bundle (loadable module) is
651 not supported / does not work on your machine.
653 ac_cv_backend=$enableval,
656 if test "$ac_cv_backend" = "yes"; then
661 AC_SUBST(BACKEND_BUNDLE)
663 #--------------------------------------------------------------------
664 # Miscellaneous flags and setup
665 #--------------------------------------------------------------------
667 # Set location of GNUstep dirs for later use
668 if test "$GNUSTEP_FLATTENED" = yes; then
669 GNUSTEP_LDIR="$GNUSTEP_SYSTEM_ROOT/Library/Libraries"
670 GNUSTEP_HDIR="$GNUSTEP_SYSTEM_ROOT/Library/Headers"
672 clean_target_os=`$srcdir/clean_os.sh $target_os`
673 clean_target_cpu=`$srcdir/clean_cpu.sh $target_cpu`
674 obj_dir="$clean_target_cpu/$clean_target_os"
675 GNUSTEP_LDIR="$GNUSTEP_SYSTEM_ROOT/Library/Libraries/$obj_dir"
676 GNUSTEP_HDIR="$GNUSTEP_SYSTEM_ROOT/Library/Headers/${ac_cv_library_combo}"
679 # Check to see if the libobjc library is in our GNUSTEP_SYSTEM_ROOT.
680 # If so, there are probably other libraries that we want there also, so
681 # leave the proper includes in CPPFLAGS and LDFLAGS
682 AC_MSG_CHECKING(for custom shared objc library)
683 AC_CACHE_VAL(gs_cv_objc_libdir,
685 gs_cv_objc_libdir=NONE
686 if test -f "$GNUSTEP_HDIR/objc/objc.h"; then
687 if test -f "$GNUSTEP_LDIR/libobjc.a" -o -f "$GNUSTEP_LDIR/libobjc.so" -o -f "$GNUSTEP_LDIR/libobjc.dll.a" -o -f "$GNUSTEP_LDIR/libobjc-gnu.dylib"; then
688 gs_cv_objc_libdir="$GNUSTEP_LDIR"
690 gs_cv_objc_libdir=NONE
693 #gcc_shared_libobjc=`gcc -print-file-name=libobjc.so`
694 #if test -f "$gcc_shared_libobjc"; then
695 # gs_cv_objc_libdir=`dirname $gcc_shared_libobjc`
698 AC_MSG_RESULT($gs_cv_objc_libdir)
700 # The following are needed to compile the test programs
701 if test "$gs_cv_objc_libdir" = "$GNUSTEP_LDIR"; then
702 if test "$GNUSTEP_FLATTENED" = yes; then
703 OBJC_CPPFLAGS="$CPPFLAGS $INCLUDES -I$GNUSTEP_SYSTEM_ROOT/Library/Headers"
705 OBJC_CPPFLAGS="$CPPFLAGS $INCLUDES -I$GNUSTEP_SYSTEM_ROOT/Library/Headers/${ac_cv_library_combo}"
707 OBJC_LDFLAGS="$LDFLAGS $LIB_DIR -L$gs_cv_objc_libdir"
710 # And the following to execute them
711 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gs_cv_objc_libdir"
712 export LD_LIBRARY_PATH
714 #--------------------------------------------------------------------
715 # Miscellaneous headers (only used for compiling which_lib.c and user_home.c)
716 #--------------------------------------------------------------------
718 AC_CHECK_HEADERS(sys/param.h sys/file.h dir.h string.h stdlib.h sys/types.h dnl
719 fcntl.h limits.h utime.h sys/stat.h pwd.h unistd.h ctype.h)
720 AC_CHECK_FUNCS(getpwnam getpwuid geteuid getlogin strchr)
722 #--------------------------------------------------------------------
723 # Check if libobjc was compiled with thread support.
724 #--------------------------------------------------------------------
726 AC_ARG_WITH(thread-lib,[
728 Specify alternate thread library. Use this flag if configure can
729 not properly determine the thread library used by your libobjc.
731 OBJC_THREAD=$withval,
734 if test "$OBJC_THREAD" = no; then
739 AC_MSG_CHECKING(whether objc has thread support)
740 saved_CFLAGS="$CFLAGS"
742 CFLAGS="$CFLAGS -x objective-c -I$srcdir $OBJC_CPPFLAGS $OBJC_LDFLAGS"
743 if test "$OBJC_RUNTIME_LIB" = "gnu"; then
744 CFLAGS="$CFLAGS -fgnu-runtime"
746 if test "$OBJC_RUNTIME_LIB" = "nx"; then
747 CFLAGS="$CFLAGS -DNeXT_RUNTIME"
749 if test "$OBJC_RUNTIME_LIB" = "apple"; then
750 CFLAGS="$CFLAGS -DNeXT_RUNTIME"
752 if test "$OBJC_THREAD" != ""; then
753 LIBS="-lobjc $LIBS $OBJC_THREAD"
754 AC_TRY_RUN([#include "config_thread.m"],
755 objc_threaded="$OBJC_THREAD",
756 objc_threaded="", objc_threaded="")
757 elif test "$host_os" = linux-gnu; then
758 LIBS="-lobjc -lpthread"
759 AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpthread",
760 objc_threaded="", objc_threaded="-lpthread")
761 elif test "`echo $host_os|sed 's/[[0-9]].*//'|sed s/elf//`" = freebsd; then
762 LIBS="-pthread -lobjc"
763 AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-pthread",
764 objc_threaded="", objc_threaded="-pthread")
765 if test x"$objc_threaded" = x""; then
766 LIBS="-lpthread -lobjc"
767 AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpthread",
768 objc_threaded="", objc_threaded="-lpthread")
770 if test x"$objc_threaded" = x""; then
771 LIBS="-lobjc -lpcthread"
772 AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpcthread",
773 objc_threaded="", objc_threaded="-lpcthread")
775 elif test "$MINGW32" = yes; then
776 # Mingw doesn't need anything extra for threads
778 AC_TRY_RUN([#include "config_thread.m"],
779 objc_threaded="works",
780 objc_threaded="", objc_threaded="works")
783 AC_TRY_RUN([#include "config_thread.m"],
784 objc_threaded="works",
785 objc_threaded="", objc_threaded="")
786 if test x"$objc_threaded" = x""; then
787 LIBS="-lobjc $saved_LIBS -lpthread "
788 AC_TRY_RUN([#include "config_thread.m"],
789 objc_threaded="-lpthread",
790 objc_threaded="", objc_threaded="")
792 if test x"$objc_threaded" = x""; then
793 # Solaris, OpenBSD/sparc
794 LIBS="-lobjc $saved_LIBS -lpthread -lposix4"
795 AC_TRY_RUN([#include "config_thread.m"],
796 objc_threaded="-lpthread -lposix4",
797 objc_threaded="", objc_threaded="")
799 if test x"$objc_threaded" = x""; then
800 LIBS="-lobjc $saved_LIBS -lthread "
801 AC_TRY_RUN([#include "config_thread.m"],
802 objc_threaded="-lthread",
803 objc_threaded="", objc_threaded="")
806 if test x"$objc_threaded" = x""; then
809 if test x"$objc_threaded" = x"works"; then
812 AC_MSG_RESULT(yes: $objc_threaded)
814 ac_cv_objc_threaded="$objc_threaded"
815 AC_SUBST(objc_threaded)
816 AC_SUBST(ac_cv_objc_threaded)
818 # Do not restore LIBS and CFLAGS yet as we need to test if the
819 # compiler supports native exceptions.
821 #--------------------------------------------------------------------
822 # Check if GCC supports -fobjc-exceptions, and if so, turn it on!
823 #--------------------------------------------------------------------
825 AC_ARG_ENABLE(native-objc-exceptions, [
826 --enable-native-objc-exceptions
827 Use native Objective-C exceptions. Use this option if you want
828 to use the native Objective-C exception support (@try/@catch/@finally)
829 provided by newer GCC compilers.
831 USE_OBJC_EXCEPTIONS=$enableval,
832 USE_OBJC_EXCEPTIONS=no)
834 AC_MSG_CHECKING(whether we should use native ObjC exceptions)
835 if test x"$USE_OBJC_EXCEPTIONS" = x"yes"; then
836 # What we want to do: set USE_OBJC_EXCEPTIONS to yes if we can compile
837 # something with @try/@catch/@finally in it.
838 if test ! ${GCC} = "yes" ; then
839 USE_OBJC_EXCEPTIONS=no
840 AC_MSG_RESULT(no: compiler isn't gcc)
842 CFLAGS="$CFLAGS -fobjc-exceptions"
845 #include <objc/Object.h>
847 int main(int argc, char **argv)
862 ]], USE_OBJC_EXCEPTIONS=yes, USE_OBJC_EXCEPTIONS=no)
863 AC_MSG_RESULT($USE_OBJC_EXCEPTIONS)
865 if test x$USE_OBJC_EXCEPTIONS = xno; then
866 AC_MSG_NOTICE([Native objective-c exceptions were requested, but the compiler])
867 AC_MSG_NOTICE([doesn't support them.])
868 AC_MSG_ERROR([compiler doesn't support native objective-c exceptions])
871 AC_MSG_RESULT(not requested by user)
874 AC_SUBST(USE_OBJC_EXCEPTIONS)
876 # Restore LIBS and CFLAGS - we are going to compile C code in the next
879 CFLAGS="$saved_CFLAGS"
881 #--------------------------------------------------------------------
882 # Check if compiler supports -MMD -MP to generate %.d files ...
883 #--------------------------------------------------------------------
885 AC_MSG_CHECKING(if the compiler supports autodependencies)
887 # What we want to do: set AUTO_DEPENDENCIES to yes if gcc => 3.x
889 if test ! ${GCC} = "yes" ; then
891 PRECOMPILED_HEADERS=""
892 AC_MSG_RESULT(no: it's not gcc)
894 # Running gcc -dumpversion we get something like 2.95.4 or
895 # egcs-2.91.66 or 3.0.2 or 3.1 20011211
896 # We want to discard anything but the major number.
897 # Explanation of the regexp -
898 # \(^[^0-9]*\) matches beginning of line and following non numeric chars
899 # \([0-9][0-9]*\) matches 1 or more numeric chars (this is the 2^nd
901 # \([^0-9].*\) matches a non numeric char followed by anything
902 # /\2/ replace the whole lot with the 2^nd subpattern
903 gs_cv_gcc_major_version=`${CC} -dumpversion | sed "s/\([[^0-9]]*\)\([[0-9]][[0-9]]*\)\([[^0-9]].*\)/\2/"`;
905 if test "${gs_cv_gcc_major_version}" -ge "3" ; then
906 AUTO_DEPENDENCIES=yes
907 AC_MSG_RESULT(yes: gcc major version is ${gs_cv_gcc_major_version})
910 PRECOMPILED_HEADERS=""
911 AC_MSG_RESULT(no: gcc major version is ${gs_cv_gcc_major_version})
915 AC_SUBST(AUTO_DEPENDENCIES)
916 AC_SUBST(PRECOMPILED_HEADERS)
921 #--------------------------------------------------------------------
922 # Shall we strip makefiles upon installation ?
923 #--------------------------------------------------------------------
925 # Stripping makefiles removes comments and newlines from them. The
926 # resulting stripped makefiles execute around 5% faster on average.
927 # Too little for it to be worth for the common user who's more
928 # interested in the comments :-) so it's disabled by default.
929 AC_MSG_CHECKING(if we should strip makefiles after installation)
930 AC_ARG_ENABLE(strip-makefiles, [
931 --enable-strip-makefiles
932 Enable stripping system makefiles after installation. This will
933 speed up gnustep-make by about 5% (average), but will remove all
934 comments from the installed makefiles. Those comments are quite
935 useful if you are trying to find some information on how gnustep-make
936 works (eg, if you're trying to locate a bug), and the performance
937 gain is quite small, so you probably don't want to strip makefiles.
939 ac_cv_strip_makefiles=$enableval,
940 ac_cv_strip_makefiles="undefined")
942 if test "$ac_cv_strip_makefiles" = "yes"; then
943 GNUSTEP_STRIP_MAKEFILES=strip;
946 GNUSTEP_STRIP_MAKEFILES=;
949 AC_SUBST(GNUSTEP_STRIP_MAKEFILES)
951 #--------------------------------------------------------------------
952 # Disable updating the obsolete directory structure
953 #--------------------------------------------------------------------
955 AC_ARG_ENABLE(move-obsolete,[
956 --disable-move-obsolete
957 Disable moving obsolete dir structure. This option will be
958 removed SOON as the dir structure was change more than 2 years ago! :-)
960 gs_move_obsolete=$enableval,
961 gs_move_obsolete=yes)
963 if test "$gs_move_obsolete" = "yes"; then
964 GNUSTEP_MOVE_OBSOLETE=move_obsolete;
966 GNUSTEP_MOVE_OBSOLETE=
967 AC_MSG_NOTICE(Old GNUstep directories will not be moved)
969 AC_SUBST(GNUSTEP_MOVE_OBSOLETE)
971 #--------------------------------------------------------------------
972 # Enable/disable precompiled headers
973 #--------------------------------------------------------------------
974 # TODO: replace with / add a check whether PCH works with the
977 AC_MSG_CHECKING(if we should enable precompiled headers (pch))
979 [--enable-pch Enable precompiled headers],
980 gs_enable_pch=$enableval,
983 if test "$gs_enable_pch" = "yes"; then
984 PRECOMPILED_HEADERS=yes
990 AC_SUBST(PRECOMPILED_HEADERS)
992 #--------------------------------------------------------------------
994 #--------------------------------------------------------------------
995 AC_MSG_CHECKING(for the version of gnustep-make we are compiling)
997 AC_MSG_RESULT($GNUSTEP_MAKE_VERSION)
998 AC_SUBST(GNUSTEP_MAKE_VERSION)
999 AC_SUBST(GNUSTEP_MAKE_MAJOR_VERSION)
1000 AC_SUBST(GNUSTEP_MAKE_MINOR_VERSION)
1001 AC_SUBST(GNUSTEP_MAKE_SUBMINOR_VERSION)
1003 #-------------------------------------------------------------------
1004 # Record the 'clean' target_os, target_cpu and target_vendor
1005 #-------------------------------------------------------------------
1006 # This is just for efficiency, so that core/make/GNUmakefile does not
1007 # have to compute clean_target_os from target_os (and similar) by
1008 # running shell scripts each time you 'make' something inside
1009 # gnustep-make. We basically compute them once now, and cache them
1010 # forever. It is also used by GNUstep.sh when multi-platform is
1012 clean_target_os=`$srcdir/clean_os.sh $target_os`
1013 clean_target_cpu=`$srcdir/clean_cpu.sh $target_cpu`
1014 clean_target_vendor=`$srcdir/clean_cpu.sh $target_vendor`
1015 AC_SUBST(clean_target_os)
1016 AC_SUBST(clean_target_cpu)
1017 AC_SUBST(clean_target_vendor)
1020 #--------------------------------------------------------------------
1021 # Produce the output files
1022 #--------------------------------------------------------------------
1023 AC_CONFIG_FILES([config.make openapp debugapp opentool
1024 executable.template GNUmakefile GNUstep.conf GNUstep.sh GNUstep.csh fixpath.sh
1026 AC_CONFIG_COMMANDS([default],
1027 [[chmod a+x openapp debugapp opentool fixpath.sh executable.template]],