/[gnustep]/gnustep/core/base/configure.ac
ViewVC logotype

Contents of /gnustep/core/base/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.31 - (show annotations) (download)
Fri Oct 3 21:25:31 2003 UTC (20 years, 7 months ago) by fedor
Branch: MAIN
Changes since 1.30: +2 -2 lines
Use -Wl for netbsd linker options.

1 # configure.in for GNU Objective-C library
2 # Process this file with autoconf to produce a configure script.
3 #
4 # Copyright (C) 1993,1994, 1995, 1996, 1997 Free Software Foundation, Inc.
5 #
6 # Written by: Andrew Kachites McCallum <mccallum@cs.rochester.edu>
7 # Dept. of Computer Science, U. of Rochester, Rochester, NY 14627
8 #
9 # This file is part of the GNU Objective-C library.
10 #
11 # This library is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU Library General Public
13 # License as published by the Free Software Foundation; either
14 # version 2 of the License, or (at your option) any later version.
15 #
16 # This library is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # Library General Public License for more details.
20 #
21 # You should have received a copy of the GNU Library General Public
22 # License along with this library; if not, write to the Free
23 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
24 builtin(include, config/objc-con-autoload.m4)dnl
25 builtin(include, config/objc-sys-dynamic.m4)dnl
26 builtin(include, config/procfs-exe-link.m4)dnl
27 builtin(include, config/procfs.m4)dnl
28 builtin(include, config/pathxml.m4)dnl
29
30 AC_INIT
31 AC_CONFIG_SRCDIR([Source/NSArray.m])
32
33 if test -z "$GNUSTEP_SYSTEM_ROOT"; then
34 AC_MSG_ERROR([You must run the GNUstep initialization script first!])
35 fi
36
37 #--------------------------------------------------------------------
38 # Use config.guess, config.sub and install-sh provided by gnustep-make
39 #--------------------------------------------------------------------
40 AC_CONFIG_AUX_DIR($GNUSTEP_MAKEFILES)
41
42 #--------------------------------------------------------------------
43 # Use a .h file with #define's, instead of -D command-line switches
44 #--------------------------------------------------------------------
45 AC_CONFIG_HEADER(Headers/Additions/GNUstepBase/config.h)
46
47 #--------------------------------------------------------------------
48 # Determine the host, build, and target systems
49 #--------------------------------------------------------------------
50 AC_CANONICAL_TARGET([])
51
52 #--------------------------------------------------------------------
53 # Find the compiler
54 #--------------------------------------------------------------------
55 AC_PROG_CC
56 AC_PROG_CPP
57
58 AC_PATH_PROG(WHOAMI, whoami, echo, $PATH:/usr/ucb)
59
60 #--------------------------------------------------------------------
61 # specific target_os options
62 #--------------------------------------------------------------------
63 INCLUDE_FLAGS="$CPPFLAGS"
64 LIBS="$LDFLAGS $LIBS"
65 # This is just for configuring. Later, in config.make, INCLUDE_FLAGS
66 # goes in CONFIG_SYSTEM_INCL and LIBS goes in CONFIG_SYSTEM_LIBS
67 case "$target_os" in
68 freebsd* | openbsd* )
69 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
70 LDFLAGS="$LDFLAGS -L/usr/local/lib";;
71 netbsd*) CPPFLAGS="-I/usr/pkg/include"
72 LDFLAGS="$LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib";;
73 esac
74
75 #----------------------------------------------------------------
76 # Find out if nested functions work on this machine
77 #----------------------------------------------------------------
78 AC_MSG_CHECKING(whether nested functions work)
79 AC_TRY_RUN([#include "$srcdir/config/config.nested.c"],
80 gcc_nested=1, gcc_nested=0, gcc_nested=1)
81 if test $gcc_nested = 0; then
82 AC_MSG_RESULT(no)
83 AC_DEFINE(BROKEN_NESTED_FUNCTIONS,1,
84 [Define if nested functions are broken on this compiler])
85 else
86 AC_MSG_RESULT(yes)
87 fi
88
89 #--------------------------------------------------------------------
90 # Set Apple/Darwin/OSX/NeXT information for other tests
91 #--------------------------------------------------------------------
92 OBJC_RUNTIME_LIB=`echo $LIBRARY_COMBO | tr '-' ' ' | awk '{print $1}'`
93 AC_MSG_CHECKING(the Objective-C runtime)
94 if test "$OBJC_RUNTIME_LIB" = "nx" -o "$OBJC_RUNTIME_LIB" = "apple"; then
95 AC_MSG_RESULT(NeXT)
96 LIBOBJC='-lobjc'
97 CPPFLAGS="$CPPFLAGS -fnext-runtime -DNeXT_RUNTIME"
98 else
99 AC_MSG_RESULT(GNU)
100 LIBOBJC='-lobjc'
101 CPPFLAGS="$CPPFLAGS -fgnu-runtime"
102 fi
103
104 #--------------------------------------------------------------------
105 # Miscellaneous flags
106 #--------------------------------------------------------------------
107 # Set location of GNUstep dirs for later use
108 if test "$GNUSTEP_FLATTENED" = yes; then
109 GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Library/Libraries
110 GNUSTEP_HDIR=$GNUSTEP_SYSTEM_ROOT/Library/Headers
111 else
112 clean_target_os=`$GNUSTEP_MAKEFILES/clean_os.sh $target_os`
113 clean_target_cpu=`$GNUSTEP_MAKEFILES/clean_cpu.sh $target_cpu`
114 obj_dir=$clean_target_cpu/$clean_target_os
115 GNUSTEP_LDIR=$GNUSTEP_SYSTEM_ROOT/Library/Libraries/$obj_dir
116 GNUSTEP_HDIR=$GNUSTEP_SYSTEM_ROOT/Library/Headers/$LIBRARY_COMBO
117 fi
118
119 #
120 # The following one is so that headers of custom libraries into
121 # $GNUSTEP_HDIR are used before the standard ones
122 #
123 CPPFLAGS="$CPPFLAGS -I$GNUSTEP_HDIR"
124 LDFLAGS="$LDFLAGS -L$GNUSTEP_LDIR/$LIBRARY_COMBO -L$GNUSTEP_LDIR"
125
126 #--------------------------------------------------------------------
127 # Check if Objective-C is installed
128 #--------------------------------------------------------------------
129 AC_CHECK_HEADERS(objc/objc.h)
130 if test $ac_cv_header_objc_objc_h = no; then
131 echo "Check to make sure you have a full installation of the GCC"
132 echo "compiler that includes the Objective-C headers and libraries"
133 AC_MSG_ERROR(Could not find Objective-C headers)
134 fi
135
136 #--------------------------------------------------------------------
137 # Check for strange network stuff used by gdomap
138 #--------------------------------------------------------------------
139 AC_MSG_NOTICE(for gdomap network details)
140 AC_MSG_CHECKING(for variable length socket addresses)
141 AC_TRY_COMPILE([
142 #include <sys/types.h>
143 #include <sys/socket.h>
144 #include <net/if.h>
145 ],
146 [struct ifreq s; s.ifr_addr.sa_len = 0;],
147 sa_len=1, sa_len=0)
148 if test $sa_len = 1; then
149 AC_MSG_RESULT([found])
150 AC_DEFINE(HAVE_SA_LEN,1,
151 [Define if your system has variable length network addresses])
152 else
153 AC_MSG_RESULT([not found])
154 fi
155
156 #--------------------------------------------------------------------
157 # Check if system has buggy SO_REUSEADDR
158 #--------------------------------------------------------------------
159 AC_MSG_CHECKING(whether SO_REUSADDR is broken)
160 AC_TRY_RUN([#include "$srcdir/config/config.reuseaddr.c"],
161 reuseaddr_ok=1,
162 reuseaddr_ok=0,
163 reuseaddr_ok=0)
164 if test $reuseaddr_ok = 0; then
165 AC_DEFINE(BROKEN_SO_REUSEADDR,1,
166 [Define if SO_REUSEADDR is broken on this system])
167 echo
168 echo "The SO_REUSEADDR socket option for controlling re-use of network"
169 echo "sockets immediately after shutdown appears to be broken on this"
170 echo "machine. Networking code will be built without using this"
171 echo "feature."
172 echo "The effect of this lack is that when a network service is shut"
173 echo "down, it cannot be re-started on the same network port until"
174 echo "an operating-system timeout has expired."
175 echo "For servers other than gdomap, GNUstep does not normally need"
176 echo "a particular network port, so the problem is unlikely to arise."
177 AC_MSG_RESULT(yes)
178 else
179 AC_MSG_RESULT(no)
180 fi
181
182 #--------------------------------------------------------------------
183 # Check for thread flags for libobjc.
184 #--------------------------------------------------------------------
185 #
186 AC_MSG_CHECKING(for objc threading flags)
187 #
188 # Get them from gnustep-make which contains the real code to get them
189 #
190 objc_threaded=`grep objc_threaded: $GNUSTEP_MAKEFILES/$obj_dir/config.make | sed -e 's/objc_threaded:=//'`
191 #
192 AC_MSG_RESULT($objc_threaded)
193
194 #--------------------------------------------------------------------
195 # Byte order information needed for foundation headers.
196 #--------------------------------------------------------------------
197 AC_C_BIGENDIAN
198 if test $ac_cv_c_bigendian = yes; then
199 GS_WORDS_BIGENDIAN=1
200 else
201 GS_WORDS_BIGENDIAN=0
202 fi
203 AC_SUBST(GS_WORDS_BIGENDIAN)
204
205 #--------------------------------------------------------------------
206 # Type size information needed for foundation headers.
207 #--------------------------------------------------------------------
208 AC_CHECK_SIZEOF(void*)
209
210 GS_SINT8="signed char"
211 GS_UINT8="unsigned char"
212 AC_SUBST(GS_SINT8)
213 AC_SUBST(GS_UINT8)
214
215 AC_CHECK_SIZEOF(short)
216 AC_SUBST(ac_cv_sizeof_short)
217
218 AC_CHECK_SIZEOF(int)
219 AC_SUBST(ac_cv_sizeof_int)
220
221 AC_CHECK_SIZEOF(long)
222 AC_SUBST(ac_cv_sizeof_long)
223
224 AC_CHECK_SIZEOF(long long)
225 AC_SUBST(ac_cv_sizeof_long_long)
226
227 AC_CHECK_SIZEOF(float)
228 AC_SUBST(ac_cv_sizeof_float)
229
230 AC_CHECK_SIZEOF(double)
231 AC_SUBST(ac_cv_sizeof_double)
232
233 AC_SUBST(ac_cv_sizeof_voidp)
234 if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_int; then
235 GS_ADDR="unsigned int"
236 else
237 if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long; then
238 GS_ADDR="unsigned long"
239 else
240 if test $ac_cv_sizeof_voidp = $ac_cv_sizeof_long_long; then
241 GS_ADDR="unsigned long long"
242 else
243 AC_MSG_ERROR([Unable to find integer of same size as void*])
244 fi
245 fi
246 fi
247 AC_SUBST(GS_ADDR)
248
249 if test $ac_cv_sizeof_short = 2; then
250 GS_SINT16="signed short"
251 GS_UINT16="unsigned short"
252 else
253 if test $ac_cv_sizeof_int = 2; then
254 GS_SINT16="signed int"
255 GS_UINT16="unsigned int"
256 else
257 AC_MSG_ERROR([Unable to determine type for 16-bit integer])
258 fi
259 fi
260 AC_SUBST(GS_SINT16)
261 AC_SUBST(GS_UINT16)
262
263 if test $ac_cv_sizeof_int = 4; then
264 GS_SINT32="signed int"
265 GS_UINT32="unsigned int"
266 else
267 if test $ac_cv_sizeof_long = 4; then
268 GS_SINT32="signed long"
269 GS_UINT32="unsigned long"
270 else
271 if test $ac_cv_sizeof_short = 4; then
272 GS_SINT32="signed short"
273 GS_UINT32="unsigned short"
274 else
275 AC_MSG_ERROR([Unable to determine type for 32-bit integer])
276 fi
277 fi
278 fi
279 AC_SUBST(GS_SINT32)
280 AC_SUBST(GS_UINT32)
281
282 GS_HAVE_I64=1
283 if test $ac_cv_sizeof_int = 8; then
284 GS_SINT64="signed int"
285 GS_UINT64="unsigned int"
286 else
287 if test $ac_cv_sizeof_long = 8; then
288 GS_SINT64="signed long"
289 GS_UINT64="unsigned long"
290 else
291 if test $ac_cv_sizeof_long_long = 8; then
292 GS_SINT64="signed long long"
293 GS_UINT64="unsigned long long"
294 else
295 # 64-bit ints not supported - but we need a dummy type for byte-swapping
296 # of 64-bit values arriving from another system.
297 GS_SINT64="struct { gsu8 a[8]; }"
298 GS_SINT64="struct { gsu8 a[8]; }"
299 GS_HAVE_I64=0
300 fi
301 fi
302 fi
303 AC_SUBST(GS_SINT64)
304 AC_SUBST(GS_UINT64)
305 AC_SUBST(GS_HAVE_I64)
306
307 GS_HAVE_I128=1
308 if test $ac_cv_sizeof_long = 16; then
309 GS_SINT128="signed long"
310 GS_UINT128="unsigned long"
311 else
312 if test $ac_cv_sizeof_long_long = 16; then
313 GS_SINT128="signed long long"
314 GS_UINT128="unsigned long long"
315 else
316 # 128-bit ints not supported - but we need a dummy type for byte-swapping
317 # of 128-bit values arriving from another system.
318 GS_SINT128="struct { gsu8 a[16]; }"
319 GS_UINT128="struct { gsu8 a[16]; }"
320 GS_HAVE_I128=0
321 fi
322 fi
323 AC_SUBST(GS_SINT128)
324 AC_SUBST(GS_UINT128)
325 AC_SUBST(GS_HAVE_I128)
326
327 if test $ac_cv_sizeof_float = 4; then
328 GS_FLT32="float"
329 else
330 AC_MSG_ERROR([Unable to determine type for 32-bit float])
331 fi
332 AC_SUBST(GS_FLT32)
333
334 if test $ac_cv_sizeof_double = 8; then
335 GS_FLT64="double"
336 else
337 AC_MSG_ERROR([Unable to determine type for 64-bit float])
338 fi
339 AC_SUBST(GS_FLT64)
340
341 #--------------------------------------------------------------------
342 # Type-size information for encoding into archives using NSArchiver etc.
343 #--------------------------------------------------------------------
344 if test $ac_cv_sizeof_short = 2; then
345 _GSC_S_SHT=_GSC_I16
346 else
347 _GSC_S_SHT=_GSC_I32
348 fi
349 AC_SUBST(_GSC_S_SHT)
350
351 if test $ac_cv_sizeof_int = 2; then
352 _GSC_S_INT=_GSC_I16
353 else
354 if test $ac_cv_sizeof_int = 4; then
355 _GSC_S_INT=_GSC_I32
356 else
357 if test $ac_cv_sizeof_int = 8; then
358 _GSC_S_INT=_GSC_I64
359 else
360 if test $ac_cv_sizeof_int = 16; then
361 _GSC_S_INT=_GSC_I128
362 fi
363 fi
364 fi
365 fi
366 AC_SUBST(_GSC_S_INT)
367
368 if test $ac_cv_sizeof_long = 4; then
369 _GSC_S_LNG=_GSC_I32
370 else
371 if test $ac_cv_sizeof_long = 8; then
372 _GSC_S_LNG=_GSC_I64
373 else
374 if test $ac_cv_sizeof_long = 16; then
375 _GSC_S_LNG=_GSC_I128
376 fi
377 fi
378 fi
379 AC_SUBST(_GSC_S_LNG)
380
381 if test $ac_cv_sizeof_long_long = 4; then
382 _GSC_S_LNG_LNG=_GSC_I32
383 else
384 if test $ac_cv_sizeof_long_long = 8; then
385 _GSC_S_LNG_LNG=_GSC_I64
386 else
387 if test $ac_cv_sizeof_long_long = 16; then
388 _GSC_S_LNG_LNG=_GSC_I128
389 fi
390 fi
391 fi
392 AC_SUBST(_GSC_S_LNG_LNG)
393
394 #--------------------------------------------------------------------
395 # Setup dynamic linking
396 #--------------------------------------------------------------------
397 OBJC_SYS_DYNAMIC_LINKER()
398
399 #--------------------------------------------------------------------
400 # Check whether Objective-C /really/ works
401 #--------------------------------------------------------------------
402 AC_MSG_CHECKING(whether objc really works)
403 saved_LIBS="$LIBS"
404 saved_CPPFLAGS="$CPPFLAGS"
405 LIBS="$LIBS $LIBOBJC"
406 CPPFLAGS="$CPPFLAGS -x objective-c"
407 if test x"$objc_threaded" != x""; then
408 LIBS="$LIBS $objc_threaded"
409 fi
410 LIBS="$LIBS $extra_LIBS"
411 AC_CACHE_VAL(objc_works,
412 AC_TRY_RUN([#include "$srcdir/config/config.objc.m"],
413 objc_works=yes,
414 objc_works=no,
415 objc_works=yes)
416 )
417 if test $objc_works = yes; then
418 AC_MSG_RESULT(yes)
419 else
420 AC_MSG_RESULT(no)
421 echo "I don't seem to be able to use your Objective-C compiler to produce"
422 echo "working binaries! Please check your Objective-C compiler installation."
423 echo "If you are using gcc-3.x make sure that your compiler's libgcc_s and libobjc"
424 echo "can be found by the dynamic linker - usually that requires you to play"
425 echo "with LD_LIBRARY_PATH or /etc/ld.so.conf."
426 echo "Please refer to your compiler installation instructions for more help."
427 AC_MSG_ERROR(The Objective-C compiler doesn't work or is not installed properly.)
428 fi
429
430 # Don't revert any Objective-C flags as they are used in the next test
431
432 #---------------------------------------------------------------------
433 # Guess if we are using a compiler which allows us to change the class
434 # to be used for constant strings by using the -fconstant-string-class
435 # option. If that is the case, we change it to NSConstantString.
436 #---------------------------------------------------------------------
437 CPPFLAGS="$CPPFLAGS -fconstant-string-class=FooConstantString"
438 AC_MSG_CHECKING(if the compiler supports -fconstant-string-class)
439 AC_CACHE_VAL(objc_compiler_supports_constant_string_class,
440 AC_TRY_RUN([#include "$srcdir/config/config.constant-string-class.m"],
441 objc_compiler_supports_constant_string_class=yes,
442 objc_compiler_supports_constant_string_class=no,
443 objc_compiler_supports_constant_string_class=no)
444 )
445 if test $objc_compiler_supports_constant_string_class = yes; then
446 NX_CONST_STRING_OBJCFLAGS="-fconstant-string-class=NSConstantString"
447 NX_CONST_STRING_CLASS=NSConstantString
448 AC_MSG_RESULT(yes)
449 else
450 NX_CONST_STRING_OBJCFLAGS=""
451 NX_CONST_STRING_CLASS=NXConstantString
452 AC_MSG_RESULT(no)
453 fi
454
455 AC_SUBST(NX_CONST_STRING_OBJCFLAGS)
456 AC_SUBST(NX_CONST_STRING_CLASS)
457
458 CPPFLAGS="$saved_CPPFLAGS"
459 # Don't revert LIBS, need it for the next test
460
461 #---------------------------------------------------------------------
462 # Guess if we are using a compiler which has the (GNU extension) +load
463 # method which is executed before main.
464 # Defines HAVE_LOAD_METHOD if +load methods are called before main.
465 # Needed by NSProcessInfo.m
466 #---------------------------------------------------------------------
467 saved_CPPFLAGS="$CPPFLAGS"
468 CPPFLAGS="$CPPFLAGS -x objective-c"
469 AC_MSG_CHECKING(if +load method is executed before main)
470 AC_CACHE_VAL(objc_load_method_worked,
471 AC_TRY_RUN([#include "$srcdir/config/config.loadtest.m"],
472 objc_load_method_worked=yes,
473 objc_load_method_worked=no,
474 objc_load_method_worked=no)
475 )
476 if test $objc_load_method_worked = yes; then
477 AC_DEFINE(HAVE_LOAD_METHOD,1,
478 [Define if your Obj-C compiler calls +load methods before main])
479 AC_MSG_RESULT(yes)
480 else
481 AC_MSG_RESULT(no)
482 fi
483
484 CPPFLAGS="$saved_CPPFLAGS"
485 # Don't revert LIBS, need it for the next test
486
487 #--------------------------------------------------------------------
488 # This function needed by NSLock.m for conditioned wait
489 # get_uninstalled_dtable used by behavior.m and objc-load.m
490 # Thread functions used by NSThread
491 #--------------------------------------------------------------------
492 AC_CHECK_FUNCS(objc_condition_timedwait objc_thread_add)
493
494 AC_EGREP_HEADER(objc_get_uninstalled_dtable, objc/objc-api.h,
495 AC_DEFINE(HAVE_OBJC_GET_UNINSTALLED_DTABLE,1,
496 [ Define if objc-api.h defines this function]),)
497
498 LIBS="$saved_LIBS"
499
500 #--------------------------------------------------------------------
501 # Generic settings needed by NSZone.m
502 #--------------------------------------------------------------------
503 AC_TYPE_SIZE_T
504 AC_C_INLINE
505
506 #--------------------------------------------------------------------
507 # Following header checks needed for bzero in Storage.m and other places
508 #--------------------------------------------------------------------
509 AC_HEADER_STDC
510 AC_CHECK_HEADERS(string.h memory.h)
511
512 #--------------------------------------------------------------------
513 # Following header check needed NSConnection.h
514 #--------------------------------------------------------------------
515 AC_CHECK_HEADERS(float.h)
516
517 #--------------------------------------------------------------------
518 # Header files and functions for files and filesystems
519 #--------------------------------------------------------------------
520 AC_CHECK_HEADERS(sys/stat.h sys/vfs.h sys/statfs.h sys/statvfs.h pwd.h grp.h)
521 AC_CHECK_HEADERS(sys/mount.h sys/types.h windows.h locale.h langinfo.h)
522 saved_LIBS="$LIBS"
523 AC_CHECK_LIB(m, main)
524 AC_CHECK_FUNCS(statvfs link symlink readlink geteuid getlogin getpwnam getpwuid getgrgid rint getopt)
525 LIBS="$saved_LIBS"
526
527 #--------------------------------------------------------------------
528 # These two headers (functions) needed by Time.m
529 #--------------------------------------------------------------------
530 dnl AC_REPLACE_FUNCS(getrusage gettimeofday)
531
532 AC_CHECK_HEADERS(time.h sys/time.h sys/rusage.h ucbinclude/sys/resource.h)
533 AC_CHECK_FUNCS(time ctime tzset)
534
535 #--------------------------------------------------------------------
536 # These headers/functions needed by GSTcpPort.m
537 #--------------------------------------------------------------------
538 AC_CHECK_HEADERS(sys/socket.h netinet/in.h)
539 dnl AC_REPLACE_FUNCS(recvfrom)
540
541 #--------------------------------------------------------------------
542 # These headers/functions needed by NSLog.m
543 #--------------------------------------------------------------------
544 AC_CHECK_HEADERS(syslog.h)
545 AC_CHECK_FUNCS(syslog)
546
547 #--------------------------------------------------------------------
548 # These headers/functions needed by NSRunLoop.m
549 #--------------------------------------------------------------------
550 AC_CHECK_HEADERS(poll.h)
551 AC_CHECK_FUNCS(poll)
552
553
554 #--------------------------------------------------------------------
555 # Check for pthread.h (only when building on Darwin machines)
556 #--------------------------------------------------------------------
557 AC_CHECK_HEADERS(pthread.h)
558 HAVE_PTHREAD_H=no
559 if test $ac_cv_header_pthread_h = yes ; then
560 HAVE_PTHREAD_H=yes
561 fi
562 AC_SUBST(HAVE_PTHREAD_H)
563
564 #--------------------------------------------------------------------
565 # This function needed by StdioStream.m
566 #--------------------------------------------------------------------
567 AC_CHECK_FUNCS(vsprintf vasprintf)
568 if test $ac_cv_func_vsprintf = yes ; then
569 AC_TRY_RUN([#include "$srcdir/config/config.vsprintf.c"],
570 VSPRINTF_RETURNS_LENGTH=1,
571 VSPRINTF_RETURNS_LENGTH=0,
572 VSPRINTF_RETURNS_LENGTH=1)
573 AC_DEFINE_UNQUOTED(VSPRINTF_RETURNS_LENGTH, $VSPRINTF_RETURNS_LENGTH,
574 [Define if vsprintf returns the length printed])
575 fi
576 if test $ac_cv_func_vasprintf = yes ; then
577 AC_TRY_RUN([#include "$srcdir/config/config.vasprintf.c"],
578 VASPRINTF_RETURNS_LENGTH=1,
579 VASPRINTF_RETURNS_LENGTH=0,
580 VASPRINTF_RETURNS_LENGTH=1)
581 AC_DEFINE_UNQUOTED(VASPRINTF_RETURNS_LENGTH, $VASPRINTF_RETURNS_LENGTH,
582 [Define if vasprintf returns the length printed])
583 fi
584
585 #--------------------------------------------------------------------
586 # This function needed by NSFileManager.m
587 #--------------------------------------------------------------------
588 AC_CHECK_FUNCS(getcwd)
589 AC_HEADER_DIRENT
590
591 #--------------------------------------------------------------------
592 # This function needed by gdomap.c
593 #--------------------------------------------------------------------
594 AC_CHECK_HEADERS(getopt.h)
595
596 #--------------------------------------------------------------------
597 # This function needed by NSPage.m
598 #--------------------------------------------------------------------
599 AC_CHECK_FUNCS(valloc)
600
601 #--------------------------------------------------------------------
602 # This function needed by Time.m
603 #--------------------------------------------------------------------
604 AC_CHECK_FUNCS(times)
605
606 #--------------------------------------------------------------------
607 # These functions needed by NSData.m
608 #--------------------------------------------------------------------
609 AC_CHECK_FUNCS(mkstemp)
610 AC_CHECK_FUNCS(shmctl)
611 AC_CHECK_FUNCS(mmap)
612
613 #--------------------------------------------------------------------
614 # These used by UnixFileHandle.m
615 #--------------------------------------------------------------------
616 AC_CHECK_FUNCS(inet_aton)
617 USE_ZLIB=0
618 AC_CHECK_HEADERS(zlib.h)
619 if test $ac_cv_header_zlib_h = yes; then
620 AC_CHECK_LIB(z, gzseek, zlib_ok=yes, zlib_ok=no)
621 if test "$zlib_ok" = yes; then
622 LIBS="$LIBS -lz"
623 USE_ZLIB=1
624 fi
625 fi
626 AC_SUBST(USE_ZLIB)
627
628 #--------------------------------------------------------------------
629 # These functions needed by NSTask.m
630 #--------------------------------------------------------------------
631 AC_CHECK_FUNCS(killpg setpgrp setpgid)
632 AC_FUNC_SETPGRP
633
634 HAVE_PTS_STREAM_MODULES=0
635 case "${target}" in
636 *-sysv-*)
637 HAVE_PTS_STREAM_MODULES=1
638 ;;
639 esac
640 AC_DEFINE_UNQUOTED(HAVE_PTS_STREAM_MODULES, $HAVE_PTS_STREAM_MODULES,
641 [Define this if you work on sysv])
642 AC_SUBST(HAVE_PTS_STREAM_MODULES)
643
644 AC_CHECK_HEADERS(libc.h limits.h malloc.h memory.h string.h signal.h dnl
645 sys/signal.h sys/param.h sys/wait.h sys/file.h sys/fcntl.h dnl
646 sys/ioctl.h sys/stropts.h unistd.h utime.h stdint.h sys/inttypes.h)
647
648 #--------------------------------------------------------------------
649 # One of these function needed by NSThread.m
650 #--------------------------------------------------------------------
651 AC_CHECK_FUNCS(nanosleep usleep)
652
653 #--------------------------------------------------------------------
654 # This function needed by NSDebug.m and NSProcessInfo.m
655 #--------------------------------------------------------------------
656 AC_CHECK_FUNCS(strerror)
657
658 #--------------------------------------------------------------------
659 # This type needed by GSFormat
660 #--------------------------------------------------------------------
661 AC_CHECK_TYPES([uintmax_t])
662
663 AC_MSG_CHECKING([whether precompiler handles LONG_LONG_MAX])
664 AC_TRY_CPP([#ifdef HAVE_STDINT_H
665 #include <stdint.h>
666 #endif
667 #include <limits.h>
668 #if defined(LONG_LONG_MAX)
669 #if LONG_MAX == LONG_LONG_MAX
670 #error long max equals long long max
671 #endif
672 #else
673 #error long long max not defined
674 #endif
675 ], llmax=yes, llmax=no)
676 if test $llmax = yes; then
677 AC_MSG_RESULT(yes)
678 AC_DEFINE(HANDLE_LONG_LONG_MAX,1,
679 [Define if this constant is defined])
680 else
681 AC_MSG_RESULT(no)
682 fi
683
684 #
685 # Solaris and *BSD use LLONG_MAX instead
686 #
687 AC_MSG_CHECKING([whether we have LLONG_MAX])
688
689 AC_TRY_CPP([#include <limits.h>
690 #if defined(LLONG_MAX)
691 #if LONG_MAX == LLONG_MAX
692 #error long max equals long long max
693 #endif
694 #else
695 #error llong max not defined
696 #endif
697 ], llmax=yes, llmax=no)
698
699 if test $llmax = yes; then
700 AC_MSG_RESULT(yes)
701 AC_DEFINE(HANDLE_LLONG_MAX,1,
702 [Define if this constant is defined])
703 else
704 AC_MSG_RESULT(no)
705 fi
706 AC_CHECK_HEADERS(wchar.h)
707
708 #--------------------------------------------------------------------
709 # Check if short and int values need to be word aligned
710 #--------------------------------------------------------------------
711 AC_MSG_CHECKING(short/int needs to be word aligned)
712 AC_TRY_RUN([#include "$srcdir/config/config.align.c"],
713 NEED_WORD_ALIGNMENT=0,
714 NEED_WORD_ALIGNMENT=1,
715 NEED_WORD_ALIGNMENT=1)
716 AC_DEFINE_UNQUOTED(NEED_WORD_ALIGNMENT, $NEED_WORD_ALIGNMENT,
717 [Define if your system needs to have short/int word aligned])
718 if test $NEED_WORD_ALIGNMENT = 1; then
719 AC_MSG_RESULT(yes)
720 else
721 AC_MSG_RESULT(no)
722 fi
723
724 #--------------------------------------------------------------------
725 # This function needed by NSString for handling of %@ printf directive.
726 #--------------------------------------------------------------------
727 AC_CHECK_FUNC(register_printf_function, register_printf=1,
728 register_printf=0)
729 if test $register_printf = 1; then
730 AC_TRY_RUN([#include "$srcdir/config/config.printf.c"],
731 working_register_printf=1, working_register_printf=0,
732 working_register_printf=1)
733 if test $working_register_printf = 1; then
734 AC_DEFINE(HAVE_REGISTER_PRINTF_FUNCTION,1,
735 [Define if you have the register_printf_function function])
736 fi
737 fi
738
739 #--------------------------------------------------------------------
740 # This function needed by NSString.
741 #--------------------------------------------------------------------
742 AC_CHECK_FUNCS(realpath)
743
744 #--------------------------------------------------------------------
745 # Check if the C Library defines extern char *program_invocation_name
746 # Used in critical cases by NSProcessInfo.m
747 #--------------------------------------------------------------------
748 AC_MSG_CHECKING(program_invocation_name in C Library)
749 AC_CACHE_VAL(program_invocation_name_worked,
750 [AC_TRY_RUN([
751 #include <string.h>
752 int
753 main (int argc, char *argv[])
754 {
755 extern char *program_invocation_name;
756 return (strcmp (program_invocation_name, argv[0]));
757 }
758 ], program_invocation_name_worked=yes, program_invocation_name_worked=no, program_invocation_name_worked=no)])
759 if test $program_invocation_name_worked = yes; then
760 AC_DEFINE(HAVE_PROGRAM_INVOCATION_NAME,1,
761 [Define if your Lib C defines program_invocation_name])
762 AC_MSG_RESULT(yes)
763 else
764 AC_MSG_RESULT(no)
765 fi
766
767 #--------------------------------------------------------------------
768 # Defines HAVE_PROCFS if the kernel supports the /proc filesystem.
769 # Needed by NSProcessInfo.m
770 #--------------------------------------------------------------------
771 AC_SYS_PROCFS
772 AC_SYS_PROCFS_EXE_LINK
773
774 #--------------------------------------------------------------------
775 # Check if /proc/$$/cmdline terminates the last argument with a nul
776 #--------------------------------------------------------------------
777 AC_MSG_CHECKING(/proc/$$/cmdline terminated by nul)
778 AC_TRY_RUN([#include "$srcdir/config/config.proccmd.c"],
779 CMDLINE_TERMINATED=1,
780 CMDLINE_TERMINATED=0,
781 CMDLINE_TERMINATED=0)
782 AC_DEFINE_UNQUOTED(CMDLINE_TERMINATED, $CMDLINE_TERMINATED,
783 [Define if your system terminates the final argument in /proc/$$/cmdline])
784 if test $CMDLINE_TERMINATED = 1; then
785 AC_MSG_RESULT(yes)
786 else
787 AC_MSG_RESULT(no)
788 fi
789
790 #--------------------------------------------------------------------
791 # If /proc doesn't work, try kvm (on FreeBSD, for instance)
792 #--------------------------------------------------------------------
793 AC_CHECK_LIB(kvm, kvm_getenvv)
794
795 #--------------------------------------------------------------------
796 # Include redefinition of main () only if needed.
797 # On some systems - force redefinition to be used as the /proc stuff
798 # doesn't work. Allow NSProcessInfo initialization method also.
799 #--------------------------------------------------------------------
800 PASS_ARG=no
801 case "$target_os" in
802 cygwin*) PASS_ARG=yes;;
803 esac
804
805 AC_MSG_CHECKING("use of pass-through arguments")
806 AC_ARG_ENABLE(pass-arguments,
807 [ --enable-pass-arguments Force user main call to NSProcessInfo initialize],,
808 enable_pass_arguments=$PASS_ARG)
809
810 if test "$enable_pass_arguments" = "yes"; then
811 GS_PASS_ARGUMENTS=1
812 else
813 GS_PASS_ARGUMENTS=0
814 fi
815 AC_SUBST(GS_PASS_ARGUMENTS)
816 AC_MSG_RESULT($enable_pass_arguments)
817
818 AC_MSG_CHECKING("use of fake-main definition")
819 AC_ARG_ENABLE(fake-main,
820 [ --enable-fake-main Force redefine of user main function],,
821 enable_fake_main=no)
822
823 if test "$enable_pass_arguments" = "no"; then
824 case "$target_os" in
825 freebsd2*) enable_fake_main=yes;;
826 freebsd*) ;;
827 netbsd*) enable_fake_main=yes;;
828 openbsd*) enable_fake_main=yes;;
829 *sysv*) enable_fake_main=yes;;
830 esac
831 fi
832
833 GS_FAKE_MAIN=0
834 if test "$enable_fake_main" = "yes"; then
835 GS_FAKE_MAIN=1
836 elif test "$enable_pass_arguments" = "no"; then
837 if test "$objc_load_method_worked" = yes -a "$ac_cv_sys_procfs" = yes; then
838 GS_FAKE_MAIN=0
839 else
840 GS_FAKE_MAIN=1
841 enable_fake_main=yes
842 fi
843 fi
844 case "$target_os" in
845 mingw*) enable_fake_main=no; GS_FAKE_MAIN=0;;
846 esac
847 AC_SUBST(GS_FAKE_MAIN)
848 AC_MSG_RESULT($enable_fake_main)
849
850 #--------------------------------------------------------------------
851 # Check for FFI interface libraries for invocations
852 # We enable ffcall by default now.
853 #--------------------------------------------------------------------
854 do_enable_libffi=no
855 # Enable libffi by default on the following machines
856 case "$target_os" in
857 darwin*) do_enable_libffi=yes;;
858 esac
859
860 AC_ARG_ENABLE(libffi,
861 [ --enable-libffi Enable use of libffi library],,
862 enable_libffi=$do_enable_libffi)
863
864 AC_ARG_ENABLE(ffcall,
865 [ --enable-ffcall Enable use of ffcall library],,
866 enable_ffcall=yes)
867
868 AC_ARG_ENABLE(do,
869 [ --disable-do Compile even if DO-dependencies are not met],,
870 enable_do=yes)
871
872 # DO isn't used on apple-apple-apple
873 if test $LIBRARY_COMBO = apple-apple-apple; then
874 enable_do=no
875 fi
876
877 AC_ARG_WITH(ffcall-include,
878 [ --with-ffcall-include=PATH include path for ffcall headers],
879 ffcall_incdir="$withval", ffcall_incdir="no")
880 if test ${ffcall_incdir} != "no"; then
881 ffcall_check_lib_save_cppflags="$CPPFLAGS"
882 CPPFLAGS="-I${ffcall_incdir} $CPPFLAGS"
883 fi
884
885 AC_ARG_WITH(ffcall-library,
886 [ --with-ffcall-library=PATH library path for ffcall libraries],
887 ffcall_libdir="$withval", ffcall_libdir="no")
888 if test ${ffcall_libdir} != "no"; then
889 ffcall_check_lib_save_libs="$LIBS"
890 LIBS="-L${ffcall_libdir} $LIBS"
891 fi
892
893 AC_CHECK_HEADER(ffi.h, , enable_libffi=no)
894 AC_CHECK_HEADERS(callback.h, , enable_ffcall=no)
895
896 have_forward_hook=yes
897 AC_MSG_CHECKING("for forwarding callback in runtime")
898 AC_EGREP_HEADER(__objc_msg_forward, objc/objc-api.h, AC_MSG_RESULT(yes),
899 AC_MSG_RESULT(no); have_forward_hook=no)
900 if test $have_forward_hook = no; then
901 enable_libffi=no
902 enable_ffcall=no
903 fi
904
905 AC_MSG_CHECKING("FFI library usage")
906 WITH_FFI=none
907 if test $enable_libffi = yes; then
908 AC_DEFINE(USE_LIBFFI,1,
909 [Define if using the libffi library for invocations])
910 WITH_FFI=libffi
911 LIBS="$LIBS -lffi"
912 AC_MSG_RESULT(libffi)
913 elif test $enable_ffcall = yes; then
914 AC_DEFINE(USE_FFCALL,1,
915 [Define if using the ffcall library for invocations])
916 WITH_FFI=ffcall
917 LIBS="$LIBS -lcallback -lavcall"
918 AC_MSG_RESULT(ffcall)
919 else
920 AC_MSG_RESULT(none)
921 echo
922 echo "GNUstep requires ffcall or libffi and proper libobjc hooks to do"
923 echo "invocations and DO."
924 echo "Make sure one of these libraries is installed and you have a proper"
925 echo "libobjc library. Otherwise DO will not be compatible with other"
926 echo "systems, and you will not be able to use gnustep-gui."
927 echo "(This does not apply on apple-apple-apple systems, except DO will"
928 echo "still not be compatible with other GNUstep systems.)"
929 if test $enable_do = yes; then
930 echo
931 echo "You most likely do not want to build base without DO support. Many"
932 echo "things, including all applications, won't work at all without DO."
933 echo "If you really want to build -base without DO support, add --disable-do"
934 echo "to the configure arguments."
935 echo "For more information, read the GNUstep build guide, ffcall section:"
936 echo "http://documents.made-it.com/GNUstep/buildguide.html#FOREIGN.FUNCTION.INTERFACES"
937 AC_MSG_ERROR([Incomplete support for ffi functionality.])
938 fi
939 AC_MSG_WARN([Incomplete support for ffi funtionality.])
940 fi
941 AC_SUBST(WITH_FFI)
942
943 #--------------------------------------------------------------------
944 # Check recent libxml for Properytlists, GSXML, GSDoc etc.
945 #--------------------------------------------------------------------
946
947 # Save CFLAGS and LIBS as AM_PATH_XML clobbers these variables regardless
948 # of the success of the macro.
949 saved_LIBS="$LIBS"
950 saved_CFLAGS="$CFLAGS"
951
952 AM_PATH_XML(2.3.0, enable_libxml=yes, enable_libxml=no)
953 if test $enable_libxml = yes; then
954 CPPFLAGS="$CPPFLAGS $XML_CFLAGS"
955 INCLUDE_FLAGS="$INCLUDE_FLAGS $XML_CFLAGS"
956 LIBS="$LIBS $XML_LIBS"
957 HAVE_LIBXML=1
958 AC_DEFINE(HAVE_LIBXML,1,
959 [Define if libxml available])
960 else
961 HAVE_LIBXML=0
962 # Restore the CFLAGS and LIBS because AM_PATH_XML messes them
963 LIBS="$saved_LIBS"
964 CFLAGS="$saved_CFLAGS"
965 fi
966 AC_SUBST(HAVE_LIBXML)
967
968 #--------------------------------------------------------------------
969 # Check GMP for NSDecimal
970 #--------------------------------------------------------------------
971 AC_ARG_WITH(gmp-include,
972 [ --with-gmp-include=PATH include path for gmp headers],
973 gmp_incdir="$withval", gmp_incdir="no")
974
975 AC_ARG_WITH(gmp-library,
976 [ --with-gmp-library=PATH library path for gmp libraries],
977 gmp_libdir="$withval", gmp_libdir="no")
978
979 cppflags_temp="$CPPFLAGS"
980 libs_temp=$LIBS
981
982 if test "$gmp_incdir" != "no"; then
983 CPPFLAGS="$CPPFLAGS -I$gmp_incdir"
984 INCLUDE_FLAGS="$INCLUDE_FLAGS -I$gmp_incdir"
985 fi
986 if test "$gmp_libdir" != "no"; then
987 LIBS="$LIBS -L$gmp_libdir"
988 fi
989
990 USE_GMP=0
991 AC_CHECK_HEADERS(gmp.h)
992 if test $ac_cv_header_gmp_h = yes; then
993 AC_CHECK_LIB(gmp, mpf_abs, gmp_ok=yes, gmp_ok=no)
994 if test "$gmp_ok" = no; then
995 AC_CHECK_LIB(gmp, __gmpf_abs, gmp_ok=yes, gmp_ok=no)
996 fi
997 if test "$gmp_ok" = yes; then
998 LIBS="$LIBS -lgmp"
999 USE_GMP=1
1000 fi
1001 fi
1002
1003 if test "$USE_GMP" = "0"; then
1004 CPPFLAGS="$cppflags_temp";
1005 LIBS="$libs_temp";
1006 fi
1007 AC_SUBST(USE_GMP)
1008
1009 #--------------------------------------------------------------------
1010 # Check for iconv support (for Unicode conversion).
1011 #--------------------------------------------------------------------
1012 # Check in the glibc library
1013 AC_CHECK_FUNCS(iconv)
1014 if test $ac_cv_func_iconv = no; then
1015 # Check if we have a libiconv library
1016 AC_ARG_WITH(libiconv-library,
1017 [ --with-libiconv-library=PATH library path for libiconv libraries],
1018 libiconv_libdir="$withval", libiconv_libdir="no")
1019 ldflags_temp="$LDFLAGS"
1020
1021 if test "$libiconv_libdir" != "no"; then
1022 LDFLAGS="$LDFLAGS -L$libiconv_libdir"
1023 LIBS="$LIBS -L$libiconv_libdir"
1024 fi
1025
1026 # BSDs install this lib as libgiconv
1027 AC_CHECK_LIB(giconv, main)
1028 if test x"$ac_cv_lib_giconv_main" = xyes; then
1029 AC_DEFINE(HAVE_ICONV,1, [Define if you have this function])
1030 AC_DEFINE(HAVE_GICONV_H,1, [Define if you have this header])
1031 else
1032 AC_CHECK_LIB(iconv, main)
1033 if test x"$ac_cv_lib_iconv_main" = xyes; then
1034 AC_DEFINE(HAVE_ICONV,1, [Define if you have this function])
1035 fi
1036 fi
1037 LDFLAGS="$ldflags_temp"
1038 fi
1039
1040 AC_SUBST(INCLUDE_FLAGS)
1041
1042 AC_CONFIG_SUBDIRS(Source/mframe SSL)
1043
1044 #--------------------------------------------------------------------
1045 # Record the version
1046 #--------------------------------------------------------------------
1047 AC_MSG_CHECKING(for the version of gnustep-base we are compiling)
1048 if test -f "Version"; then
1049 . ./Version
1050 fi
1051 AC_MSG_RESULT($VERSION)
1052 AC_SUBST(VERSION)
1053 AC_SUBST(MAJOR_VERSION)
1054 AC_SUBST(MINOR_VERSION)
1055 AC_SUBST(SUBMINOR_VERSION)
1056 AC_SUBST(GCC_VERSION)
1057
1058 #--------------------------------------------------------------------
1059 # Write the Makefiles
1060 #--------------------------------------------------------------------
1061 AC_CONFIG_FILES([config.mak base.make Headers/Additions/GNUstepBase/GSConfig.h
1062 Headers/Additions/GNUstepBase/preface.h])
1063 AC_OUTPUT

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26