lyx_mirror/sigc++/configure.in

642 lines
15 KiB
Plaintext
Raw Normal View History

## (C) 1998 Stephan Kulow
## Modified by Tero Pulkkinen
## Modified by Karl Nelson
## Modified by makeLyXsigc.sh (Allan Rae)
AC_INIT(slot.cc)
AC_DEFUN(LYX_FIX_MAKEFILE_IN,[
## modify Makefile.in if need be -- since we still use automake
for dir in $srcdir $srcdir/macros ; do
( cd $dir ;
sed < Makefile.in > Makefile_tmp \
-e 's/all: all-redirect/all: all-@USE_INCLUDED_SIGC@\
all-yes: all-redirect\
all-no:/' ;
mv Makefile_tmp Makefile.in )
done
])
LYX_FIX_MAKEFILE_IN
define(AC_PUSH_LIB,[dnl
ifdef([__LIB__],,[define([__LIB__],0)])dnl
ac_save_LIBS[]__LIB__="$LIBS"
define([__LIB__],builtin(eval,(__LIB__ + 1)))dnl
LIBS="$1"])
define(AC_POP_LIB,[dnl
define([__LIB__],builtin(eval,(__LIB__ - 1)))dnl
LIBS="$ac_save_LIBS[]__LIB__"])
dnl
dnl Source packaging numbers
SIGC_MAJOR_VERSION=1
SIGC_MINOR_VERSION=0
SIGC_MICRO_VERSION=3
dnl Library extension
SIGC_RELEASE=1.0
SIGC_VERSION=$SIGC_MAJOR_VERSION.$SIGC_MINOR_VERSION.$SIGC_MICRO_VERSION
#
# +1 : ? : +1 == new interface that does not break old one
# +1 : ? : 0 == new interface that breaks old one
# ? : ? : 0 == no new interfaces, but breaks apps
# ? :+1 : ? == just some internal changes, nothing breaks but might work
# better
# CURRENT : REVISION : AGE
LIBSIGC_SO_VERSION=0:0:0
AC_SUBST(LIBSIGC_SO_VERSION, $LIBSIGC_SO_VERSION)
AC_SUBST(SIGC_RELEASE, $SIGC_RELEASE)
AC_SUBST(SIGC_VERSION)
AC_DEFINE_UNQUOTED(SIGC_MAJOR_VERSION, $SIGC_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(SIGC_MINOR_VERSION, $SIGC_MINOR_VERSION)
AC_DEFINE_UNQUOTED(SIGC_MICRO_VERSION, $SIGC_MICRO_VERSION)
AC_CONFIG_AUX_DIR(../config)
dnl For automake.
VERSION=$SIGC_VERSION
PACKAGE=libsigc++
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl Specify a configuration file
AM_CONFIG_HEADER(sigc++config.h)
AC_ARG_WITH([included-libsigc],
[ --without-included-libsigc
Use the libsigc++ installed on the system
Used when libsigc++ is bundled with applications],
[sigc_use_included_libsigc=$withval],
[sigc_use_included_libsigc=yes])
if test x$sigc_use_included_libsigc = xno; then
## just change the setting for the Makefile
USE_INCLUDED_SIGC=no
AC_SUBST(USE_INCLUDED_SIGC)
else
###
### This else..fi goes till the end of the file!
###
USE_INCLUDED_SIGC=yes
AC_SUBST(USE_INCLUDED_SIGC)
AC_ARG_ENABLE(threads,
[ --enable-threads enables support threading.],
enable_threads=$enableval,enable_threads="no")
AC_ARG_ENABLE(checks,
[ --disable-checks disables unnecessary tests needed for bug reports.],
enable_checks=$enableval,enable_checks="yes"
)
AC_PROG_CC
AC_PROG_CPP
AM_DISABLE_SHARED
dnl Instruct build of dll for cygwin (libtool 1.3)
dnl Exports screw up badly on libtool 1.3, backing off to 1.2f
dnl A C_LIBTOOL_WIN32_DLL
dnl libtool does all checks with $CC, not with $CXX
dnl maybe this should be fixed in libtool, not here
AM_PROG_LIBTOOL
dnl On FreeBSD 3.0 (and perhaps some other systems) GNU m4 is
dnl called `gm4' where `m4' is the system's own m4.
AC_CHECK_PROGS(M4, gm4 m4, m4)
AC_PROG_CXX
AC_LANG_CPLUSPLUS
dnl Checking if linker supports global constructors
dnl This is largely information for me if someone files a bug report
if test "X$enable_checks" = "Xyes"; then
AC_MSG_CHECKING([if linker supports global constructors])
cat > mylib.$ac_ext <<EOF
#include <stdio.h>
struct A
{A() {printf("PASS\n");}
};
A a;
int foo()
{return 1;}
EOF
cat > mytest.$ac_ext <<EOF
#include <stdio.h>
extern int foo();
int main(int argc,char **argv)
{
int i=foo();
if (i!=1) printf("FAIL\n");
}
EOF
sh libtool --mode=compile $CXX -c mylib.$ac_ext >&5
sh libtool --mode=link $CXX -o libtest.la -rpath / -version-info 0 mylib.lo >&5
$CXX -c $CFLAGS $CPPFLAGS mytest.$ac_ext >&5
sh libtool --mode=link $CXX -o mytest mytest.o libtest.la >&5 2>/dev/null
if test -x mytest; then
myresult=`./mytest`
if test "X$myresult" = "XPASS"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([
===================================================================
WARNING: This platform lacks support of construction of global
objects in shared librarys. Although not required by this library,
this is a serious problem for building C++ libraries. You will not
be able to use any shared libraries that contain global objects with
contructors.
See ftp://rtfm.mit.edu/pub/usenet/news.answers/g++-FAQ/plain
for details about this problem. Also for possible solutions
http://www.informatik.uni-frankfurt.de/~fp/Tcl/tcl-c++/tcl-c++.html
===================================================================
])
fi
else
AC_MSG_RESULT(unknown)
fi
rm -f mylib.* mytest.* libtest.la .libs/libtest* mytest .libs/mytest >&5
fi
AC_MSG_CHECKING(if C++ compiler uses std namespace )
AC_TRY_COMPILE(
[
#include <iostream>
namespace std{ void kludge(); }
using namespace std;
],[
cout << "test" << endl;
],[
ac_std_namespace=yes
AC_MSG_RESULT([yes])
],[
ac_std_namespace=maybe
])
if test "x$ac_std_namespace" = xmaybe ; then
AC_TRY_COMPILE(
[
#include <iostream.h>
namespace std{ void kludge(); }
using namespace std;
],[
cout << "test" << endl;
],[
ac_std_namespace=yes
AC_MSG_RESULT([yes])
AC_MSG_WARN([
===================================================================
WARNING: This compiler platform does not have the iostream library
in the std namespace. This presents a problem for writing portable
STL code. To run the demos, you will need to place a file with the
following in a file called "iostream" in your include directory.
---------------------------iostream--------------------------------
#ifndef IOSTREAM_KLUDGE
#define IOSTREAM_KLUDGE
#include <iostream.h>
namespace std { void iostream_kludge(); };
#endif
===================================================================
])
],[
ac_std_namespace=no
AC_MSG_RESULT([no])
AC_MSG_WARN([
===================================================================
WARNING: This compiler platform does not support iostream
or namespaces. You will not be able to run the demos as they
use STL. This does not affect use of the library, only the demos.
===================================================================
])
])
fi
dnl
dnl C++ compiler feature check start here
AC_MSG_CHECKING(if C++ compiler supports bool (required))
AC_TRY_COMPILE(
[
],[
bool b=true;
bool b1=false;
],[
ac_bool=yes
AC_MSG_RESULT([$ac_bool])
],[
config_error=yes
AC_MSG_RESULT([$ac_bool])
AC_WARN(bool type is not supported by your compiler)
])
AC_MSG_CHECKING([if C++ compiler supports const_cast<> (required)])
AC_TRY_COMPILE(
[
class foo;
],[
const foo *c=0;
foo *c1=const_cast<foo*>(c);
],[
ac_const_cast=yes
AC_MSG_RESULT([$ac_const_cast])
],[
AC_MSG_RESULT([$ac_const_cast])
AC_WARN(C++ compiler const_cast<> does not work)
config_error=yes
])
# Member function templates
AC_MSG_CHECKING(if C++ compiler supports member function templates)
AC_TRY_COMPILE(
[
class foo
{
public:
template <class T> void method(T t);
};
template <class T> void foo::method(T t) {t = 0;}
],[
],[
ac_member_func_templates=yes
AC_DEFINE(SIGC_CXX_MEMBER_FUNC_TEMPLATES)
AC_MSG_RESULT([$ac_member_func_templates])
],[
ac_member_func_templates=no
AC_MSG_RESULT([$ac_member_func_templates])
config_error=yes
AC_MSG_WARN([Test for member templates failed. This disables some methods that requires member template support. If your compiler should support member templates, see config.log to figure out why the test failed.])
])
# Member class templates
AC_MSG_CHECKING(if C++ compiler supports member class templates)
AC_TRY_COMPILE(
[
struct S
{
template <class T> struct A {};
template <class T> struct B {};
};
],[
],[
ac_member_class_templates=yes
AC_DEFINE(SIGC_CXX_MEMBER_CLASS_TEMPLATES)
AC_MSG_RESULT([$ac_member_class_templates])
],[
ac_member_class_templates=no
AC_MSG_RESULT([$ac_member_class_templates])
AC_MSG_WARN([Test for member templates failed. This disables some methods that requires member template support. If your compiler should support member templates, see config.log to figure out why the test failed.])
])
# Mutable
AC_MSG_CHECKING(if C++ compiler supports mutable)
AC_TRY_COMPILE(
[
class k {
mutable char *c;
public:
void foo() const { c=0; }
};
],[
],[
ac_cxx_mutable=yes
AC_DEFINE(SIGC_CXX_MUTABLE)
],[
ac_cxx_mutable=no
])
AC_MSG_RESULT([$ac_cxx_mutable])
# Partial Specialization
AC_MSG_CHECKING([if C++ compiler supports partial specialization(required)])
AC_TRY_COMPILE(
[
template<class T, class K>
class k {
public:
};
template<class T> class k<void,T> { };
],[
k<float, float> b;
k<void,void> a;
],[
ac_cxx_partial_specialization=yes
AC_MSG_RESULT([$ac_cxx_partial_specialization])
AC_DEFINE(SIGC_CXX_PARTIAL_SPEC)
],[
config_error=yes
ac_cxx_partial_specialization=no
AC_MSG_RESULT([$ac_cxx_partial_specialization])
AC_MSG_WARN([Partial specialization is needed for signal templates.])
])
AC_MSG_CHECKING(if C++ compiler supports name spaces)
AC_TRY_COMPILE(
[
namespace Check
{
int i;
}
],[
Check::i=1;
],[
ac_cxx_namespaces=yes
AC_MSG_RESULT([$ac_cxx_namespaces])
AC_DEFINE(SIGC_CXX_NAMESPACES)
],[
ac_cxx_namespaces=no
AC_MSG_RESULT([$ac_cxx_namespaces])
AC_MSG_WARN([Without namespaces all classes will be global.])
])
AC_MSG_CHECKING(if C++ compiler supports friend template)
AC_TRY_COMPILE(
[
struct A
{
template <class T>
friend T* gen();
};
],[
],[
ac_cxx_friend_templates=yes
AC_MSG_RESULT([$ac_cxx_friend_templates])
AC_DEFINE(SIGC_CXX_FRIEND_TEMPLATES)
],[
ac_cxx_friend_templates=no
AC_MSG_RESULT([$ac_cxx_friend_templates])
AC_MSG_WARN([Access to dynamic will not be controlled.])
])
AC_MSG_CHECKING(if C++ compiler has intrinsic constructors)
AC_TRY_COMPILE(
[
template<class T>
struct A
{ T t;
A(): t() {}
};
A<int> i;
],[
],[
AC_DEFINE(SIGC_CXX_INT_CTOR)
ac_cxx_tmpl_intctor=yes
],[
ac_cxx_tmpl_intctor=no
])
AC_MSG_RESULT([$ac_cxx_tmpl_intctor])
AC_MSG_CHECKING(if C++ compiler uses template copy ctor)
AC_TRY_COMPILE(
[
template <class T>
struct A
{
A(const A&) {}
template <class T1>
A(const T1&) {}
};
],[
],[
ac_cxx_template_cctor=no
],[
AC_DEFINE(SIGC_CXX_TEMPLATE_CCTOR)
ac_cxx_template_cctor=yes
])
AC_MSG_RESULT([$ac_cxx_template_cctor])
AC_MSG_CHECKING(if C++ compiler allows void returns)
AC_TRY_COMPILE(
[
void g(int *p)
{}
void h(int *p)
{return g(p);}
],[
],[
ac_cxx_void_return=yes
AC_DEFINE(SIGC_CXX_VOID_RETURN)
],[
ac_cxx_void_return=no
])
AC_MSG_RESULT([$ac_cxx_void_return])
AC_MSG_CHECKING(if C++ compiler allows specialization of references)
AC_TRY_COMPILE(
[
struct A {};
struct B {};
template <class T>
struct P
{
typedef A* ptr;
};
template <class T>
struct P<T&>
{
typedef B* ptr;
};
],[
A* a;
B* b;
P<int>::ptr p=a;
P<int&>::ptr q=b;
],[
ac_cxx_specialize_references=yes
AC_DEFINE(SIGC_CXX_SPECIALIZE_REFERENCES)
],[
ac_cxx_specialize_references=no
])
AC_MSG_RESULT([$ac_cxx_specialize_references])
dnl unused at the moment, disabled
dnl mirko, 99/1/15
dnl AC_MSG_CHECKING(if C++ compiler supports qualification of return types with templates)
dnl AC_TRY_COMPILE(
dnl [
dnl template<class T>
dnl class foo {
dnl public:
dnl typedef int iterator;
dnl iterator begin();
dnl };
dnl template<class T> foo<T>::iterator foo<T>::begin() { }
dnl ],[
dnl foo<int> f;
dnl f.begin();
dnl ],[
dnl ac_template_qualification=yes
dnl ],[
dnl AC_DEFINE(SIGC_CXX_NO_TEMPLATE_QUALIFICATION)
dnl ac_template_qualification=no
dnl ])
dnl AC_MSG_RESULT([$ac_template_qualification])
dnl unused at the moment, disabled
dnl mirko, 99/1/15
dnl AC_MSG_CHECKING(if C++ compiler supports static data inside templates)
dnl AC_TRY_LINK(
dnl [
dnl template<class T>
dnl class foo { public: static T a; };
dnl template<class T>
dnl static T foo<T>::a=0;
dnl ],[
dnl foo<int> b;
dnl ],[
dnl ac_static_templates=yes
dnl ],[
dnl AC_DEFINE(SIGC_CXX_NO_STATIC_TEMPLATES)
dnl ac_static_templates=no
dnl ])
dnl AC_MSG_RESULT([$ac_static_templates])
AC_MSG_CHECKING(if C++ environment provides all required features)
if test "x$config_error" = xyes ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([Your compiler is not powerful enough to compile libsigc++. If it should be, see config.log for more information of why it failed.])
fi
AC_MSG_RESULT([yes])
dnl
dnl PTHREADS
dnl
AC_CHECK_HEADER(pthread.h,,[enable_threads="no"])
if test "x$enable_threads" = "xyes" ; then
enable_threads="no"
AC_CHECK_LIB(pthread,pthread_self,[enable_threads="yes";THREAD_LIB="-lpthread"])
AC_CHECK_LIB(cma,pthread_self,[enable_threads="yes";THREAD_LIB="-lcma"])
AC_PUSH_LIB($THREAD_LIB)
AC_CHECK_FUNC(pthread_keycreate,[AC_DEFINE(SIGC_PTHREAD_DCE)])
AC_POP_LIB()
AC_SUBST(THREAD_LIB)
fi
AC_MSG_CHECKING(if should compile with pthreads)
if test "x$enable_threads" = "xyes" ; then
AC_DEFINE(SIGC_PTHREADS)
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([sizes of threading elements])
# Check for size of threading elements so that we don't expose
# the implementation
AC_TRY_RUN([
#include <stdio.h>
#include <pthread.h>
#ifdef SIGC_PTHREAD_DCE
typedef pthread_condattr_t CondAttr;
typedef pthread_mutexattr_t MutexAttr;
typedef pthread_attr_t ThreadAttr;
#else
typedef pthread_condattr_t* CondAttr;
typedef pthread_mutexattr_t* MutexAttr;
typedef pthread_attr_t* ThreadAttr;
#endif
typedef pthread_mutex_t MutexImpl;
typedef pthread_cond_t CondImpl;
typedef pthread_key_t KeyImpl;
typedef pthread_t ThreadImpl;
int main()
{
FILE *fptr;
fptr=fopen("ac_thread.sh","w");
fprintf(fptr,"ac_thread_cond_attr_size=%d\n",sizeof(CondAttr));
fprintf(fptr,"ac_thread_cond_impl_size=%d\n",sizeof(CondImpl));
fprintf(fptr,"ac_thread_mutex_attr_size=%d\n",sizeof(MutexAttr));
fprintf(fptr,"ac_thread_mutex_impl_size=%d\n",sizeof(MutexImpl));
fprintf(fptr,"ac_thread_thread_attr_size=%d\n",sizeof(ThreadAttr));
fprintf(fptr,"ac_thread_thread_impl_size=%d\n",sizeof(ThreadImpl));
fprintf(fptr,"ac_thread_key_impl_size=%d\n",sizeof(KeyImpl));
return 0;
}
],[
. ./ac_thread.sh
rm ac_thread.sh
AC_MSG_RESULT(found)
],[
AC_MSG_RESULT(failed)
AC_ERROR(
[Could not compile a program with threads, please see config.log for details.
])
],
[
AC_MSG_RESULT(cross)
if test ! -f ac_thread.h; then
echo '
ac_thread_cond_attr_size=
ac_thread_cond_impl_size=
ac_thread_mutex_attr_size=
ac_thread_mutex_impl_size=
ac_thread_thread_attr_size=
ac_thread_thread_impl_size=
ac_thread_key_impl_size=
' > ./ac_thread.sh
AC_MSG_ERROR(
[You are attempting a cross compile, but the necessary information regarding
your thread library is not available. Please fill out the ac_thread.sh file.
])
else
. ./ac_thread.sh
fi
])
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_ATTR,$ac_thread_cond_attr_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_IMPL,$ac_thread_cond_impl_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_ATTR,$ac_thread_mutex_attr_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_IMPL,$ac_thread_mutex_impl_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_ATTR,$ac_thread_thread_attr_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_IMPL,$ac_thread_thread_impl_size)
AC_DEFINE_UNQUOTED(SIGC_PTHREAD_KEY_IMPL,$ac_thread_key_impl_size)
else
AC_MSG_RESULT([no])
fi
###
### This is the end of the massive if..then..else..fi
###
fi
AC_OUTPUT([Makefile
sigc-config
macros/Makefile
],[chmod a+x sigc-config])