changeset 800:103764a87777

Improve autoconf - Check for strcasestr() - Check for tm_gmtoff - Use ACLOCAL_AMFLAGS so that autoreconf works correctly
author Mikael Berthe <mikael@lilotux.net>
date Mon, 10 Apr 2006 23:16:12 +0200
parents 7362ed14dee0
children d8e0a1ce3e8a
files mcabber/Makefile.am mcabber/configure.ac mcabber/macros/timezone.m4 mcabber/macros/tm-gmtoff.m4
diffstat 4 files changed, 58 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/Makefile.am	Sun Apr 09 10:18:33 2006 +0200
+++ b/mcabber/Makefile.am	Mon Apr 10 23:16:12 2006 +0200
@@ -1,1 +1,2 @@
 SUBDIRS = connwrap libjabber src doc
+ACLOCAL_AMFLAGS = -I macros
--- a/mcabber/configure.ac	Sun Apr 09 10:18:33 2006 +0200
+++ b/mcabber/configure.ac	Mon Apr 10 23:16:12 2006 +0200
@@ -29,6 +29,7 @@
 AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stddef.h \
                   stdlib.h string.h strings.h sys/socket.h sys/time.h \
                   syslog.h termios.h unistd.h ncurses.h panel.h getopt.h])
+AC_VAR_TIMEZONE_EXTERNALS
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL
@@ -49,7 +50,10 @@
 AC_FUNC_VPRINTF
 AC_CHECK_FUNCS([alarm bzero gethostbyname gethostname inet_ntoa isascii \
                 memmove memset modf select setlocale socket strcasecmp \
-                strchr strdup strncasecmp strrchr strstr])
+                strchr strdup strncasecmp strrchr strstr strcasestr])
+
+# Check for tm_gmtoff
+MC_TM_GMTOFF
 
 # Check for glib
 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR([glib is required]),[g_list_append])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mcabber/macros/timezone.m4	Mon Apr 10 23:16:12 2006 +0200
@@ -0,0 +1,39 @@
+dnl ac_var_timeszone_externals.m4
+
+# Define 'timezone', 'altzone' and 'daylight'
+# http://www.gnu.org/software/ac-archive/Miscellaneous/ac_var_timezone_externals.html
+# Use instead of 'AC_STRUCT_TIMEZONE' to determine whether the
+# the external timezone variables 'timezone', 'altzone' and 'daylight' exist,
+# defining 'HAVE_TIMEZONE', 'HAVE_ALTZONE' and 'HAVE_DAYLIGHT' respectively
+# (as well as gaining the macros defined by 'AC_STRUCT_TIMEZONE').
+# Mark R.Bannister <markb@freedomware.co.uk>
+AC_DEFUN([AC_VAR_TIMEZONE_EXTERNALS],
+[  AC_REQUIRE([AC_STRUCT_TIMEZONE])dnl
+   AC_CACHE_CHECK(for timezone external, mb_cv_var_timezone,
+   [  AC_TRY_LINK([#include <time.h>], [return (int)timezone;],
+         mb_cv_var_timezone=yes,
+         mb_cv_var_timezone=no)
+   ])
+   AC_CACHE_CHECK(for altzone external, mb_cv_var_altzone,
+   [  AC_TRY_LINK([#include <time.h>], [return (int)altzone;],
+         mb_cv_var_altzone=yes,
+         mb_cv_var_altzone=no)
+   ])
+   AC_CACHE_CHECK(for daylight external, mb_cv_var_daylight,
+   [  AC_TRY_LINK([#include <time.h>], [return (int)daylight;],
+         mb_cv_var_daylight=yes,
+         mb_cv_var_daylight=no)
+   ])
+   if test $mb_cv_var_timezone = yes; then
+      AC_DEFINE([HAVE_TIMEZONE], 1,
+              [Define if you have the external 'timezone' variable.])
+   fi
+   if test $mb_cv_var_altzone = yes; then
+      AC_DEFINE([HAVE_ALTZONE], 1,
+              [Define if you have the external 'altzone' variable.])
+   fi
+   if test $mb_cv_var_daylight = yes; then
+      AC_DEFINE([HAVE_DAYLIGHT], 1,
+              [Define if you have the external 'daylight' variable.])
+   fi
+])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mcabber/macros/tm-gmtoff.m4	Mon Apr 10 23:16:12 2006 +0200
@@ -0,0 +1,13 @@
+dnl Check for the tm_gmtoff field in struct tm
+dnl (Borrowed from the Gaim project)
+
+AC_DEFUN([MC_TM_GMTOFF],
+[AC_REQUIRE([AC_STRUCT_TM])dnl
+AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
+[AC_TRY_COMPILE([#include <sys/types.h>
+#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
+  ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
+if test "$ac_cv_struct_tm_gmtoff" = yes; then
+  AC_DEFINE(HAVE_TM_GMTOFF, 1, [tm_gmtoff is available.])
+fi
+])