3 AC_INIT(${srcdir}/Foundation/NSObject.h.in)
5 # ******************** GNUstep env ************************************
7 if test "x${GNUSTEP_MAKEFILES}" = "x"; then
8 AC_MSG_ERROR(Your GNUstep.sh is not sourced, please load GNUstep.sh prior running configure!)
11 # ******************** version ****************************************
13 # todo: read from Version file?
18 AC_SUBST(MAJOR_VERSION)
19 AC_SUBST(MINOR_VERSION)
20 AC_SUBST(SUBMINOR_VERSION)
23 # ******************** options ****************************************
27 Use the ffcall library to implement dynamic invocation of methods. Note
28 the licensing restrictions of ffcall before enabling that switch !],
36 Use the Boehm's garbage collector for automatic memory management instead
37 of the normal OpenStep memory management policy.
38 Search in DIR for GC include files (eg DIR=objc leads to <objc/gc.h>)],
39 [ac_cv_use_gc=yes; ac_cv_link_gc=yes;
40 if [ test x${withval} != xyes ]; then
41 GC_INCLUDE_DIR="${withval}/"
46 [ac_cv_use_gc=no; ac_cv_link_gc=no; GC_INCLUDE_DIR=""]
52 Link against GC library LIB. The default is 'gc'. Do not specify
53 --with-gc-lib if you have the GC contained in some of your system
54 libraries (eg libobjc.a)],
56 if [ test x${withval} != xyes ]; then
62 [ac_cv_link_gc=no; GC_LIB=""]
65 AC_SUBST(GC_INCLUDE_DIR)
69 # ******************** system type ************************************
71 # Determine the host, build, and target systems
72 CC_TARGET=$target # use --target value for CC, not the canonical form
74 AC_PREFIX_DEFAULT(/usr/local)
76 AC_CONFIG_HEADER(config.h:config.h.in.sed dnl
77 Foundation/NSObject.h:Foundation/NSObject.h.in.sed dnl
78 Foundation/lfmemory.h:Foundation/lfmemory.h.in.sed)
80 # check for cross compilation
82 if [[ x$target = xNONE ]]; then
86 if test "x$host" != "x$target"; then
87 cross_defines="CROSS=-DCROSS_COMPILE"
89 echo "cross compiling from $host to $target .."
93 RANLIB=${CC_TARGET}-ranlib
97 case "x${host_cpu}" in
98 xi[456]86*) host_cpu=i386;;
99 xhppa1.1) host_cpu=hppa;;
102 if test "x$cross_compiling" = xyes; then
103 case "x${target_cpu}" in
104 xi[456]86*) target_cpu=i386;;
105 xhppa1.1) target_cpu=hppa;;
108 target_cpu=${host_cpu}
110 target_vendor=${host_vendor}
113 case "x${target_os}" in
114 xfreebsd*) target_os=freebsd;;
119 # Assign the HOST/TARGET variables for sharedlib.mak
122 HOST_VENDOR=$host_vendor
125 TARGET_CPU=$target_cpu
126 TARGET_VENDOR=$target_vendor
129 if test ! -f ${srcdir}/config/${target_cpu}/${target_os}.h; then
130 if test -d ${srcdir}/config/${target_cpu}; then
132 echo '*************** Warning ****************'
133 echo This package was not ported to $target_cpu running $target_os operating system.
134 echo We\'ll use the default configuration file ${srcdir}/config/$target_cpu/$target_cpu.h.
135 echo '****************************************'
137 target_os=$target_cpu
140 echo '*************** Warning ****************'
141 echo This package was not ported to $target_cpu running $target_os operating system.
142 echo We\'ll use a generic configuration file, thus you will be able to compile the library, but most probably the NSInvocation, NSMethodSignature and all classes that use them will not work correctly or will not work at all.
143 echo '****************************************'
150 # ******************** autoconf vars **********************************
152 AC_SUBST(WITH_GNUSTEP)
154 AC_DEFINE(WITH_GNUSTEP)
156 AC_SUBST(WITH_FFCALL)
157 WITH_FFCALL=$ac_cv_use_ffcall
158 if test "x$ac_cv_use_ffcall" = xyes; then
159 AC_DEFINE(WITH_FFCALL)
163 WITH_GC=$ac_cv_use_gc
164 if test "$WITH_GC" = yes; then
165 AC_DEFINE(LIB_FOUNDATION_BOEHM_GC)
169 if test "x$cross_compiling" = xyes; then
170 echo "cross compiling to $target"
174 # ******************** system tools ***********************************
178 AC_CHECK_PROGS(MAKE, gmake gnumake make)
179 AC_CHECK_PROGS(AR, ar)
180 AC_CHECK_PROGS(LD, ld)
181 AC_CHECK_PROGS(PERL, perl)
185 if test "x$cross_compiling" = xyes; then
186 if [[ "x${target_cpu}" = xi386 ]]; then
187 echo "WARNING: using predefined structure alignment of 4 for i386 !"
188 ac_cv_struct_alignment=4
190 elif [[ "x${target_cpu}" = xsparc ]]; then
191 echo "WARNING: using predefined structure alignment of 8 for ${target_cpu} !"
192 ac_cv_struct_alignment=8
194 elif [[ "x${target_cpu}" = xmipsel ]]; then
195 echo "WARNING: using predefined structure alignment of 8 for ${target_cpu} !"
196 ac_cv_struct_alignment=8
199 echo "ERROR: unknown structure alignment for CPU ${target_cpu}, using 4 !"
200 ac_cv_struct_alignment=4
207 AC_CHECK_LIB(dl, dlopen)
208 AC_CHECK_LIB(pcthread, pthread_create,
210 AC_CHECK_LIB(pthread, pthread_create))
211 AC_CHECK_LIB(m, sqrt)
212 AC_CHECK_LIB(nsl, chown)
213 AC_CHECK_LIB(socket, accept)
216 transformed_target_cpu=`${GNUSTEP_MAKEFILES}/clean_cpu.sh ${TARGET_CPU}`
217 ac_cv_file_output_prefix=Foundation/$transformed_target_cpu/${TARGET_OS}/$RUNTIME
220 AC_CHECK_NESTED_FUNCTIONS
223 if test $target_cpu = i386; then
224 AC_BROKEN_BUILTIN_APPLY
227 # If we're using the Boehm's GC check to see if we have the gc.h file and
230 AC_HAVE_HEADERS(${GC_INCLUDE_DIR}gc.h)
232 if test "x$ac_cv_link_gc" = xyes; then
233 AC_CHECK_LIB(${GC_LIB}, GC_malloc)
234 if test "x$ac_cv_header_gc_h" != xyes -o "x$ac_cv_lib_gc_GC_malloc" != xyes; then
236 AC_MSG_ERROR(It appears your system doesn't have the Boehm's garbage collector installed! Please install it first or check your paths in case it's already installed. Note that we expect the Boehm's GC library to be named so that linking using -lgc works; please be careful as the normal 'make' in Boehm's GC neither creates the library nor installs it. You should copy the files gc.h and gc.a in the appropriate directories and rename gc.a to libgc.a.)
242 if test x"$cross_compiling" = xyes; then
243 echo "WARNING: cannot check for byte-order during cross compilation."
248 AC_COMPILE_CHECK_SIZEOF(short)
249 AC_COMPILE_CHECK_SIZEOF(int)
250 AC_COMPILE_CHECK_SIZEOF(long)
251 AC_COMPILE_CHECK_SIZEOF(long long)
252 AC_COMPILE_CHECK_SIZEOF(float)
253 AC_COMPILE_CHECK_SIZEOF(double)
254 AC_COMPILE_CHECK_SIZEOF(long double)
257 AC_HAVE_HEADERS(dir.h libc.h sys/time.h stdlib.h memory.h string.h dnl
258 strings.h sys/stat.h sys/vfs.h sys/statfs.h sys/statvfs.h dnl
259 netinet/in.h windows.h dnl
260 Windows32/Sockets.h pwd.h process.h grp.h sys/param.h dnl
261 sys/file.h sys/errno.h sys/select.h)
264 AC_CHECK_FUNCS(memcpy ualarm getcwd getuid getpwnam getpwuid kill raise dnl
265 getpagesize statvfs chown symlink readlink opendir fsync dnl
266 sysconf GetSystemInfo gettimeofday GetLocalTime sigsetmask dnl
267 sigset sigaction sighold dnl
268 gethostbyname_r gethostbyaddr_r gethostent_r)
276 if test "$cross_compiling" = yes; then
277 echo "WARNING: cannot check for restartable system calls during cross compilation."
279 AC_SYS_RESTARTABLE_SYSCALLS
283 # ******************** GNUstep.sh-less compilation ********************
285 AC_SUBST(GNUSTEP_FLATTENED)
286 AC_SUBST(GNUSTEP_HOST)
287 AC_SUBST(GNUSTEP_HOST_CPU)
288 AC_SUBST(GNUSTEP_HOST_OS)
289 AC_SUBST(GNUSTEP_HOST_VENDOR)
290 AC_SUBST(GNUSTEP_LOCAL_ROOT)
291 AC_SUBST(GNUSTEP_MAKEFILES)
292 AC_SUBST(GNUSTEP_NETWORK_ROOT)
293 AC_SUBST(GNUSTEP_PATHLIST)
294 AC_SUBST(GNUSTEP_ROOT)
295 AC_SUBST(GNUSTEP_SYSTEM_ROOT)
296 AC_SUBST(GNUSTEP_USER_ROOT)
297 AC_SUBST(LIBRARY_COMBO)
300 # ******************** output *****************************************
302 AC_OUTPUT(config.h.in.sed:config.h.in config.mak gsfix.make dnl
303 Foundation/libFoundation.make dnl
304 Foundation/NSObject.h.in.sed:Foundation/NSObject.h.in dnl
305 Foundation/lfmemory.h.in.sed:Foundation/lfmemory.h.in,
306 [rm -f config.h.in.sed Foundation/NSObject.h.in.sed Foundation/lfmemory.h.in.sed
307 # Read the variables from config.cache
310 # Create the output directory
311 if test ! -d $ac_cv_file_output_prefix; then
312 ${srcdir}/mkinstalldirs $ac_cv_file_output_prefix
315 # Move the config.h and config.mak over to the $ac_cv_file_output_prefix
316 mv config.h $ac_cv_file_output_prefix
317 mv config.mak $ac_cv_file_output_prefix
320 # create the appropriate memory management file
322 mv -f Foundation/lfmemory.h $ac_cv_file_output_prefix
324 # Create the NSException.h file to include a file in
325 # $ac_cv_file_output_prefix
326 # which is the actual exceptions definition file.
329 echo "#include <real_exception_file.h>" >NSException.h)
332 # Now create the real_exception_file.h based upon the compiler support
334 rm -f Foundation/$ac_cv_file_output_prefix/real_exception_file.h
335 if test ${ac_cv_nested_functions} = no; then
336 echo "creating $ac_cv_file_output_prefix/real_exception_file.h from ${srcdir}/Foundation/NSExceptionWithoutNested.h"
337 cp ${srcdir}/Foundation/NSExceptionWithoutNested.h $ac_cv_file_output_prefix/real_exception_file.h
338 elif test ${ac_cv_broken_compiler} = yes; then
339 echo "creating $ac_cv_file_output_prefix/real_exception_file.h from ${srcdir}/Foundation/NSClassicException.h"
340 cp ${srcdir}/Foundation/NSClassicException.h $ac_cv_file_output_prefix/real_exception_file.h
342 echo "creating $ac_cv_file_output_prefix/real_exception_file.h from ${srcdir}/Foundation/NSFuncallException.h"
343 cp ${srcdir}/Foundation/NSFuncallException.h $ac_cv_file_output_prefix/real_exception_file.h