#mesondefine HAVE_UNWIND
#mesondefine HAVE_DW
#mesondefine HAVE_BACKTRACE
+#mesondefine HAVE_MALLOC
+#mesondefine HAVE_REALLOC
+#mesondefine HAVE_GETTIMEOFDAY
+#mesondefine HAVE_GETLINE
+#mesondefine STRUCT_TIMESPEC_DEFINITION_MISSING
+#mesondefine STRUCT_ITIMERSPEC_DEFINITION_MISSING
+#mesondefine clockid_t
+#mesondefine timer_t
CFILES += libcompat/clock_gettime.c
endif
+if !HAVE_GETTIMEOFDAY
+CFILES += libcompat/gettimeofday.c
+endif
+
+if !HAVE_LOCALTIME_R
+CFILES += libcompat/localtime_r.c
+endif
+
+if !HAVE_MALLOC
+CFILES += libcompat/malloc.c
+endif
+
+if !HAVE_REALLOC
+CFILES += libcompat/realloc.c
+endif
+
if !HAVE_STRSIGNAL
CFILES += libcompat/strsignal.c
endif
+# If either vsnprintf or snprintf is unavailable
+# XXX: Commented out because none of our supported platforms need it yet and the
+# check is a bit involved. No use slowing everyone down for this yet.
+#if !HAVE_VSNPRINTF
+#CFILES += libcompat/snprintf.c
+#else
+#if !HAVE_SNPRINTF
+#CFILES += libcompat/snprintf.c
+#endif
+#endif
+
+if !HAVE_STRDUP
+CFILES += libcompat/strdup.c
+endif
+
+if !HAVE_GETLINE
+CFILES += libcompat/getline.c
+endif
+
if !HAVE_TIMER_CREATE_SETTIME_DELETE
CFILES +=\
libcompat/timer_create.c \
else
libcheckinternal_la_CFLAGS += -D_GNU_SOURCE
endif
+
+# Don't want libcompat to think we don't have these and substitute replacements
+# See the commented-out vsnprintf/snprintf CFILES stuff above
+libcheckinternal_la_CFLAGS += -DHAVE_SNPRINTF -DHAVE_VSNPRINTF
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
unsigned int
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
#ifdef __APPLE__
#include <mach/clock.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
+#include <CoreServices/CoreServices.h>
#include <unistd.h>
#endif
--- /dev/null
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include "libcompat.h"
+#include <stdio.h>
+
+#define INITIAL_SIZE 16
+#define DELIMITER '\n'
+
+ssize_t
+getline (char **lineptr, size_t * n, FILE * stream)
+{
+ ssize_t written = 0;
+ int character;
+
+ if (*lineptr == NULL || *n < INITIAL_SIZE) {
+ free (*lineptr);
+ *lineptr = (char *) malloc (INITIAL_SIZE);
+ *n = INITIAL_SIZE;
+ }
+
+ while ((character = fgetc (stream)) != EOF) {
+ written += 1;
+ if (written >= *n) {
+ *n = *n * 2;
+ *lineptr = realloc (*lineptr, *n);
+ }
+
+ (*lineptr)[written - 1] = character;
+
+ if (character == DELIMITER) {
+ break;
+ }
+ }
+
+ (*lineptr)[written] = '\0';
+
+ return written;
+}
--- /dev/null
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include "libcompat.h"
+#include <errno.h>
+
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+#define EPOCHFILETIME (116444736000000000i64)
+#else
+#define EPOCHFILETIME (116444736000000000LL)
+#endif
+
+int
+gettimeofday (struct timeval *tv, void *tz)
+{
+#if _MSC_VER
+ union
+ {
+ __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
+ FILETIME ft;
+ } now;
+
+ GetSystemTimeAsFileTime (&now.ft);
+ tv->tv_usec = (long) ((now.ns100 / 10LL) % 1000000LL);
+ tv->tv_sec = (long) ((now.ns100 - EPOCHFILETIME) / 10000000LL);
+ return (0);
+#else
+ // Return that there is no implementation of this on the system
+ errno = ENOSYS;
+ return -1;
+#endif /* _MSC_VER */
+}
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
/* silence warnings about an empty library */
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#ifndef LIBCOMPAT_H
#define LIBCOMPAT_H
CK_DLL_EXP unsigned int alarm (unsigned int seconds);
#endif /* !HAVE_DECL_ALARM */
+#if !HAVE_MALLOC
+CK_DLL_EXP void *rpl_malloc (size_t n);
+#endif /* !HAVE_MALLOC */
+
+#if !HAVE_REALLOC
+CK_DLL_EXP void *rpl_realloc (void *p, size_t n);
+#endif /* !HAVE_REALLOC */
+
#if !HAVE_GETPID && HAVE__GETPID
#define getpid _getpid
#endif /* !HAVE_GETPID && HAVE__GETPID */
+#if !HAVE_GETTIMEOFDAY
+CK_DLL_EXP int gettimeofday (struct timeval *tv, void *tz);
+#endif /* !HAVE_GETTIMEOFDAY */
+
#if !HAVE_DECL_LOCALTIME_R
#if !defined(localtime_r)
CK_DLL_EXP struct tm *localtime_r (const time_t * clock, struct tm *result);
CK_DLL_EXP int timer_delete (timer_t timerid);
#endif /* HAVE_LIBRT */
+/*
+ * The following checks are to determine if the system's
+ * snprintf (or its variants) should be replaced with
+ * the C99 compliant version in libcompat.
+ */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+#if HAVE_STDARG_H
+#include <stdarg.h>
+
+#if !HAVE_VSNPRINTF
+CK_DLL_EXP int rpl_vsnprintf (char *, size_t, const char *, va_list);
+
+#define vsnprintf rpl_vsnprintf
+#endif
+#if !HAVE_SNPRINTF
+CK_DLL_EXP int rpl_snprintf (char *, size_t, const char *, ...);
+
+#define snprintf rpl_snprintf
+#endif
+#endif /* HAVE_STDARG_H */
+
+#if !HAVE_GETLINE
+CK_DLL_EXP ssize_t getline (char **lineptr, size_t * n, FILE * stream);
+#endif
+
/* silence warnings about an empty library */
CK_DLL_EXP void
ck_do_nothing (void)
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
#if !defined(localtime_r)
--- /dev/null
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+/*
+ * AC_FUNC_MALLOC in configure defines malloc to rpl_malloc if
+ * malloc (0) is NULL to provide GNU compatibility
+ */
+
+#include "libcompat.h"
+
+/* malloc has been defined to rpl_malloc, so first undo that */
+#undef malloc
+
+/* this gives us the real malloc to use below */
+void *malloc (size_t n);
+
+/* force malloc(0) to return a valid pointer */
+void *
+rpl_malloc (size_t n)
+{
+ if (n == 0)
+ n = 1;
+ return malloc (n);
+}
--- /dev/null
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+/*
+ * AC_FUNC_REALLOC in configure defines realloc to rpl_realloc if
+ * realloc (p, 0) or realloc (0, n) is NULL to provide GNU
+ * compatibility
+ */
+
+#include "libcompat.h"
+
+/* realloc has been defined to rpl_realloc, so first undo that */
+#undef realloc
+
+/* this gives us the real realloc to use below */
+void *realloc (void *p, size_t n);
+
+/* force realloc(p, 0) and realloc (NULL, n) to return a valid pointer */
+void *
+rpl_realloc (void *p, size_t n)
+{
+ if (n == 0)
+ n = 1;
+ if (p == 0)
+ return malloc (n);
+ return realloc (p, n);
+}
--- /dev/null
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include "libcompat.h"
+
+char *
+strdup (const char *str CK_ATTRIBUTE_UNUSED)
+{
+ assert (0);
+ return NULL;
+}
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
char *
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
int
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
int
+/*
+ * Check: a unit test framework for C
+ * Copyright (C) 2001, 2002 Arien Malec
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
#include "libcompat.h"
int
libcheck_files += ['libcompat/alarm.c']
endif
+if not cdata.has('HAVE_GETTIMEOFDAY')
+ libcheck_files += ['libcompat/gettimeofday.c']
+endif
+
if not cdata.has('HAVE_CLOCK_GETTIME')
libcheck_files += ['libcompat/clock_gettime.c']
endif
+if not cdata.has('HAVE_DECL_LOCALTIME_R')
+ libcheck_files += ['libcompat/localtime_r.c']
+endif
+
+if not cdata.has('HAVE_MALLOC')
+ libcheck_files += ['libcompat/malloc.c']
+endif
+
+if not cdata.has('HAVE_REALLOC')
+ libcheck_files += ['libcompat/realloc.c']
+endif
+
if not cdata.has('HAVE_DECL_STRSIGNAL')
libcheck_files += ['libcompat/strsignal.c']
endif
-# FIXME: check for symbols timer_create, timer_settime, timer_delete as well
+if not cdata.has('HAVE_DECL_STRDUP') and not cdata.has('HAVE__STRDUP')
+ libcheck_files += ['libcompat/strdup.c']
+endif
+
+if not cdata.has('HAVE_GETLINE')
+ libcheck_files += ['libcompat/getline.c']
+endif
+
+# FIXME: check that timer_create, timer_settime, timer_delete are in rt_lib
if not rt_lib.found()
libcheck_files += [
'libcompat/timer_create.c',
libcheck_files,
include_directories : [configinc, internal_check_h_inc],
dependencies : [rt_lib, mathlib],
- c_args: gst_c_args,
+ c_args: gst_c_args +
+ # Don't want libcompat to think we don't have these and substitute
+ # replacements since we don't check for or define these.
+ ['-DHAVE_VSNPRINTF', '-DHAVE_SNPRINTF'],
pic: true)
check_cdata.set('CHECK_MICRO_VERSION', 14)
if host_machine.system() != 'windows'
check_cdata.set('HAVE_FORK', 1)
+else
+ check_cdata.set('HAVE_FORK', 0)
endif
subdir('libcheck')
AC_MSG_NOTICE([Running check unit test framework checks now...])
CHECK_MAJOR_VERSION=0
-CHECK_MINOR_VERSION=9
-CHECK_MICRO_VERSION=14
+CHECK_MINOR_VERSION=10
+CHECK_MICRO_VERSION=0
CHECK_VERSION=$CHECK_MAJOR_VERSION.$CHECK_MINOR_VERSION.$CHECK_MICRO_VERSION
AC_SUBST(CHECK_MAJOR_VERSION)
dnl Checks for header files and declarations
AC_CHECK_HEADERS([unistd.h sys/wait.h sys/time.h], [], [], [AC_INCLUDES_DEFAULT])
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AM_CONDITIONAL(HAVE_MALLOC, test "x$ac_cv_func_malloc" = "xyes")
+AM_CONDITIONAL(HAVE_REALLOC, test "x$ac_cv_func_realloc" = "xyes")
+
+dnl Check for localtime_r()
AC_CHECK_FUNCS([localtime_r])
+AM_CONDITIONAL(HAVE_LOCALTIME_R, test "x$ac_cv_func_localtime_r" = "xyes")
+
+dnl Check for gettimeofday()
+AC_CHECK_FUNCS([gettimeofday])
+AM_CONDITIONAL(HAVE_GETTIMEOFDAY, test "x$ac_cv_func_gettimeofday" = "xyes")
dnl Check for getpid() and _getpid()
AC_CHECK_FUNCS([getpid _getpid])
dnl Check for strdup() and _strdup()
AC_CHECK_DECLS([strdup])
AC_CHECK_FUNCS([_strdup])
+AM_CONDITIONAL(HAVE_STRDUP, test "x$ac_cv_have_decl_strdup" = "xyes" -o "x$ac_cv_func__strdup" = "xyes")
+
+dnl Check for getline()
+AC_CHECK_FUNCS([getline])
+AM_CONDITIONAL(HAVE_GETLINE, test "x$ac_cv_func_getline" = "xyes")
dnl Check for mkstemp
AC_CHECK_FUNCS([mkstemp])
#endif /* HAVE_PTHREAD */
])
-dnl Check if types timer_t/clockid_t are defined. If not, we need to define
-dnl it in libs/gst/check/libcheck/ibcompat.h. Note the optional inclusion of
-dnl pthread.h. On MinGW(-w64), the pthread.h file contains the
+dnl Check if types timer_t/clockid_t are defined. If not, we need to define it
+dnl in libs/gst/check/libcheck/libcompat/libcompat.h. Note the optional
+dnl inclusion of pthread.h. On MinGW(-w64), the pthread.h file contains the
dnl timer_t/clockid_t definitions.
AC_CHECK_TYPE(timer_t, [], [
AC_DEFINE([timer_t], [int], [timer_t])
endif
if cc.has_function('localtime_r', prefix : '#include<time.h>')
cdata.set('HAVE_LOCALTIME_R', 1)
+ # Needed by libcheck
+ cdata.set('HAVE_DECL_LOCALTIME_R', 1)
endif
if cc.has_function('sigaction', prefix : '#include<signal.h>')
cdata.set('HAVE_SIGACTION', 1)
endif
# -------------------------------------------------------------------------------------
-# config.h things needed by libcheck (FIXME: move into the libcheck meson.build) (tpm)
+# config.h things needed by libcheck
# -------------------------------------------------------------------------------------
-# FIXME: check if it is _getpid or getpid on windows (tpm)
if cc.has_function('getpid', prefix : '#include <sys/types.h>\n#include <unistd.h>')
cdata.set('HAVE_GETPID', 1)
elif cc.has_function('_getpid', prefix : '#include <process.h>')
- cdata.set('HAVE__GETPID', 1)
+ cdata.set('HAVE__GETPID', 1) # Windows (MSVC)
endif
-# FIXME: check for _strdup() but how/where and with what includes? (windows?) (tpm)
if cc.has_function('strdup', prefix : '#include <string.h>')
cdata.set('HAVE_DECL_STRDUP', 1)
elif cc.has_function('_strdup', prefix : '#include <string.h>')
- cdata.set('HAVE__STRDUP', 1)
+ cdata.set('HAVE__STRDUP', 1) # Windows (MSVC)
+endif
+if cc.has_function('getline', prefix : '#include <stdio.h>')
+ cdata.set('HAVE_GETLINE', 1)
endif
if cc.has_function('mkstemp', prefix : '#include <stdlib.h>')
cdata.set('HAVE_MKSTEMP', 1)
if cc.has_function('alarm', prefix : '#include <unistd.h>')
cdata.set('HAVE_ALARM', 1)
endif
-if cc.has_function('localtime_r', prefix : '#include <time.h>')
- cdata.set('HAVE_DECL_LOCALTIME_R', 1)
+if cc.has_function('gettimeofday', prefix : '#include <sys/time.h>')
+ cdata.set('HAVE_GETTIMEOFDAY', 1)
endif
if cc.has_function('strsignal', prefix : '#include <string.h>')
cdata.set('HAVE_DECL_STRSIGNAL', 1)
endif
+# Check for availability of types
+if not cc.has_type('clockid_t', prefix : '#include <time.h>')
+ cdata.set('clockid_t', 'int')
+endif
+if not cc.has_type('timer_t', prefix : '#include <time.h>')
+ cdata.set('timer_t', 'int')
+endif
+if not cc.has_members('struct timespec', 'tv_sec', 'tv_nsec',
+ prefix : '#include <time.h>')
+ cdata.set('STRUCT_TIMESPEC_DEFINITION_MISSING', 1)
+endif
+if not cc.has_members('struct itimerspec', 'it_interval', 'it_value',
+ prefix : '#include <time.h>')
+ cdata.set('STRUCT_ITIMERSPEC_DEFINITION_MISSING', 1)
+endif
# Platform deps; only ws2_32 and execinfo for now
platform_deps = []
endif
mathlib = cc.find_library('m', required : false)
-rt_lib = cc.find_library('rt', required : false) # clock_gettime
+# Needed for timer_create/settime/delete
+# Also provides clock_gettime in glibc < 2.17
+rt_lib = cc.find_library('rt', required : false)
gir = find_program('g-ir-scanner', required : false)
gnome = import('gnome')