]> err.no Git - sope/blob - gnustep-make/configure.ac
added --enable-pch to configure
[sope] / gnustep-make / configure.ac
1 #
2 #   configure.ac
3 #
4 #   Copyright (C) 1997-2004 Free Software Foundation, Inc.
5 #
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>
10 #
11 #   This file is part of the GNUstep Makefile Package.
12 #
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.
17 #   
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.
22 AC_INIT
23 AC_PREREQ(2.57)
24 AC_CONFIG_SRCDIR([application.make])
25 AC_CONFIG_HEADER(config.h)
26
27 #--------------------------------------------------------------------
28 # Setup the library combination
29 #--------------------------------------------------------------------
30 targetArgument=${target}
31 AC_PROG_CC
32 AC_PROG_CPP
33 AC_CANONICAL_TARGET([])
34
35 AC_MSG_CHECKING(for library combo)
36 AC_ARG_WITH(library-combo,[
37 --with-library-combo            Define the default library combination
38 ],
39 ac_cv_library_combo=$withval,
40 ac_cv_library_combo=$ac_cv_library_combo
41 )
42
43 if test "$ac_cv_library_combo" = ""; then
44   case "$host_os" in
45     darwin*)   ac_cv_library_combo=apple-apple-apple ;;
46     nextstep4) ac_cv_library_combo=nx-nx-nx          ;;
47     openstep4) ac_cv_library_combo=nx-nx-nx          ;;
48     *)         ac_cv_library_combo=gnu-gnu-gnu       ;;
49   esac
50 fi
51
52 case "$ac_cv_library_combo" in
53   apple) ac_cv_library_combo=apple-apple-apple ;;
54   gnu)   ac_cv_library_combo=gnu-gnu-gnu ;;
55   nx)    ac_cv_library_combo=nx-nx-nx ;;
56 esac
57
58 AC_SUBST(ac_cv_library_combo)
59 AC_MSG_RESULT($ac_cv_library_combo)
60
61 OBJC_RUNTIME_LIB=`echo $ac_cv_library_combo | awk -F- '{print $1}'`
62
63 #--------------------------------------------------------------------
64 # Check if we are using Apple cc
65 #--------------------------------------------------------------------
66 cc_cppprecomp=0
67 cc_byndle=0
68 AC_MSG_CHECKING([for apple compiler flags])
69 cc_cppprecomp=`${CC} -no-cpp-precomp 2>&1 | grep -c "unrecognized"`
70 cc_bundle=`${CC} -bundle 2>&1 | grep -c "couldn"`
71 # 0 means we have the flag
72 if test $cc_cppprecomp = 0; then
73   cc_cppprecomp=yes
74 else
75   cc_cppprecomp=no
76 fi
77 if test $cc_bundle = 0; then
78   cc_bundle=yes
79 else
80   cc_bundle=no
81 fi
82 AC_MSG_RESULT($cc_bundle)
83 AC_SUBST(cc_cppprecomp)
84 AC_SUBST(cc_bundle)
85
86 #--------------------------------------------------------------------
87 # specific target_os options
88 #--------------------------------------------------------------------
89 case "$target_os" in
90   freebsd* | openbsd* ) 
91                 INCLUDES="$INCLUDES -I/usr/local/include"
92                 LIB_DIR="$LIB_DIR -L/usr/local/lib";;
93   netbsd*)      INCLUDES="$INCLUDES -I/usr/pkg/include"
94                 LIB_DIR="$LIB_DIR -Wl,-R/usr/pkg/lib -L/usr/pkg/lib";;
95 esac
96
97 #--------------------------------------------------------------------
98 # Determine the host, build, and target systems
99 #--------------------------------------------------------------------
100 case $host_os in
101   *cygwin*  ) CYGWIN=yes;;
102   *mingw32* ) MINGW32=yes;;
103           * ) MINGW32=no
104               CYGWIN=no;;
105 esac
106 AC_SUBST(CYGWIN)
107
108 AC_EXEEXT
109 AC_OBJEXT
110 if test "$MINGW32" = yes; then
111   echo "hosted on mingw32 .."
112   export INSTALL=install
113   export SHELL=sh
114   export CC=${CC:-gcc}
115   export AR=${AR:-ar}
116   export RANLIB=${RANLIB:-ranlib}
117   export DLLTOOL=${DLLTOOL:-dlltool}
118 elif test "$CYGWIN" = yes; then
119   echo "hosted on cygwin .."
120   export CC=${CC:-gcc}
121   export AR=${AR:-ar}
122   export RANLIB=${RANLIB:-ranlib}
123   export DLLTOOL=${DLLTOOL:-dlltool}
124 fi
125
126 #--------------------------------------------------------------------
127 # Find the binary and compile tools
128 #--------------------------------------------------------------------
129 if test "x$target" != "x$host"; then
130   echo "cross compiling from $host to $target .."
131   cross_compiling="yes"
132   AC_CHECK_PROG(CC,      "${targetArgument}-gcc",     dnl
133                          "${targetArgument}-gcc",     gcc)
134   AC_CHECK_PROG(RANLIB,  "${targetArgument}-ranlib",  dnl
135                          "${targetArgument}-ranlib",  ranlib)
136   AC_CHECK_PROG(AR,      "${targetArgument}-ar",      dnl
137                          "${targetArgument}-ar",      ar)
138   AC_CHECK_PROG(DLLTOOL, "${targetArgument}-dlltool", dnl
139                          "${targetArgument}-dlltool", dlltool)
140 else
141   AC_CHECK_PROG(AR,      ar,      ar)
142   AC_CHECK_PROG(DLLTOOL, dlltool, dlltool)
143   AC_PROG_RANLIB
144 fi
145
146 AC_PROG_INSTALL
147 AC_PROG_LN_S([])
148
149 AC_CHECK_PROGS(TAR, gnutar gtar, tar)
150 AC_ARG_WITH(tar,
151 [--with-tar                      Set the name of the tar program to use],
152   TAR="$withval",)
153
154 AC_CHECK_PROG(CHOWN, chown, chown, none)
155 if test "$MINGW32" = no; then
156   if test "$CHOWN" = "none"; then
157     AC_MSG_ERROR("Could not find chown.");
158   fi
159 fi
160
161 #-------------------------------------------------------------------
162 # GNUstep specific options follow
163 #-------------------------------------------------------------------
164
165 #--------------------------------------------------------------------
166 # The GNUstep root directory.
167 # The user should have the GNUSTEP_SYSTEM_ROOT environment variable
168 # defined, but if not then we have a global default.
169 # Also test for the C: directory, which means we're on Windows
170 #--------------------------------------------------------------------
171 AC_MSG_CHECKING(for GNUSTEP_SYSTEM_ROOT to use)
172 AC_PREFIX_DEFAULT(`if test "x$GNUSTEP_SYSTEM_ROOT" = "x"; then 
173   if test -d C: ; then
174     echo C:/GNUstep;
175   else
176     echo /usr/GNUstep ;
177   fi
178 else
179   echo "$GNUSTEP_SYSTEM_ROOT" ;
180 fi`)
181 if test "x$prefix" = "xNONE"; then
182   prefix="$ac_default_prefix" ;
183 fi
184 AC_ARG_WITH(system-root, 
185 [--without-system-root          Don't use separate system root directory], 
186   ac_cv_system_root="$withval",  
187   ac_cv_system_root=yes)
188
189 GNUSTEP_ROOT="$prefix"
190 root_prefix='${prefix}'
191 if test $ac_cv_system_root = yes; then
192   if test "x`basename $prefix`" = xSystem; then
193     GNUSTEP_ROOT=`dirname $prefix`
194   else
195     if test "x$prefix" = "x/"; then
196       prefix=/System
197     else
198       prefix="$prefix/System"
199     fi
200   fi
201   root_prefix='${prefix}/..'
202 fi
203 AC_SUBST(GNUSTEP_ROOT)
204 AC_SUBST(root_prefix)
205 AC_MSG_RESULT($prefix)
206
207 # Makefiles directory location is in a bit of flux now. To keep the
208 # Makefiles dir in the previous location, reset this variable to
209 # 'Makefiles' and regenerate configure. Note this doesn't change all
210 # occurances.
211 MAKEFILES_SUFFIX=Library/Makefiles
212 AC_SUBST(MAKEFILES_SUFFIX)
213
214 # HOST_INSTALL is the name of the install program in config.make so set it up
215 # to point to the install-sh script in the GNUstep tree if no system install is
216 # found.
217 AC_SUBST(HOST_INSTALL)
218 if test "$INSTALL" = "$ac_install_sh"; then
219   HOST_INSTALL="$prefix/$MAKEFILES_SUFFIX/$INSTALL"
220 else
221   HOST_INSTALL="$INSTALL"
222 fi
223
224 #--------------------------------------------------------------------
225 # Process --with-defaults-root, --with-user-root,
226 # --with-local-root and --with-network-root
227 #--------------------------------------------------------------------
228 AC_MSG_CHECKING(for GNUSTEP_LOCAL_ROOT to use)
229 AC_ARG_WITH(local-root,
230 [--with-local-root
231     Set the GNUSTEP_LOCAL_ROOT directory.  Use this option if you want 
232 to have the GNUSTEP_LOCAL_ROOT directory in a non-standard place.  Example:
233 --with-local-root=/usr/local/GNUstep/Local
234 ],
235 GNUSTEP_LOCAL_ROOT="$withval",
236 GNUSTEP_LOCAL_ROOT="$GNUSTEP_ROOT/Local"
237 )
238 AC_MSG_RESULT($GNUSTEP_LOCAL_ROOT)
239
240 AC_MSG_CHECKING(for GNUSTEP_NETWORK_ROOT to use)
241 AC_ARG_WITH(network-root,
242 [--with-network-root
243     Set the GNUSTEP_NETWORK_ROOT directory.  Use this option if you want 
244 to have the GNUSTEP_NETWORK_ROOT directory.  Example:
245 --with-network-root=/usr/local/GNUstep/Network
246 ],
247 GNUSTEP_NETWORK_ROOT="$withval",
248 # By default we disable network root, by setting GNUSTEP_NETWORK_ROOT
249 # to be the same as GNUSTEP_LOCAL_ROOT.  GNUSTEP_NETWORK_ROOT is very
250 # rarely used, and most users prefer simpler systems with shorter
251 # paths and shorter command lines.  To turn on GNUSTEP_NETWORK_ROOT
252 # again, you can use the --with-network-root=xxx option; pass
253 # something like --with-network-root=/usr/GNUstep/Network on the
254 # configure command line.
255 GNUSTEP_NETWORK_ROOT="$GNUSTEP_LOCAL_ROOT"
256 )
257 AC_MSG_RESULT($GNUSTEP_NETWORK_ROOT)
258
259 AC_SUBST(GNUSTEP_LOCAL_ROOT)
260 AC_SUBST(GNUSTEP_NETWORK_ROOT)
261
262 AC_MSG_CHECKING(for GNUSTEP_USER_ROOT to use)
263 AC_ARG_WITH(user-root,
264 [--with-user-root
265     Set the GNUSTEP_USER_ROOT directory for all users.  '~' is allowed
266     at the beginning to mean the user's home directory.  Use this
267     option if you want to have the GNUSTEP_USER_ROOT directory in a non
268     default place for all users.
269     Example: --with-user-root='~/gnustep'
270 ],
271 GNUSTEP_USER_ROOT="$withval",
272 # The default is to have user roots in ~/GNUstep
273 GNUSTEP_USER_ROOT="~/GNUstep"
274 )
275 AC_MSG_RESULT($GNUSTEP_USER_ROOT)
276 AC_SUBST(GNUSTEP_USER_ROOT)
277
278 #--------------------------------------------------------------------
279 # Is the system flattened?
280 #--------------------------------------------------------------------
281 AC_MSG_CHECKING(for flattened directory structure)
282 AC_ARG_ENABLE(flattened, 
283 [--disable-flattened            Disable flattened directory structure], 
284   ac_cv_flattened=$enableval,
285   ac_cv_flattened="undefined")
286
287 if test "$ac_cv_flattened" = "no"; then
288   GNUSTEP_FLATTENED=;
289 else
290   GNUSTEP_FLATTENED=yes;
291 fi
292 AC_SUBST(GNUSTEP_FLATTENED)
293
294 if test "$GNUSTEP_FLATTENED" = "yes"; then
295   AC_MSG_RESULT(yes);
296 else
297   AC_MSG_RESULT(no);
298 fi
299
300
301 #--------------------------------------------------------------------
302 # Is the system multi-platform?
303 #--------------------------------------------------------------------
304 #
305 # Multi-platform means that GNUstep.sh will determine the host
306 # platform (by running config.guess) each time that it is sourced.
307 # This is good if you are sharing your GNUstep.sh across your network
308 # (for example, mounting the makefiles via NFS), but it requires you
309 # to be able to run config.guess on your machine(s), which usually
310 # requires a development environment (compiler, libc etc).
311 #
312 # The default instead is not using multi-platform, which means the
313 # local host os, cpu and version is hardcoded in GNUstep.sh.  This
314 # works nicely for a single machine using this gnustep-make
315 # installation, and it works even if you don't have development
316 # packages (gcc, binutils, libc-dev etc) installed.  We had to make
317 # this the default after end-users (with no development packages
318 # installed) complained that binary packages wouldn't work (and the
319 # reason turned out to be that GNUstep.sh was running config.guess
320 # which was returning the wrong platform because the development
321 # tools needed/used to determine the platform were not available).
322 #
323 # Unless you know what you are doing, stick with the default, which is
324 # also much faster when sourcing GNUstep.sh.
325 #
326 AC_ARG_ENABLE(multi-platform, 
327 [--enable-multi-platform                Use run time multi-platform support], 
328   ac_cv_multi_platform=$enableval,
329   ac_cv_multi_platform="undefined")
330
331 if test "$ac_cv_multi_platform" = "yes"; then
332   GNUSTEP_MULTI_PLATFORM=yes;
333 else
334   GNUSTEP_MULTI_PLATFORM=;
335 fi
336 AC_SUBST(GNUSTEP_MULTI_PLATFORM)
337
338 #--------------------------------------------------------------------
339 # Build backend bundles (on by default)
340 #--------------------------------------------------------------------
341 AC_ARG_ENABLE(backend-bundle, [
342 --disable-backend-bundle        Compile gui backend as a library], 
343   ac_cv_backend=$enableval,  
344   ac_cv_backend="yes")
345
346 if test "$ac_cv_backend" = "yes"; then
347   BACKEND_BUNDLE=yes;
348 else
349   BACKEND_BUNDLE=;
350 fi
351 AC_SUBST(BACKEND_BUNDLE)
352
353 #--------------------------------------------------------------------
354 # Miscellaneous flags and setup
355 #--------------------------------------------------------------------
356 # Strip '-g' off of CFLAGS, since debug=yes adds that anyway
357 CFLAGS=`echo $CFLAGS | sed -e 's/-g //'`
358
359 # Set location of GNUstep dirs for later use
360 if test "$GNUSTEP_FLATTENED" = yes; then
361   GNUSTEP_LDIR="$prefix/Library/Libraries"
362   GNUSTEP_HDIR="$prefix/Library/Headers"
363 else
364   clean_target_os=`$srcdir/clean_os.sh $target_os`
365   clean_target_cpu=`$srcdir/clean_cpu.sh $target_cpu`
366   obj_dir="$clean_target_cpu/$clean_target_os"
367   GNUSTEP_LDIR="$prefix/Library/Libraries/$obj_dir"
368   GNUSTEP_HDIR="$prefix/Library/Headers/${ac_cv_library_combo}"
369 fi
370
371 # Check to see if the libobjc library is in our GNUSTEP_SYSTEM_ROOT.
372 # If so, there are probably other libraries that we want there also, so
373 # leave the proper includes in CPPFLAGS and LDFLAGS
374 AC_MSG_CHECKING(for custom shared objc library)
375 AC_CACHE_VAL(gs_cv_objc_libdir,
376 [dnl
377 gs_cv_objc_libdir=NONE
378 if test -f "$GNUSTEP_HDIR/objc/objc.h"; then
379   if test -f "$GNUSTEP_LDIR/libobjc.a" -o -f "$GNUSTEP_LDIR/libobjc.so" -o -f "$GNUSTEP_LDIR/libobjc.dll.a"; then
380     gs_cv_objc_libdir="$GNUSTEP_LDIR"
381   else
382     gs_cv_objc_libdir=NONE
383   fi
384 fi
385 #gcc_shared_libobjc=`gcc -print-file-name=libobjc.so`
386 #if test -f "$gcc_shared_libobjc"; then
387 #  gs_cv_objc_libdir=`dirname $gcc_shared_libobjc`
388 #fi
389 ])
390 AC_MSG_RESULT($gs_cv_objc_libdir)
391
392 # The following are needed to compile the test programs
393 if test "$gs_cv_objc_libdir" = "$GNUSTEP_LDIR"; then
394   if test "$GNUSTEP_FLATTENED" = yes; then
395     OBJC_CPPFLAGS="$CPPFLAGS $INCLUDES -I$prefix/Library/Headers"
396   else
397     OBJC_CPPFLAGS="$CPPFLAGS $INCLUDES -I$prefix/Library/Headers/${ac_cv_library_combo}"
398   fi
399   OBJC_LDFLAGS="$LDFLAGS $LIB_DIR -L$gs_cv_objc_libdir"
400 fi
401
402 # And the following to execute them
403 LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gs_cv_objc_libdir"
404 export LD_LIBRARY_PATH
405
406 #--------------------------------------------------------------------
407 # Miscellaneous headers (only used for compiling which_lib.c and user_home.c)
408 #--------------------------------------------------------------------
409 AC_HEADER_DIRENT
410 AC_CHECK_HEADERS(sys/param.h sys/file.h dir.h string.h stdlib.h sys/types.h dnl
411                 fcntl.h limits.h utime.h sys/stat.h pwd.h unistd.h)
412 AC_CHECK_FUNCS(getpwnam getpwuid geteuid getlogin strchr)
413
414 #--------------------------------------------------------------------
415 # Check if libobjc was compiled with thread support.
416 #--------------------------------------------------------------------
417 OBJC_THREAD=
418 AC_ARG_WITH(thread-lib,
419 [--with-thread-lib              Specify alternate thread library],
420 OBJC_THREAD=$withval,
421 OBJC_THREAD=
422 )
423
424
425 AC_MSG_CHECKING(whether objc has thread support)
426 saved_CFLAGS="$CFLAGS"
427 saved_LIBS="$LIBS"
428 CFLAGS="$CFLAGS -x objective-c -I$srcdir $OBJC_CPPFLAGS $OBJC_LDFLAGS"
429 if test "$OBJC_RUNTIME_LIB" = "gnu"; then
430   CFLAGS="$CFLAGS -fgnu-runtime"
431 fi
432 if test "$OBJC_RUNTIME_LIB" = "nx"; then
433   CFLAGS="$CFLAGS -DNeXT_RUNTIME"
434 fi
435 if test "$OBJC_RUNTIME_LIB" = "apple"; then
436   CFLAGS="$CFLAGS -DNeXT_RUNTIME"
437 fi
438 if test "$OBJC_THREAD" != ""; then
439   LIBS="-lobjc $LIBS $OBJC_THREAD"
440   AC_TRY_RUN([#include "config_thread.m"], 
441         objc_threaded="$OBJC_THREAD",
442         objc_threaded="", objc_threaded="")
443 elif test "$host_os" = linux-gnu; then
444   LIBS="-lobjc -lpthread"
445   AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpthread",
446         objc_threaded="", objc_threaded="-lpthread")
447 elif test "`echo $host_os|sed 's/[[0-9]].*//'|sed s/elf//`" = freebsd; then
448   LIBS="-pthread -lobjc"
449   AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-pthread",
450        objc_threaded="", objc_threaded="-pthread")
451   if test x"$objc_threaded" = x""; then
452     LIBS="-lpthread -lobjc"
453     AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpthread",
454         objc_threaded="", objc_threaded="-lpthread")
455   fi
456   if test x"$objc_threaded" = x""; then
457     LIBS="-lobjc -lpcthread"
458     AC_TRY_RUN([#include "config_thread.m"], objc_threaded="-lpcthread",
459         objc_threaded="", objc_threaded="-lpcthread")
460   fi
461 elif test "$MINGW32" = yes; then
462   # Mingw doesn't need anything extra for threads
463   LIBS="-lobjc $LIBS"
464   AC_TRY_RUN([#include "config_thread.m"], 
465         objc_threaded="works",
466         objc_threaded="", objc_threaded="works")
467 else
468   LIBS="-lobjc $LIBS"
469   AC_TRY_RUN([#include "config_thread.m"], 
470         objc_threaded="works",
471         objc_threaded="", objc_threaded="")
472   if test x"$objc_threaded" = x""; then
473     LIBS="-lobjc $saved_LIBS -lpthread "
474     AC_TRY_RUN([#include "config_thread.m"], 
475         objc_threaded="-lpthread", 
476         objc_threaded="", objc_threaded="")
477   fi
478   if test x"$objc_threaded" = x""; then
479     # Solaris, OpenBSD/sparc
480     LIBS="-lobjc $saved_LIBS -lpthread -lposix4"
481     AC_TRY_RUN([#include "config_thread.m"], 
482         objc_threaded="-lpthread -lposix4", 
483         objc_threaded="", objc_threaded="")
484   fi
485   if test x"$objc_threaded" = x""; then
486     LIBS="-lobjc $saved_LIBS -lthread "
487     AC_TRY_RUN([#include "config_thread.m"], 
488         objc_threaded="-lthread", 
489         objc_threaded="", objc_threaded="")
490   fi
491 fi
492 if test x"$objc_threaded" = x""; then
493   AC_MSG_RESULT(no)
494 else
495   if test x"$objc_threaded" = x"works"; then
496     objc_threaded=""
497   fi
498   AC_MSG_RESULT(yes: $objc_threaded)
499 fi
500 ac_cv_objc_threaded="$objc_threaded"
501 AC_SUBST(objc_threaded)
502 AC_SUBST(ac_cv_objc_threaded)
503
504 # Do not restore LIBS and CFLAGS yet as we need to test if the
505 # compiler supports native exceptions.
506
507 #--------------------------------------------------------------------
508 # Check if GCC supports -fobjc-exceptions, and if so, turn it on!
509 #--------------------------------------------------------------------
510
511 AC_ARG_ENABLE(native-objc-exceptions,
512         AC_HELP_STRING([--enable-native-objc-exceptions],
513                        [use native objective-c exceptions]),
514         USE_OBJC_EXCEPTIONS=$enableval,
515         USE_OBJC_EXCEPTIONS=no)
516
517 AC_MSG_CHECKING(whether we should use native ObjC exceptions)
518 if test x"$USE_OBJC_EXCEPTIONS" = x"yes"; then
519   # What we want to do: set USE_OBJC_EXCEPTIONS to yes if we can compile
520   # something with @try/@catch/@finally in it.
521   if test ! ${GCC} = "yes" ; then
522     USE_OBJC_EXCEPTIONS=no
523     AC_MSG_RESULT(no: compiler isn't gcc)
524   else
525     CFLAGS="$CFLAGS -fobjc-exceptions"
526     AC_RUN_IFELSE([[
527 #include <stdlib.h>
528 #include <objc/Object.h>
529
530 int main(int argc, char **argv)
531 {
532         Object *o=nil;
533         @try
534         {
535                 o=[Object new];
536                 @throw o;
537         }
538         @catch (id foo)
539         {
540                 if (o!=foo)
541                         return 1;
542         }
543         return 0;
544 }
545   ]], USE_OBJC_EXCEPTIONS=yes, USE_OBJC_EXCEPTIONS=no)
546     AC_MSG_RESULT($USE_OBJC_EXCEPTIONS)
547   fi
548   if test x$USE_OBJC_EXCEPTIONS = xno; then
549     AC_MSG_NOTICE([Native objective-c exceptions were requested, but the compiler])
550     AC_MSG_NOTICE([doesn't support them.])
551     AC_MSG_ERROR([compiler doesn't support native objective-c exceptions])
552   fi
553 else
554   AC_MSG_RESULT(not requested by user)
555 fi
556
557 AC_SUBST(USE_OBJC_EXCEPTIONS)
558
559 # Restore LIBS and CFLAGS - we are going to compile C code in the next
560 # test.
561 LIBS="$saved_LIBS"
562 CFLAGS="$saved_CFLAGS"
563
564 #--------------------------------------------------------------------
565 # Check if compiler supports -MMD -MP to generate %.d files ...
566 #--------------------------------------------------------------------
567
568 AC_MSG_CHECKING(if the compiler supports autodependencies)
569
570 # What we want to do: set AUTO_DEPENDENCIES to yes if gcc => 3.x
571
572 if test ! ${GCC} = "yes" ; then
573   AUTO_DEPENDENCIES=""
574   PRECOMPILED_HEADERS=""
575   AC_MSG_RESULT(no: it's not gcc)
576 else
577   # Running gcc -dumpversion we get something like 2.95.4 or
578   #  egcs-2.91.66 or 3.0.2 or 3.1 20011211
579   # We want to discard anything but the major number.
580   # Explanation of the regexp -
581   # \(^[^0-9]*\) matches beginning of line and following non numeric chars
582   # \([0-9][0-9]*\) matches 1 or more numeric chars (this is the 2^nd
583   #  subpattern)
584   # \([^0-9].*\) matches a non numeric char followed by anything
585   # /\2/ replace the whole lot with the 2^nd subpattern
586   gs_cv_gcc_major_version=`${CC} -dumpversion | sed "s/\([[^0-9]]*\)\([[0-9]][[0-9]]*\)\([[^0-9]].*\)/\2/"`;
587
588   if test "${gs_cv_gcc_major_version}" -ge "3" ; then
589     AUTO_DEPENDENCIES=yes
590     AC_MSG_RESULT(yes: gcc major version is ${gs_cv_gcc_major_version})
591   else
592     AUTO_DEPENDENCIES=""
593     PRECOMPILED_HEADERS=""
594     AC_MSG_RESULT(no: gcc major version is ${gs_cv_gcc_major_version})
595   fi
596 fi
597
598 AC_SUBST(AUTO_DEPENDENCIES)
599 AC_SUBST(PRECOMPILED_HEADERS)
600 AC_SUBST(INCLUDES)
601 AC_SUBST(LIB_DIR)
602 AC_SUBST(OBJCFLAGS)
603
604 #--------------------------------------------------------------------
605 # Shall we strip makefiles upon installation ?
606 #--------------------------------------------------------------------
607
608 # Stripping makefiles removes comments and newlines from them.  The
609 # resulting stripped makefiles execute around 5% faster on average.
610 # Too little for it to be worth for the common user who's more
611 # interested in the comments :-) so it's disabled by default.
612 AC_MSG_CHECKING(if we should strip makefiles after installation)
613 AC_ARG_ENABLE(strip-makefiles, 
614 [--enable-strip-makefiles       Enable stripping makefiles after installation], 
615   ac_cv_strip_makefiles=$enableval,
616   ac_cv_strip_makefiles="undefined")
617
618 if test "$ac_cv_strip_makefiles" = "yes"; then
619   GNUSTEP_STRIP_MAKEFILES=strip;
620   AC_MSG_RESULT(yes);
621 else
622   GNUSTEP_STRIP_MAKEFILES=;
623   AC_MSG_RESULT(no);
624 fi
625 AC_SUBST(GNUSTEP_STRIP_MAKEFILES)
626
627
628 #--------------------------------------------------------------------
629 # Disable updating the obsolete directory structure
630 #--------------------------------------------------------------------
631 gs_move_obsolete=yes
632 AC_ARG_ENABLE(move-obsolete, 
633 [--disable-move-obsolete                Disable moving obsolete dir structure], 
634   gs_move_obsolete=$enableval,
635   gs_move_obsolete=yes)
636
637 if test "$gs_move_obsolete" = "yes"; then
638   GNUSTEP_MOVE_OBSOLETE=move_obsolete;
639 else
640   GNUSTEP_MOVE_OBSOLETE=
641   AC_MSG_NOTICE(Old GNUstep directories will not be moved)
642 fi
643 AC_SUBST(GNUSTEP_MOVE_OBSOLETE)
644
645 #--------------------------------------------------------------------
646 # Enable/disable precompiled headers
647 #--------------------------------------------------------------------
648 # TODO: replace with / add a check whether PCH works with the
649 #       compiler
650 gs_enable_pch=no
651 AC_MSG_CHECKING(if we should enable precompiled headers (pch))
652 AC_ARG_ENABLE(pch, 
653 [--enable-pch                   Enable precompiled headers], 
654   gs_enable_pch=$enableval,
655   gs_enable_pch=no)
656
657 if test "$gs_enable_pch" = "yes"; then
658   PRECOMPILED_HEADERS=yes
659   AC_MSG_RESULT(yes);
660 else
661   PRECOMPILED_HEADERS=
662   AC_MSG_RESULT(no);
663 fi
664 AC_SUBST(PRECOMPILED_HEADERS)
665
666 #--------------------------------------------------------------------
667 # Record the version
668 #--------------------------------------------------------------------
669 AC_MSG_CHECKING(for the version of gnustep-make we are compiling)
670 . "$srcdir/Version"
671 AC_MSG_RESULT($GNUSTEP_MAKE_VERSION)
672 AC_SUBST(GNUSTEP_MAKE_VERSION)
673 AC_SUBST(GNUSTEP_MAKE_MAJOR_VERSION)
674 AC_SUBST(GNUSTEP_MAKE_MINOR_VERSION)
675 AC_SUBST(GNUSTEP_MAKE_SUBMINOR_VERSION)
676
677 #-------------------------------------------------------------------
678 # Record the 'clean' target_os, target_cpu and target_vendor
679 #-------------------------------------------------------------------
680 # This is just for efficiency, so that core/make/GNUmakefile does not
681 # have to compute clean_target_os from target_os (and similar) by
682 # running shell scripts each time you 'make' something inside
683 # gnustep-make.  We basically compute them once now, and cache them
684 # forever.  It is also used by GNUstep.sh when multi-platform is
685 # disabled.
686 clean_target_os=`$srcdir/clean_os.sh $target_os`
687 clean_target_cpu=`$srcdir/clean_cpu.sh $target_cpu`
688 clean_target_vendor=`$srcdir/clean_cpu.sh $target_vendor`
689 AC_SUBST(clean_target_os)
690 AC_SUBST(clean_target_cpu)
691 AC_SUBST(clean_target_vendor)
692 AC_SUBST(target)
693
694 #--------------------------------------------------------------------
695 # Produce the output files
696 #--------------------------------------------------------------------
697 AC_CONFIG_FILES([config.make openapp debugapp opentool 
698 executable.template GNUmakefile GNUstep.sh GNUstep.csh fixpath.sh
699 gnustep-make.spec GNUsteprc])
700 AC_CONFIG_COMMANDS([default],
701         [[chmod a+x openapp debugapp opentool fixpath.sh executable.template]],
702         [[]])
703 AC_OUTPUT