mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 17:10:48 +00:00
Split autoconf macros out of aclocal.m4
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9470 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
af46212b24
commit
ffa79f407d
6 changed files with 204 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2001-03-21 Jonathan Gapen <jagapen@home.com>
|
||||
|
||||
* config/nextcc.m4, config/objc-con-autoload.m4, config/procfs.m4,
|
||||
config/objc-sys-dynamic.m4, config/procfs-exe-link.m4: Autoconf
|
||||
macros used by configure.in.
|
||||
|
||||
2001-03-19 Jonathan Gapen <jagapen@home.com>
|
||||
|
||||
* Source/NSString.m: Implement ([-localizedStringWithFormat:]).
|
||||
|
|
19
config/nextcc.m4
Normal file
19
config/nextcc.m4
Normal file
|
@ -0,0 +1,19 @@
|
|||
dnl AC_PROG_NEXTCC
|
||||
dnl Check for NeXT compiler.
|
||||
AC_DEFUN(AC_PROG_NEXTCC,
|
||||
[ AC_CACHE_CHECK(whether we are using the NeXT compiler, ac_prog_nextcc,
|
||||
[AC_EGREP_CPP(yes,
|
||||
[#if defined(NeXT)
|
||||
#if defined(_NEXT_SOURCE)
|
||||
no
|
||||
#else
|
||||
yes
|
||||
#endif
|
||||
#else
|
||||
no
|
||||
#endif], ac_prog_nextcc=yes, ac_prog_nextcc=no)])
|
||||
|
||||
if test "$ac_prog_nextcc" = yes; then
|
||||
NeXTCC=yes
|
||||
fi
|
||||
])
|
40
config/objc-con-autoload.m4
Normal file
40
config/objc-con-autoload.m4
Normal file
|
@ -0,0 +1,40 @@
|
|||
AC_DEFUN(OBJC_CON_AUTOLOAD,
|
||||
#--------------------------------------------------------------------
|
||||
# Guess if we are using a object file format that supports automatic
|
||||
# loading of constructor functions.
|
||||
#
|
||||
# If this system supports autoloading of constructors, that means that gcc
|
||||
# doesn't have to do it for us via collect2. This routine tests for this
|
||||
# in a very roundabout way by compiling a program with a constructor and
|
||||
# testing the file, via nm, for certain symbols that collect2 includes to
|
||||
# handle loading of constructors.
|
||||
#
|
||||
# Makes the following substitutions:
|
||||
# Defines CON_AUTOLOAD (whether constructor functions are autoloaded)
|
||||
#--------------------------------------------------------------------
|
||||
[dnl
|
||||
AC_MSG_CHECKING(loading of constructor functions)
|
||||
AC_CACHE_VAL(objc_cv_con_autoload,
|
||||
[dnl
|
||||
cat > conftest.constructor.c <<EOF
|
||||
void cons_functions() __attribute__ ((constructor));
|
||||
void cons_functions() {}
|
||||
int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.constructor.$ac_ext $LIBS 1>&5
|
||||
if test -n "`nm conftest | grep _ctors_aux`"; then
|
||||
objc_cv_con_autoload=yes
|
||||
else
|
||||
objc_cv_con_autoload=no
|
||||
fi
|
||||
])
|
||||
if test $objc_cv_con_autoload = yes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(CON_AUTOLOAD)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
])
|
85
config/objc-sys-dynamic.m4
Normal file
85
config/objc-sys-dynamic.m4
Normal file
|
@ -0,0 +1,85 @@
|
|||
AC_DEFUN(OBJC_SYS_DYNAMIC_LINKER,
|
||||
[dnl
|
||||
AC_REQUIRE([OBJC_CON_AUTOLOAD])dnl
|
||||
#--------------------------------------------------------------------
|
||||
# Guess the type of dynamic linker for the system
|
||||
#
|
||||
# Makes the following substitutions:
|
||||
# DYNAMIC_LINKER - cooresponds to the interface that is included
|
||||
# in objc-load.c (i.e. #include "${DYNAMIC_LINKER}-load.h")
|
||||
#--------------------------------------------------------------------
|
||||
DYNAMIC_LINKER=null
|
||||
AC_CHECK_HEADER(dlfcn.h, DYNAMIC_LINKER=simple)
|
||||
if test $DYNAMIC_LINKER = null; then
|
||||
AC_CHECK_HEADER(dl.h, DYNAMIC_LINKER=hpux)
|
||||
fi
|
||||
if test $DYNAMIC_LINKER = null; then
|
||||
AC_CHECK_HEADER(windows.h, DYNAMIC_LINKER=win32)
|
||||
fi
|
||||
if test $DYNAMIC_LINKER = null; then
|
||||
AC_CHECK_HEADER(dld/defs.h, DYNAMIC_LINKER=dld)
|
||||
fi
|
||||
|
||||
if test $DYNAMIC_LINKER = simple; then
|
||||
AC_TRY_LINK([#include <dlfcn.h>], dladdr(0,0);,
|
||||
AC_DEFINE(HAVE_DLADDR))
|
||||
fi
|
||||
|
||||
AC_SUBST(DYNAMIC_LINKER)dnl
|
||||
])
|
||||
AC_DEFUN(OBJC_SYS_DYNAMIC_FLAGS,
|
||||
[dnl
|
||||
AC_REQUIRE([OBJC_CON_AUTOLOAD])dnl
|
||||
AC_REQUIRE([OBJC_SYS_DYNAMIC_LINKER])dnl
|
||||
#--------------------------------------------------------------------
|
||||
# Set the flags for compiling dynamically loadable objects
|
||||
#
|
||||
# Makes the following substitutions:
|
||||
# DYNAMIC_BUNDLER_LINKER - The command to link the object files into
|
||||
# a dynamically loadable module.
|
||||
# DYNAMIC_LDFLAGS - Flags required when compiling the main program
|
||||
# that will do the dynamic linking
|
||||
# DYNAMIC_CFLAGS - Flags required when compiling the object files that
|
||||
# will be included in the loaded module.
|
||||
#--------------------------------------------------------------------
|
||||
if test $DYNAMIC_LINKER = dld; then
|
||||
DYNAMIC_BUNDLER_LINKER="ld -r"
|
||||
DYNAMIC_LDFLAGS="-static"
|
||||
DYNAMIC_CFLAGS=""
|
||||
elif test $DYNAMIC_LINKER = simple; then
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="-shared"
|
||||
AC_TRY_LINK([extern void loadf();], loadf();,
|
||||
objc_shared_linker=yes, objc_shared_linker=no)
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
if test $objc_shared_linker = yes; then
|
||||
DYNAMIC_BUNDLER_LINKER='$(CC) -shared'
|
||||
elif test $objc_cv_con_autoload = yes; then
|
||||
DYNAMIC_BUNDLER_LINKER='$(CC) -Xlinker -r'
|
||||
else
|
||||
DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib'
|
||||
fi
|
||||
save_LDFLAGS=$LDFLAGS
|
||||
LDFLAGS="-rdynamic"
|
||||
AC_TRY_RUN([], objc_dynamic_ldflag="-rdynamic", objc_dynamic_ldflag="",
|
||||
objc_dynamic_ldflag="")
|
||||
LDFLAGS=$save_LDFLAGS
|
||||
DYNAMIC_LDFLAGS="$objc_dynamic_ldflag"
|
||||
DYNAMIC_CFLAGS="-fPIC"
|
||||
elif test $DYNAMIC_LINKER = hpux; then
|
||||
DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib -Xlinker -b'
|
||||
DYNAMIC_LDFLAGS="-Xlinker -E"
|
||||
DYNAMIC_CFLAGS="-fPIC"
|
||||
elif test $DYNAMIC_LINKER = null; then
|
||||
DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib -Xlinker -r'
|
||||
DYNAMIC_LDFLAGS=""
|
||||
DYNAMIC_CFLAGS=""
|
||||
else
|
||||
DYNAMIC_BUNDLER_LINKER='$(CC) -nostdlib -Xlinker -r'
|
||||
DYNAMIC_LDFLAGS=""
|
||||
DYNAMIC_CFLAGS=""
|
||||
fi
|
||||
AC_SUBST(DYNAMIC_BUNDLER_LINKER)dnl
|
||||
AC_SUBST(DYNAMIC_LDFLAGS)dnl
|
||||
AC_SUBST(DYNAMIC_CFLAGS)dnl
|
||||
])
|
28
config/procfs-exe-link.m4
Normal file
28
config/procfs-exe-link.m4
Normal file
|
@ -0,0 +1,28 @@
|
|||
dnl AC_SYS_PROCFS_EXE_LINK
|
||||
dnl This macro checks for the existence of a symlink in /proc to the executable
|
||||
dnl file associated with the current process, and defines PROCFS_EXE_LINK to
|
||||
dnl the path it finds. Currently supports Linux and FreeBSD variants.
|
||||
AC_DEFUN(AC_SYS_PROCFS_EXE_LINK,
|
||||
[ AC_REQUIRE([AC_SYS_PROCFS])
|
||||
|
||||
AC_CACHE_CHECK([link to exe of process in /proc], ac_cv_sys_procfs_exe_link,
|
||||
[if test "$ac_cv_sys_procfs" = yes; then
|
||||
# Linux 2.2.x and up
|
||||
if test -L /proc/self/exe; then
|
||||
ac_cv_sys_procfs_exe_link=/proc/self/exe
|
||||
# FreeBSD 2.2.1 and up
|
||||
elif test -L /proc/curproc/file; then
|
||||
ac_cv_sys_procfs_exe_link=/proc/curproc/file
|
||||
# Solaris 2.6 and up
|
||||
elif test -L /proc/self/object/a.out; then
|
||||
ac_cv_sys_procfs_exe_link=/proc/self/object/a.out
|
||||
else
|
||||
ac_cv_sys_procfs_exe_link=no
|
||||
fi
|
||||
fi])
|
||||
|
||||
if test "$ac_cv_sys_procfs_exe_link" != no; then
|
||||
AC_DEFINE_UNQUOTED(PROCFS_EXE_LINK, ["$ac_cv_sys_procfs_exe_link"],
|
||||
[Define as the link to exe of process in /proc filesystem.])
|
||||
fi
|
||||
])
|
26
config/procfs.m4
Normal file
26
config/procfs.m4
Normal file
|
@ -0,0 +1,26 @@
|
|||
dnl AC_SYS_PROCFS
|
||||
dnl This macro defines HAVE_PROCFS if either it finds a mounted /proc
|
||||
dnl or the user explicitly enables it for cross-compiles.
|
||||
AC_DEFUN(AC_SYS_PROCFS,
|
||||
[ AC_ARG_WITH(enable_procfs,
|
||||
[ --enable-procfs Use /proc filesystem (default)],
|
||||
enable_procfs="$enableval", if test "$cross_compiling" = yes; then enable_procfs=cross; else enable_procfs=yes; fi;)
|
||||
|
||||
AC_CACHE_CHECK([kernel support for /proc filesystem], ac_cv_sys_procfs,
|
||||
[if test "$enable_procfs" = yes; then
|
||||
dnl Check whether /proc is mounted and readable by checking the entry
|
||||
dnl for process number 1, which every system should have.
|
||||
if test -d /proc/1; then
|
||||
ac_cv_sys_procfs=yes
|
||||
else
|
||||
ac_cv_sys_procfs=no
|
||||
fi
|
||||
elif test "$enable_procfs" = cross; then
|
||||
AC_MSG_WARN(Pass --enable-procfs argument to enable use of /proc filesystem.)
|
||||
fi])
|
||||
|
||||
if test $ac_cv_sys_procfs = yes; then
|
||||
AC_DEFINE(HAVE_PROCFS, 1, [Define if system supports the /proc filesystem])
|
||||
fi
|
||||
]
|
||||
)
|
Loading…
Reference in a new issue