diff options
author | Daniel Elstner <daniel.kitta@gmail.com> | 2009-08-16 16:09:06 +0200 |
---|---|---|
committer | Daniel Elstner <daniel.kitta@gmail.com> | 2009-08-16 16:23:45 +0200 |
commit | 27a00086567ddfcafa66ee6a1c98be714285903a (patch) | |
tree | 070b364df1fa42d70b823f2cbe386d5ee4bef6c3 /build | |
parent | 74da263b45388dc90cb72ce388bc071fef3d1a0e (diff) | |
download | glibmm-27a00086567ddfcafa66ee6a1c98be714285903a.tar.gz |
Move M4 files from scripts/ over to build/
* scripts/*.m4: Move files over to the build/ directory, in order
to be more consistent with the directory layout of other binding
modules that switched to the new build organization.
* Makefile.am (ACLOCAL_AMFLAGS): Search build/ for M4 files.
(dist_aclocal_macro_DATA): Adjust directory prefix to build/.
* configure.ac (AC_CONFIG_MACRO_DIR): Place third-party Autoconf
macros into the build/ directory.
Diffstat (limited to 'build')
-rw-r--r-- | build/c_std.m4 | 43 | ||||
-rw-r--r-- | build/cxx.m4 | 360 | ||||
-rw-r--r-- | build/cxx_std.m4 | 194 | ||||
-rw-r--r-- | build/dk-feature.m4 | 101 | ||||
-rw-r--r-- | build/glibmm_check_perl.m4 | 54 | ||||
-rw-r--r-- | build/macros.m4 | 72 | ||||
-rw-r--r-- | build/reduced.m4 | 106 | ||||
-rw-r--r-- | build/sun.m4 | 15 |
8 files changed, 945 insertions, 0 deletions
diff --git a/build/c_std.m4 b/build/c_std.m4 new file mode 100644 index 00000000..f4a8b56f --- /dev/null +++ b/build/c_std.m4 @@ -0,0 +1,43 @@ +cv_c_std_time_t_is_not_int32 +## GLIBMM_CXX_HAS_NAMESPACE_STD() +## +## Test whether libstdc++ declares namespace std. For safety, +## also check whether several randomly selected STL symbols +## are available in namespace std. +## +## On success, #define GLIBMM_HAVE_NAMESPACE_STD to 1. +## +AC_DEFUN([GLIBMM_C_STD_TIME_T_IS_NOT_INT32], +[ + AC_CACHE_CHECK( + [whether time_t is not equivalent to gint32, meaning that it can be used for a method overload], + [gtkmm_cv_c_std_time_t_is_not_int32], + [ + AC_TRY_COMPILE( + [ + #include <time.h> + ],[ + typedef signed int gint32; + class Test + { + void something(gint32 val) + {} + + void something(time_t val) + {} + }; + ], + [gtkmm_cv_c_std_time_t_is_not_int32="yes"], + [gtkmm_cv_c_std_time_t_is_not_int32="no"] + ) + ]) + + if test "x${gtkmm_cv_c_std_time_t_is_not_int32}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_C_STD_TIME_T_IS_NOT_INT32],[1], [Defined when time_t is not equivalent to gint32, meaning that it can be used for a method overload]) + } + fi +]) + + + diff --git a/build/cxx.m4 b/build/cxx.m4 new file mode 100644 index 00000000..37062b75 --- /dev/null +++ b/build/cxx.m4 @@ -0,0 +1,360 @@ + +dnl +dnl AC_CXX_NAMESPACES(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_NAMESPACES],[ +AC_MSG_CHECKING(if C++ compiler supports namespaces) +AC_TRY_COMPILE( +[ +namespace Foo { struct A {}; } +using namespace Foo; +],[ +A a; +(void)a; +],[ + ac_cxx_namespaces=yes + AC_MSG_RESULT([$ac_cxx_namespaces]) + $1 +],[ + ac_cxx_namespaces=no + AC_MSG_RESULT([$ac_cxx_namespaces]) + $2 +]) +]) + +dnl +dnl AC_CXX_NAMESPACES(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_BOOL],[ +AC_MSG_CHECKING(if C++ compiler supports bool) +AC_TRY_COMPILE( +[ +],[ + bool b=true; + bool b1=false; + (void)b; + (void)b1; +],[ + ac_cxx_bool=yes + AC_MSG_RESULT([$ac_cxx_bool]) + $1 +],[ + ac_cxx_bool=no + AC_MSG_RESULT([$ac_cxx_bool]) + $2 +]) +]) + +dnl +dnl AC_CXX_MUTABLE(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_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_MSG_RESULT([$ac_cxx_mutable]) + $1 +],[ + ac_cxx_mutable=no + AC_MSG_RESULT([$ac_cxx_mutable]) + $2 +]) +]) + + +dnl +dnl AC_CXX_CONST_CAST(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +AC_DEFUN([AC_CXX_CONST_CAST],[ +AC_MSG_CHECKING([if C++ compiler supports const_cast<>]) +AC_TRY_COMPILE( +[ + class foo; +],[ + const foo *c=0; + foo *c1=const_cast<foo*>(c); + (void)c1; +],[ + ac_cxx_const_cast=yes + AC_MSG_RESULT([$ac_cxx_const_cast]) +],[ + ac_cxx_const_cast=no + AC_MSG_RESULT([$ac_cxx_const_cast]) +]) +]) + + +dnl +dnl GLIBMM_CXX_MEMBER_FUNCTIONS_MEMBER_TEMPLATES(ACTION_FOUND,ACTION_NOT_FOUND) +dnl +dnl Test whether the compiler allows member functions to refer to spezialized member function templates. +dnl Some compilers have problems with this. gcc 2.95.3 aborts with an internal compiler error. +dnl +AC_DEFUN([GLIBMM_CXX_MEMBER_FUNCTIONS_MEMBER_TEMPLATES],[ +AC_MSG_CHECKING([if C++ compiler allows member functions to refer to member templates]) +AC_TRY_COMPILE( +[ + struct foo { + template <class C> inline + void doit(); + void thebug(); + }; + + template <class C> inline + void foo::doit() { + } + + struct bar { + void neitherabug(); + }; + + void notabug() { + void (foo::*func)(); + func = &foo::doit<int>; + (void)func; + } + + void bar::neitherabug() { + void (foo::*func)(); + func = &foo::doit<int>; + (void)func; + } + + void foo::thebug() { + void (foo::*func)(); + func = &foo::doit<int>; //Compiler bugs usually show here. + (void)func; + } +],[],[glibmm_cxx_member_functions_member_templates=yes + AC_DEFINE([GLIBMM_MEMBER_FUNCTIONS_MEMBER_TEMPLATES], [1], + [does the C++ compiler allow member functions to refer to member templates]) +], [glibmm_cxx_member_functions_member_templates=no]) + AC_MSG_RESULT([$glibmm_cxx_member_functions_member_templates]) +]) + +## GLIBMM_CXX_CAN_DISAMBIGUATE_CONST_TEMPLATE_SPECIALIZATIONS() +## +## Check whether the compiler finds it ambiguous to have both +## const and non-const template specializations, +## The SUN Forte compiler has this problem, though we are +## not 100% sure that it's a C++ standards violation. +## +AC_DEFUN([GLIBMM_CXX_CAN_DISAMBIGUATE_CONST_TEMPLATE_SPECIALIZATIONS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether the compiler finds it ambiguous to have both const and non-const template specializations], + [glibmm_cv_cxx_can_disambiguate_const_template_specializations], + [ + AC_TRY_COMPILE( + [ + #include <iostream> + + template <class T> class Foo {}; + + template <typename T> class Traits { + public: + const char* whoami() { + return "generic template"; + } + }; + + template <typename T> class Traits<Foo<T> > { + public: + const char* whoami() { + return "partial specialization for Foo<T>"; + } + }; + + template <typename T> class Traits<Foo<const T> > { + public: + const char* whoami() { + return "partial specialization for Foo<const T>"; + } + }; + + ],[ + Traits<int> it; + Traits<Foo<int> > fit; + Traits<Foo<const int> > cfit; + + std::cout << "Traits<int> --> " + << it.whoami() << std::endl; + std::cout << "Traits<Foo<int>> --> " + << fit.whoami() << std::endl; + std::cout << "Traits<Foo<const int >> --> " + << cfit.whoami() << std::endl; + ], + [glibmm_cv_cxx_can_disambiguate_const_template_specializations="yes"], + [glibmm_cv_cxx_can_disambiguate_const_template_specializations="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_disambiguate_const_template_specializations}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_DISAMBIGUOUS_CONST_TEMPLATE_SPECIALIZATIONS],[1], [Defined if the compiler does not find it ambiguous to have both const and non-const template specializations]) + } + fi +]) + + + +## GLIBMM_CXX_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION() +## +## Check whether the compiler allows us to define a template that uses +## dynamic_cast<> with an object whose type is not defined, +## even if we do not use that template before we have defined the type. +## This should probably not be allowed anyway. +## +AC_DEFUN([GLIBMM_CXX_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION], +[ + AC_CACHE_CHECK( + [whether the compiler allows us to define a template that uses dynamic_cast<> with an object whose type is not yet defined], + [glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition], + [ + AC_TRY_COMPILE( + [ + class SomeClass; + + SomeClass* some_function(); + + template <class T> + class SomeTemplate + { + static bool do_something() + { + //This does not compile, with the MipsPro (IRIX) compiler + //even if we don't use this template at all. + //(We would use it later, after we have defined the type). + return dynamic_cast<T*>(some_function()); + } + }; + + ],[ + + ], + [glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition="yes"], + [glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_use_dynamic_cast_in_unused_template_without_definition}" = "xyes"; then + { + AC_DEFINE([GLIBMM_CAN_USE_DYNAMIC_CAST_IN_UNUSED_TEMPLATE_WITHOUT_DEFINITION],[1], [Defined if the compiler allows us to define a template that uses dynamic_cast<> with an object whose type is not yet defined.]) + } + fi +]) + + +## GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS() +## +## Check whether the compiler allows us to use a non-extern "C" function, +## such as a static member function, to an extern "C" function pointer, +## such as a GTK+ callback. +## This should not be allowed anyway. +## +AC_DEFUN([GLIBMM_CXX_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS], +[ + AC_CACHE_CHECK( + [whether the the compilerallows us to use a non-extern "C" function for an extern "C" function pointer.], + [glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks], + [ + AC_TRY_COMPILE( + [ + extern "C" + { + struct somestruct + { + void (*callback) (int); + }; + + } // extern "C" + + void somefunction(int) + { + } + + ],[ + somestruct something; + something.callback = &somefunction; + ], + [glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks="yes"], + [glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_assign_non_extern_c_functions_to_extern_c_callbacks}" = "xyes"; then + { + AC_DEFINE([GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS],[1], [Defined if the compiler allows us to use a non-extern "C" function for an extern "C" function pointer.]) + } + fi +]) + +## GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC() +## +## Check whether the compiler puts extern "C" functions in the global namespace, +## even inside a namespace declaration. The AIX xlC compiler does this, and also +## gets confused if we declare the namespace again inside the extern "C" block. +## This seems like a compiler bug, but not a serious one. +## +AC_DEFUN([GLIBMM_CXX_CAN_USE_NAMESPACES_INSIDE_EXTERNC], +[ + AC_CACHE_CHECK( + [whether the compiler uses namespace declarations inside extern "C" blocks.], + [glibmm_cv_cxx_can_use_namespaces_inside_externc], + [ + AC_TRY_COMPILE( + [ + namespace test + { + + extern "C" + { + + void do_something(); + + } //extern C + + + class Something + { + protected: + int i; + + friend void do_something(); + }; + + void do_something() + { + Something something; + something.i = 1; + } + + } //namespace + + + ],[ + + ], + [glibmm_cv_cxx_can_use_namespaces_inside_externc="yes"], + [glibmm_cv_cxx_can_use_namespaces_inside_externc="no"] + ) + ]) + + if test "x${glibmm_cv_cxx_can_use_namespaces_inside_externc}" = "xyes"; then + { + AC_DEFINE([GLIBMM_CAN_USE_NAMESPACES_INSIDE_EXTERNC],[1], [Defined if the compiler whether the compiler uses namespace declarations inside extern "C" blocks.]) + } + fi +]) + + diff --git a/build/cxx_std.m4 b/build/cxx_std.m4 new file mode 100644 index 00000000..aa3d5c90 --- /dev/null +++ b/build/cxx_std.m4 @@ -0,0 +1,194 @@ +## GLIBMM_CXX_HAS_NAMESPACE_STD() +## +## Test whether libstdc++ declares namespace std. For safety, +## also check whether several randomly selected STL symbols +## are available in namespace std. +## +## On success, #define GLIBMM_HAVE_NAMESPACE_STD to 1. +## +AC_DEFUN([GLIBMM_CXX_HAS_NAMESPACE_STD], +[ + AC_CACHE_CHECK( + [whether C++ library symbols are declared in namespace std], + [gtkmm_cv_cxx_has_namespace_std], + [ + AC_TRY_COMPILE( + [ + #include <algorithm> + #include <iterator> + #include <iostream> + #include <string> + ],[ + using std::min; + using std::find; + using std::copy; + using std::bidirectional_iterator_tag; + using std::string; + using std::istream; + using std::cout; + ], + [gtkmm_cv_cxx_has_namespace_std="yes"], + [gtkmm_cv_cxx_has_namespace_std="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_namespace_std}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_NAMESPACE_STD],[1], [Defined when the libstdc++ declares the std-namespace]) + } + fi +]) + + +## GLIBMM_CXX_HAS_STD_ITERATOR_TRAITS() +## +## Check for standard-conform std::iterator_traits<>, and +## #define GLIBMM_HAVE_STD_ITERATOR_TRAITS on success. +## +AC_DEFUN([GLIBMM_CXX_HAS_STD_ITERATOR_TRAITS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether the C++ library supports std::iterator_traits], + [gtkmm_cv_cxx_has_std_iterator_traits], + [ + AC_TRY_COMPILE( + [ + #include <iterator> + #ifdef GLIBMM_HAVE_NAMESPACE_STD + using namespace std; + #endif + ],[ + typedef iterator_traits<char*>::value_type ValueType; + ], + [gtkmm_cv_cxx_has_std_iterator_traits="yes"], + [gtkmm_cv_cxx_has_std_iterator_traits="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_std_iterator_traits}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_STD_ITERATOR_TRAITS],[1], [Defined if std::iterator_traits<> is standard-conforming]) + } + fi +]) + + +## GLIBMM_CXX_HAS_SUN_REVERSE_ITERATOR() +## +## Check for Sun libCstd style std::reverse_iterator, +## and #define GLIBMM_HAVE_SUN_REVERSE_ITERATOR if found. +## +AC_DEFUN([GLIBMM_CXX_HAS_SUN_REVERSE_ITERATOR], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [for non-standard Sun libCstd reverse_iterator], + [gtkmm_cv_cxx_has_sun_reverse_iterator], + [ + AC_TRY_COMPILE( + [ + #include <iterator> + #ifdef GLIBMM_HAVE_NAMESPACE_STD + using namespace std; + #endif + ],[ + typedef reverse_iterator<char*,random_access_iterator_tag,char,char&,char*,int> ReverseIter; + ], + [gtkmm_cv_cxx_has_sun_reverse_iterator="yes"], + [gtkmm_cv_cxx_has_sun_reverse_iterator="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_sun_reverse_iterator}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_SUN_REVERSE_ITERATOR],[1], [Defined if std::reverse_iterator is in Sun libCstd style]) + } + fi +]) + + +## GLIBMM_CXX_HAS_TEMPLATE_SEQUENCE_CTORS() +## +## Check whether the STL containers have templated sequence ctors, +## and #define GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS on success. +## +AC_DEFUN([GLIBMM_CXX_HAS_TEMPLATE_SEQUENCE_CTORS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether STL containers have templated sequence constructors], + [gtkmm_cv_cxx_has_template_sequence_ctors], + [ + AC_TRY_COMPILE( + [ + #include <vector> + #include <deque> + #include <list> + #ifdef GLIBMM_HAVE_NAMESPACE_STD + using namespace std; + #endif + ],[ + const int array[8] = { 0, }; + vector<int> test_vector (&array[0], &array[8]); + deque<short> test_deque (test_vector.begin(), test_vector.end()); + list<long> test_list (test_deque.begin(), test_deque.end()); + test_vector.assign(test_list.begin(), test_list.end()); + ], + [gtkmm_cv_cxx_has_template_sequence_ctors="yes"], + [gtkmm_cv_cxx_has_template_sequence_ctors="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_template_sequence_ctors}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_TEMPLATE_SEQUENCE_CTORS],[1], [Defined if the STL containers have templated sequence ctors]) + } + fi +]) + +## GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS() +## +## Check whether the a static member variable may be initialized inline to std::string::npos. +## The MipsPro (IRIX) compiler does not like this. +## and #define GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS on success. +## +AC_DEFUN([GLIBMM_CXX_ALLOWS_STATIC_INLINE_NPOS], +[ + AC_REQUIRE([GLIBMM_CXX_HAS_NAMESPACE_STD]) + + AC_CACHE_CHECK( + [whether the compiler allows a static member variable to be initialized inline to std::string::npos], + [gtkmm_cv_cxx_has_allows_static_inline_npos], + [ + AC_TRY_COMPILE( + [ + #include <string> + #include <iostream> + + class ustringtest + { + public: + //The MipsPro compiler (IRIX) says "The indicated constant value is not known", + //so we need to initalize the static member data elsewhere. + static const std::string::size_type ustringnpos = std::string::npos; + }; + ],[ + std::cout << "npos=" << ustringtest::ustringnpos << std::endl; + ], + [gtkmm_cv_cxx_has_allows_static_inline_npos="yes"], + [gtkmm_cv_cxx_has_allows_static_inline_npos="no"] + ) + ]) + + if test "x${gtkmm_cv_cxx_has_allows_static_inline_npos}" = "xyes"; then + { + AC_DEFINE([GLIBMM_HAVE_ALLOWS_STATIC_INLINE_NPOS],[1], [Defined if a static member variable may be initialized inline to std::string::npos]) + } + fi +]) + + diff --git a/build/dk-feature.m4 b/build/dk-feature.m4 new file mode 100644 index 00000000..87a0e26e --- /dev/null +++ b/build/dk-feature.m4 @@ -0,0 +1,101 @@ +## Copyright (c) 2004-2007 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of danielk's Autostuff. +## +## danielk's Autostuff is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License as published +## by the Free Software Foundation; either version 2 of the License, or (at +## your option) any later version. +## +## danielk's Autostuff is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with danielk's Autostuff; if not, write to the Free Software Foundation, +## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +#serial 20070105 + +## _DK_SH_VAR_PUSH_DEPTH(depth, variable, [value]) +## +m4_define([_DK_SH_VAR_PUSH_DEPTH], +[dnl +m4_pushdef([_DK_SH_VAR_DEPTH_$2], [$1])[]dnl +dk_save_sh_var_$2_$1=$$2 +m4_if([$3], [],, [$2=$3 +])[]dnl +]) + +## _DK_SH_VAR_POP_DEPTH(depth, variable) +## +m4_define([_DK_SH_VAR_POP_DEPTH], +[dnl +$2=$dk_save_sh_var_$2_$1 +m4_popdef([_DK_SH_VAR_DEPTH_$2])[]dnl +]) + +## DK_SH_VAR_PUSH(variable, [value]) +## +## Temporarily replace the current value of the shell variable <variable> +## with <value> until DK_SH_VAR_POP(<variable>) is invoked to restore the +## original value. If <value> is empty, <variable> is left unchanged but +## its current value is still saved. +## +## This macro may safely be used repeatedly on the same shell variable, +## as long as each DK_SH_VAR_PUSH(variable) is matched by a corresponding +## DK_SH_VAR_POP(variable). +## +AC_DEFUN([DK_SH_VAR_PUSH], +[dnl +m4_if([$1],, [AC_FATAL([argument expected])])[]dnl +_DK_SH_VAR_PUSH_DEPTH(m4_ifdef([_DK_SH_VAR_DEPTH_$1], + [m4_incr(_DK_SH_VAR_DEPTH_$1)], + [1]), + [$1], [$2])[]dnl +]) + +## DK_SH_VAR_POP(variable) +## +## Restore the original value of the shell variable <variable> which it had +## before the corresponding invocation of DK_SH_VAR_PUSH(<variable>). +## +AC_DEFUN([DK_SH_VAR_POP], +[dnl +m4_if([$1],, [AC_FATAL([argument expected])])[]dnl +_DK_SH_VAR_POP_DEPTH(_DK_SH_VAR_DEPTH_$1, [$1])[]dnl +]) + +## _DK_CHECK_FEATURE_VAR(feature, source, cache var, shell var, cpp define) +## +m4_define([_DK_CHECK_FEATURE_VAR], +[dnl +AC_CACHE_CHECK([for $1], [$3], + [AC_LINK_IFELSE([$2], [$3=yes], [$3=no])]) +$4=$$3 + +AS_IF([test "x$$4" = xyes], + [AC_DEFINE([$5], [1], [Define to 1 if $1 is available.]) +])[]dnl +]) + +## DK_CHECK_FEATURE(feature, test source) +## +## Check for a feature of the C/C++ environment. If compiling and linking +## the supplied test program is successful, the configuration header macro +## <PACKAGE_TARNAME>_HAVE_<FEATURE> is defined to 1 and "yes" is assigned +## to the shell variable <PACKAGE_TARNAME>_FEATURE_<FEATURE>. Otherwise, +## <PACKAGE_TARNAME>_FEATURE_<FEATURE> is set to "no". +## +## This macro is intended to be used in conjunction with AC_LANG_PROGRAM +## or AC_LANG_SOURCE. +## +AC_DEFUN([DK_CHECK_FEATURE], +[dnl +m4_if([$2],, [AC_FATAL([2 arguments expected])])[]dnl +_DK_CHECK_FEATURE_VAR([$1], [$2], + m4_quote(AS_TR_SH([dk_cv_feature_$1])), + m4_quote(AS_TR_CPP(AC_PACKAGE_TARNAME[_FEATURE_$1])), + m4_quote(AS_TR_CPP(AC_PACKAGE_TARNAME[_HAVE_$1])))[]dnl +]) diff --git a/build/glibmm_check_perl.m4 b/build/glibmm_check_perl.m4 new file mode 100644 index 00000000..62519e5c --- /dev/null +++ b/build/glibmm_check_perl.m4 @@ -0,0 +1,54 @@ +dnl +dnl Some macros needed for autoconf +dnl + + +## GLIBMM_CV_PERL_VERSION(version) +## +## Helper macro of GLIBMM_CHECK_PERL(). It generates a cache variable +## name that includes the version number, in order to avoid clashes. +## +AC_DEFUN([GLIBMM_CV_PERL_VERSION],[glibmm_cv_perl_version_[]m4_translit([$1],[.${}],[____])]) + + +## GLIBMM_CHECK_PERL(version) +## +## Check for Perl >= version and set PERL_PATH. If Perl is not found +## and maintainer-mode is enabled, abort with an error message. If not +## in maintainer-mode, set PERL_PATH=perl on failure. +## +AC_DEFUN([GLIBMM_CHECK_PERL], +[ + glibmm_perl_result=no + + AC_PATH_PROGS([PERL_PATH], [perl perl5], [not found]) + + if test "x$PERL_PATH" != "xnot found"; then + { + AC_CACHE_CHECK( + [whether Perl is new enough], + GLIBMM_CV_PERL_VERSION([$1]), + [ + ]GLIBMM_CV_PERL_VERSION([$1])[=no + "$PERL_PATH" -e "require v$1; exit 0;" >/dev/null 2>&1 && ]GLIBMM_CV_PERL_VERSION([$1])[=yes + ]) + test "x${GLIBMM_CV_PERL_VERSION([$1])}" = xyes && glibmm_perl_result=yes + } + else + { + # Make sure we have something sensible, even if it doesn't work. + PERL_PATH=perl + } + fi + + if test "x$glibmm_perl_result" = xno && test "x$USE_MAINTAINER_MODE" = xyes; then + { + AC_MSG_ERROR([[ +*** Perl >= ]$1[ is required for building $PACKAGE in maintainer-mode. +]]) + } + fi + + AC_SUBST([PERL_PATH]) +]) + diff --git a/build/macros.m4 b/build/macros.m4 new file mode 100644 index 00000000..14708e47 --- /dev/null +++ b/build/macros.m4 @@ -0,0 +1,72 @@ +dnl +dnl Some macros needed for autoconf +dnl + +dnl AL_PROG_GNU_M4(ACTION_NOT_FOUND) +dnl Check for GNU m4. (sun won't do.) +dnl +AC_DEFUN([AL_PROG_GNU_M4],[ +AC_CHECK_PROGS(M4, gm4 m4, m4) + +if test "$M4" = "m4"; then + AC_MSG_CHECKING(whether m4 is GNU m4) + if $M4 --version </dev/null 2>/dev/null | grep -i '^GNU M4 ' >/dev/null ; then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + if test "$host_vendor" = "sun"; then + $1 + fi + fi +fi +]) + + +dnl AL_PROG_GNU_MAKE(ACTION_NOT_FOUND) +dnl Check for GNU make (no sun make) +dnl +AC_DEFUN([AL_PROG_GNU_MAKE],[ +dnl +dnl Check for GNU make (stolen from gtk+/configure.in) +AC_MSG_CHECKING(whether make is GNU Make) +if ${MAKE-make} --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + if test "$host_vendor" = "sun" ; then + $1 + fi +fi +]) + +dnl AL_ACLOCAL_INCLUDE(macrodir) +dnl Add a directory to macro search (from gnome) +AC_DEFUN([AL_ACLOCAL_INCLUDE], +[ + test "x$ACLOCAL_FLAGS" = "x" || ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS" + for dir in $1 + do + ACLOCAL="$ACLOCAL -I $srcdir/$dir" + done +]) + + +## GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING() +## +## Provide the --enable-debug-refcounting configure argument, disabled +## by default. If enabled, #define GTKMM_DEBUG_REFCOUNTING. +## +AC_DEFUN([GLIBMM_ARG_ENABLE_DEBUG_REFCOUNTING], +[ + AC_ARG_ENABLE([debug-refcounting], + [ --enable-debug-refcounting Print a debug message on every ref/unref. + [[default=disabled]]], + [glibmm_debug_refcounting="$enableval"], + [glibmm_debug_refcounting='no']) + + if test "x$glibmm_debug_refcounting" = "xyes"; then + { + AC_DEFINE([GLIBMM_DEBUG_REFCOUNTING],[1], [Defined when the --enable-debug-refcounting configure argument was given]) + } + fi +]) diff --git a/build/reduced.m4 b/build/reduced.m4 new file mode 100644 index 00000000..9411a578 --- /dev/null +++ b/build/reduced.m4 @@ -0,0 +1,106 @@ +## GLIBMM_ARG_ENABLE_API_PROPERTIES() +## +## Provide the --enable-api-properties configure argument, enabled +## by default. +## +AC_DEFUN([GLIBMM_ARG_ENABLE_API_PROPERTIES], +[ + AC_ARG_ENABLE([api-properties], + [ --enable-api-properties Build properties API. + [[default=yes]]], + [glibmm_enable_api_properties="$enableval"], + [glibmm_enable_api_properties='yes']) + + if test "x$glibmm_enable_api_properties" = "xyes"; then + { + AC_DEFINE([GLIBMM_PROPERTIES_ENABLED],[1], [Defined when the --enable-api-properties configure argument was given]) + } + fi +]) + +## GLIBMM_ARG_ENABLE_API_VFUNCS() +## +## Provide the --enable-api-vfuncs configure argument, enabled +## by default. +## +AC_DEFUN([GLIBMM_ARG_ENABLE_API_VFUNCS], +[ + AC_ARG_ENABLE([api-vfuncs], + [ --enable-api-vfuncs Build vfuncs API. + [[default=yes]]], + [glibmm_enable_api_vfuncs="$enableval"], + [glibmm_enable_api_vfuncs='yes']) + + if test "x$glibmm_enable_api_vfuncs" = "xyes"; then + { + AC_DEFINE([GLIBMM_VFUNCS_ENABLED],[1], [Defined when the --enable-api-vfuncs configure argument was given]) + } + fi +]) + +## GLIBMM_ARG_ENABLE_API_EXCEPTIONS() +## +## Provide the --enable-api-exceptions configure argument, enabled +## by default. +## +AC_DEFUN([GLIBMM_ARG_ENABLE_API_EXCEPTIONS], +[ + AC_ARG_ENABLE([api-exceptions], + [ --enable-api-exceptions Build exceptions API. + [[default=yes]]], + [glibmm_enable_api_exceptions="$enableval"], + [glibmm_enable_api_exceptions='yes']) + + if test "x$glibmm_enable_api_exceptions" = "xyes"; then + { + AC_DEFINE([GLIBMM_EXCEPTIONS_ENABLED],[1], [Defined when the --enable-api-exceptions configure argument was given]) + } + fi +]) + +## GLIBMM_ARG_ENABLE_API_DEPRECATED() +## +## Provide the --enable-deprecated-api configure argument, enabled +## by default. +## +AC_DEFUN([GLIBMM_ARG_ENABLE_API_DEPRECATED], +[ + AC_ARG_ENABLE(deprecated-api, + [ --enable-deprecated-api Include (build) deprecated API in the libraries. + [[default=yes]]], + [glibmm_enable_api_deprecated="$enableval"], + [glibmm_enable_api_deprecated='yes']) + + if test "x$glibmm_enable_api_deprecated" = "xyes"; then + { + AC_MSG_WARN([Deprecated API will be built, for backwards-compatibility.]) + } + else + { + AC_MSG_WARN([Deprecated API will not be built, breaking backwards-compatibility. Do not use this build for distribution packages.]) + DISABLE_DEPRECATED_API_CFLAGS="-DGLIBMM_DISABLE_DEPRECATED" + AC_SUBST(DISABLE_DEPRECATED_API_CFLAGS) + } + fi +]) + + +## GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS() +## +## Provide the --enable-api-default-signal-handlers configure argument, enabled +## by default. +## +AC_DEFUN([GLIBMM_ARG_ENABLE_API_DEFAULT_SIGNAL_HANDLERS], +[ + AC_ARG_ENABLE([api-default-signal-handlers], + [ --enable-api-default-signal-handlers Build default signal handlers API. + [[default=yes]]], + [glibmm_enable_api_default_signal_handlers="$enableval"], + [glibmm_enable_api_default_signal_handlers='yes']) + + if test "x$glibmm_enable_api_default_signal_handlers" = "xyes"; then + { + AC_DEFINE([GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED],[1], [Defined when the --enable-api-default-signal-handlers configure argument was given]) + } + fi +]) diff --git a/build/sun.m4 b/build/sun.m4 new file mode 100644 index 00000000..6b8950f7 --- /dev/null +++ b/build/sun.m4 @@ -0,0 +1,15 @@ +AC_DEFUN([GLIBMM_PROG_CXX_SUN], + [AC_CACHE_CHECK(whether we are using SUN CC compiler, ac_cv_prog_sun_cxx, + [if AC_TRY_COMMAND(${CXX-g++} -V 2>&1) | egrep "Sun WorkShop" >/dev/null 2>&1; then + ac_cv_prog_sun_cxx=yes + else + ac_cv_prog_sun_cxx=no + fi] + )] + + if test "x${ac_cv_prog_sun_cxx}" = "xyes"; then + { + AC_DEFINE([GLIBMM_COMPILER_SUN_FORTE],[1], [Defined when the SUN Forte C++ compiler is being used.]) + } + fi +) |