1 ## (C) 1998 Stephan Kulow
2 ## Modified by Tero Pulkkinen
3 ## Modified by Karl Nelson
4 ## Modified by makeLyXsigc.sh (Allan Rae)
8 AC_DEFUN(LYX_FIX_MAKEFILE_IN,[
9 ## modify Makefile.in if need be -- since we still use automake
10 for dir in $srcdir $srcdir/macros ; do
12 sed < Makefile.in > Makefile_tmp \
13 -e 's/all: all-redirect/all: all-@USE_INCLUDED_SIGC@\
14 all-yes: all-redirect\
16 mv Makefile_tmp Makefile.in )
22 define(AC_PUSH_LIB,[dnl
23 ifdef([__LIB__],,[define([__LIB__],0)])dnl
24 ac_save_LIBS[]__LIB__="$LIBS"
25 define([__LIB__],builtin(eval,(__LIB__ + 1)))dnl
27 define(AC_POP_LIB,[dnl
28 define([__LIB__],builtin(eval,(__LIB__ - 1)))dnl
29 LIBS="$ac_save_LIBS[]__LIB__"])
33 dnl Source packaging numbers
41 SIGC_VERSION=$SIGC_MAJOR_VERSION.$SIGC_MINOR_VERSION.$SIGC_MICRO_VERSION
44 # +1 : ? : +1 == new interface that does not break old one
45 # +1 : ? : 0 == new interface that breaks old one
46 # ? : ? : 0 == no new interfaces, but breaks apps
47 # ? :+1 : ? == just some internal changes, nothing breaks but might work
49 # CURRENT : REVISION : AGE
50 LIBSIGC_SO_VERSION=0:0:0
51 AC_SUBST(LIBSIGC_SO_VERSION, $LIBSIGC_SO_VERSION)
53 AC_SUBST(SIGC_RELEASE, $SIGC_RELEASE)
54 AC_SUBST(SIGC_VERSION)
56 AC_DEFINE_UNQUOTED(SIGC_MAJOR_VERSION, $SIGC_MAJOR_VERSION)
57 AC_DEFINE_UNQUOTED(SIGC_MINOR_VERSION, $SIGC_MINOR_VERSION)
58 AC_DEFINE_UNQUOTED(SIGC_MICRO_VERSION, $SIGC_MICRO_VERSION)
60 AC_CONFIG_AUX_DIR(../config)
66 dnl Initialize automake stuff
67 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
69 dnl Specify a configuration file
70 AM_CONFIG_HEADER(sigc++config.h)
72 AC_ARG_WITH([included-libsigc],
73 [ --without-included-libsigc
74 Use the libsigc++ installed on the system
75 Used when libsigc++ is bundled with applications],
76 [sigc_use_included_libsigc=$withval],
77 [sigc_use_included_libsigc=yes])
78 if test x$sigc_use_included_libsigc = xno; then
79 ## just change the setting for the Makefile
81 AC_SUBST(USE_INCLUDED_SIGC)
84 ### This else..fi goes till the end of the file!
87 AC_SUBST(USE_INCLUDED_SIGC)
89 AC_ARG_ENABLE(threads,
90 [ --enable-threads enables support threading.],
91 enable_threads=$enableval,enable_threads="no")
93 [ --disable-checks disables unnecessary tests needed for bug reports.],
94 enable_checks=$enableval,enable_checks="yes"
103 dnl Instruct build of dll for cygwin (libtool 1.3)
104 dnl Exports screw up badly on libtool 1.3, backing off to 1.2f
105 dnl A C_LIBTOOL_WIN32_DLL
107 dnl libtool does all checks with $CC, not with $CXX
108 dnl maybe this should be fixed in libtool, not here
111 dnl On FreeBSD 3.0 (and perhaps some other systems) GNU m4 is
112 dnl called `gm4' where `m4' is the system's own m4.
113 AC_CHECK_PROGS(M4, gm4 m4, m4)
118 dnl Checking if linker supports global constructors
119 dnl This is largely information for me if someone files a bug report
120 if test "X$enable_checks" = "Xyes"; then
121 AC_MSG_CHECKING([if linker supports global constructors])
122 cat > mylib.$ac_ext <<EOF
126 {A() {printf("PASS\n");}
135 cat > mytest.$ac_ext <<EOF
140 int main(int argc,char **argv)
143 if (i!=1) printf("FAIL\n");
147 sh libtool --mode=compile $CXX -c mylib.$ac_ext >&5
148 sh libtool --mode=link $CXX -o libtest.la -rpath / -version-info 0 mylib.lo >&5
149 $CXX -c $CFLAGS $CPPFLAGS mytest.$ac_ext >&5
150 sh libtool --mode=link $CXX -o mytest mytest.o libtest.la >&5 2>/dev/null
151 if test -x mytest; then
153 if test "X$myresult" = "XPASS"; then
158 ===================================================================
159 WARNING: This platform lacks support of construction of global
160 objects in shared librarys. Although not required by this library,
161 this is a serious problem for building C++ libraries. You will not
162 be able to use any shared libraries that contain global objects with
165 See ftp://rtfm.mit.edu/pub/usenet/news.answers/g++-FAQ/plain
166 for details about this problem. Also for possible solutions
167 http://www.informatik.uni-frankfurt.de/~fp/Tcl/tcl-c++/tcl-c++.html
168 ===================================================================
172 AC_MSG_RESULT(unknown)
174 rm -f mylib.* mytest.* libtest.la .libs/libtest* mytest .libs/mytest >&5
177 AC_MSG_CHECKING(if C++ compiler uses std namespace )
181 namespace std{ void kludge(); }
184 cout << "test" << endl;
189 ac_std_namespace=maybe
191 if test "x$ac_std_namespace" = xmaybe ; then
194 #include <iostream.h>
195 namespace std{ void kludge(); }
198 cout << "test" << endl;
203 ===================================================================
204 WARNING: This compiler platform does not have the iostream library
205 in the std namespace. This presents a problem for writing portable
206 STL code. To run the demos, you will need to place a file with the
207 following in a file called "iostream" in your include directory.
209 ---------------------------iostream--------------------------------
210 #ifndef IOSTREAM_KLUDGE
211 #define IOSTREAM_KLUDGE
212 #include <iostream.h>
213 namespace std { void iostream_kludge(); };
215 ===================================================================
221 ===================================================================
222 WARNING: This compiler platform does not support iostream
223 or namespaces. You will not be able to run the demos as they
224 use STL. This does not affect use of the library, only the demos.
225 ===================================================================
233 dnl C++ compiler feature check start here
235 AC_MSG_CHECKING(if C++ compiler supports bool (required))
243 AC_MSG_RESULT([$ac_bool])
246 AC_MSG_RESULT([$ac_bool])
247 AC_WARN(bool type is not supported by your compiler)
250 AC_MSG_CHECKING([if C++ compiler supports const_cast<> (required)])
256 foo *c1=const_cast<foo*>(c);
259 AC_MSG_RESULT([$ac_const_cast])
261 AC_MSG_RESULT([$ac_const_cast])
262 AC_WARN(C++ compiler const_cast<> does not work)
266 # Member function templates
267 AC_MSG_CHECKING(if C++ compiler supports member function templates)
273 template <class T> void method(T t);
276 template <class T> void foo::method(T t) {t = 0;}
279 ac_member_func_templates=yes
280 AC_DEFINE(SIGC_CXX_MEMBER_FUNC_TEMPLATES)
281 AC_MSG_RESULT([$ac_member_func_templates])
283 ac_member_func_templates=no
284 AC_MSG_RESULT([$ac_member_func_templates])
286 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.])
291 # Member class templates
292 AC_MSG_CHECKING(if C++ compiler supports member class templates)
297 template <class T> struct A {};
298 template <class T> struct B {};
302 ac_member_class_templates=yes
303 AC_DEFINE(SIGC_CXX_MEMBER_CLASS_TEMPLATES)
304 AC_MSG_RESULT([$ac_member_class_templates])
306 ac_member_class_templates=no
307 AC_MSG_RESULT([$ac_member_class_templates])
308 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.])
314 AC_MSG_CHECKING(if C++ compiler supports mutable)
320 void foo() const { c=0; }
325 AC_DEFINE(SIGC_CXX_MUTABLE)
329 AC_MSG_RESULT([$ac_cxx_mutable])
332 # Partial Specialization
333 AC_MSG_CHECKING([if C++ compiler supports partial specialization(required)])
336 template<class T, class K>
340 template<class T> class k<void,T> { };
345 ac_cxx_partial_specialization=yes
346 AC_MSG_RESULT([$ac_cxx_partial_specialization])
347 AC_DEFINE(SIGC_CXX_PARTIAL_SPEC)
350 ac_cxx_partial_specialization=no
351 AC_MSG_RESULT([$ac_cxx_partial_specialization])
352 AC_MSG_WARN([Partial specialization is needed for signal templates.])
356 AC_MSG_CHECKING(if C++ compiler supports name spaces)
366 ac_cxx_namespaces=yes
367 AC_MSG_RESULT([$ac_cxx_namespaces])
368 AC_DEFINE(SIGC_CXX_NAMESPACES)
371 AC_MSG_RESULT([$ac_cxx_namespaces])
372 AC_MSG_WARN([Without namespaces all classes will be global.])
376 AC_MSG_CHECKING(if C++ compiler supports friend template)
386 ac_cxx_friend_templates=yes
387 AC_MSG_RESULT([$ac_cxx_friend_templates])
388 AC_DEFINE(SIGC_CXX_FRIEND_TEMPLATES)
390 ac_cxx_friend_templates=no
391 AC_MSG_RESULT([$ac_cxx_friend_templates])
392 AC_MSG_WARN([Access to dynamic will not be controlled.])
396 AC_MSG_CHECKING(if C++ compiler has intrinsic constructors)
408 AC_DEFINE(SIGC_CXX_INT_CTOR)
409 ac_cxx_tmpl_intctor=yes
411 ac_cxx_tmpl_intctor=no
413 AC_MSG_RESULT([$ac_cxx_tmpl_intctor])
416 AC_MSG_CHECKING(if C++ compiler uses template copy ctor)
428 ac_cxx_template_cctor=no
430 AC_DEFINE(SIGC_CXX_TEMPLATE_CCTOR)
431 ac_cxx_template_cctor=yes
433 AC_MSG_RESULT([$ac_cxx_template_cctor])
436 AC_MSG_CHECKING(if C++ compiler allows void returns)
448 ac_cxx_void_return=yes
449 AC_DEFINE(SIGC_CXX_VOID_RETURN)
451 ac_cxx_void_return=no
453 AC_MSG_RESULT([$ac_cxx_void_return])
456 AC_MSG_CHECKING(if C++ compiler allows specialization of references)
480 ac_cxx_specialize_references=yes
481 AC_DEFINE(SIGC_CXX_SPECIALIZE_REFERENCES)
483 ac_cxx_specialize_references=no
485 AC_MSG_RESULT([$ac_cxx_specialize_references])
488 dnl unused at the moment, disabled
490 dnl AC_MSG_CHECKING(if C++ compiler supports qualification of return types with templates)
493 dnl template<class T>
496 dnl typedef int iterator;
497 dnl iterator begin();
499 dnl template<class T> foo<T>::iterator foo<T>::begin() { }
504 dnl ac_template_qualification=yes
506 dnl AC_DEFINE(SIGC_CXX_NO_TEMPLATE_QUALIFICATION)
507 dnl ac_template_qualification=no
509 dnl AC_MSG_RESULT([$ac_template_qualification])
511 dnl unused at the moment, disabled
513 dnl AC_MSG_CHECKING(if C++ compiler supports static data inside templates)
516 dnl template<class T>
517 dnl class foo { public: static T a; };
518 dnl template<class T>
519 dnl static T foo<T>::a=0;
523 dnl ac_static_templates=yes
525 dnl AC_DEFINE(SIGC_CXX_NO_STATIC_TEMPLATES)
526 dnl ac_static_templates=no
528 dnl AC_MSG_RESULT([$ac_static_templates])
530 AC_MSG_CHECKING(if C++ environment provides all required features)
531 if test "x$config_error" = xyes ; then
533 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.])
540 AC_CHECK_HEADER(pthread.h,,[enable_threads="no"])
541 if test "x$enable_threads" = "xyes" ; then
543 AC_CHECK_LIB(pthread,pthread_self,[enable_threads="yes";THREAD_LIB="-lpthread"])
544 AC_CHECK_LIB(cma,pthread_self,[enable_threads="yes";THREAD_LIB="-lcma"])
545 AC_PUSH_LIB($THREAD_LIB)
546 AC_CHECK_FUNC(pthread_keycreate,[AC_DEFINE(SIGC_PTHREAD_DCE)])
551 AC_MSG_CHECKING(if should compile with pthreads)
552 if test "x$enable_threads" = "xyes" ; then
553 AC_DEFINE(SIGC_PTHREADS)
555 AC_MSG_CHECKING([sizes of threading elements])
557 # Check for size of threading elements so that we don't expose
564 #ifdef SIGC_PTHREAD_DCE
565 typedef pthread_condattr_t CondAttr;
566 typedef pthread_mutexattr_t MutexAttr;
567 typedef pthread_attr_t ThreadAttr;
569 typedef pthread_condattr_t* CondAttr;
570 typedef pthread_mutexattr_t* MutexAttr;
571 typedef pthread_attr_t* ThreadAttr;
573 typedef pthread_mutex_t MutexImpl;
574 typedef pthread_cond_t CondImpl;
575 typedef pthread_key_t KeyImpl;
576 typedef pthread_t ThreadImpl;
581 fptr=fopen("ac_thread.sh","w");
582 fprintf(fptr,"ac_thread_cond_attr_size=%d\n",sizeof(CondAttr));
583 fprintf(fptr,"ac_thread_cond_impl_size=%d\n",sizeof(CondImpl));
584 fprintf(fptr,"ac_thread_mutex_attr_size=%d\n",sizeof(MutexAttr));
585 fprintf(fptr,"ac_thread_mutex_impl_size=%d\n",sizeof(MutexImpl));
586 fprintf(fptr,"ac_thread_thread_attr_size=%d\n",sizeof(ThreadAttr));
587 fprintf(fptr,"ac_thread_thread_impl_size=%d\n",sizeof(ThreadImpl));
588 fprintf(fptr,"ac_thread_key_impl_size=%d\n",sizeof(KeyImpl));
596 AC_MSG_RESULT(failed)
598 [Could not compile a program with threads, please see config.log for details.
603 if test ! -f ac_thread.h; then
605 ac_thread_cond_attr_size=
606 ac_thread_cond_impl_size=
607 ac_thread_mutex_attr_size=
608 ac_thread_mutex_impl_size=
609 ac_thread_thread_attr_size=
610 ac_thread_thread_impl_size=
611 ac_thread_key_impl_size=
614 [You are attempting a cross compile, but the necessary information regarding
615 your thread library is not available. Please fill out the ac_thread.sh file.
621 AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_ATTR,$ac_thread_cond_attr_size)
622 AC_DEFINE_UNQUOTED(SIGC_PTHREAD_COND_IMPL,$ac_thread_cond_impl_size)
623 AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_ATTR,$ac_thread_mutex_attr_size)
624 AC_DEFINE_UNQUOTED(SIGC_PTHREAD_MUTEX_IMPL,$ac_thread_mutex_impl_size)
625 AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_ATTR,$ac_thread_thread_attr_size)
626 AC_DEFINE_UNQUOTED(SIGC_PTHREAD_THREAD_IMPL,$ac_thread_thread_impl_size)
627 AC_DEFINE_UNQUOTED(SIGC_PTHREAD_KEY_IMPL,$ac_thread_key_impl_size)
634 ### This is the end of the massive if..then..else..fi
641 ],[chmod a+x sigc-config])