From 8a759ad3db77a47b635f335e66f9c167a0c221ad Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Thu, 16 May 2013 13:32:49 +0200 Subject: try to link symlink and use a define on error fixes compiling with Minimalist GNU win32 (cross) compiler 4.2.1, which defines symlink, but doesn't implement it. --- configure.ac | 1 + libasn1compiler/asn1c_save.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 1704ad1b..022ce75a 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,7 @@ AC_SEARCH_LIBS(getopt, iberty) AC_CHECK_FUNCS(strtoimax strtoll) AC_CHECK_FUNCS(mergesort) AC_CHECK_FUNCS(mkstemps) +AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])]) AC_OUTPUT( \ skeletons/standard-modules/Makefile \ diff --git a/libasn1compiler/asn1c_save.c b/libasn1compiler/asn1c_save.c index d71db199..f3cfcdf2 100644 --- a/libasn1compiler/asn1c_save.c +++ b/libasn1compiler/asn1c_save.c @@ -6,6 +6,10 @@ #include "asn1c_save.h" #include "asn1c_out.h" +#ifndef HAVE_SYMLINK +#define symlink(a,b) (errno=ENOSYS, -1) +#endif + #define HINCLUDE(s) \ ((arg->flags & A1C_INCLUDES_QUOTED) \ ? fprintf(fp_h, "#include \"%s\"\n", s) \ -- cgit v1.2.3 From 917a81df5b6696eff82e2a7c68681410f81c0e9b Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Tue, 21 May 2013 09:52:19 +0200 Subject: workaround for missing #warning on windows --- skeletons/GeneralizedTime.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c index 4b0ae5d4..3db79109 100644 --- a/skeletons/GeneralizedTime.c +++ b/skeletons/GeneralizedTime.c @@ -67,6 +67,14 @@ static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { #define GMTOFF(tm) (-timezone) #endif /* HAVE_TM_GMTOFF */ +#if defined(_WIN32) +#pragma message( "PLEASE STOP AND READ!") +#pragma message( " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe.") +#pragma message( " ") +#pragma message( " You must fix the code by inserting appropriate locking") +#pragma message( " if you want to use asn_GT2time() or asn_UT2time().") +#pragma message( "PLEASE STOP AND READ!") +#else #if (defined(_EMULATE_TIMEGM) || !defined(HAVE_TM_GMTOFF)) #warning "PLEASE STOP AND READ!" #warning " timegm() is implemented via getenv(\"TZ\")/setenv(\"TZ\"), which may be not thread-safe." @@ -75,6 +83,7 @@ static struct tm *gmtime_r(const time_t *tloc, struct tm *result) { #warning " if you want to use asn_GT2time() or asn_UT2time()." #warning "PLEASE STOP AND READ!" #endif /* _EMULATE_TIMEGM */ +#endif /* * Override our GMTOFF decision for other known platforms. -- cgit v1.2.3 From fb63c010f2135d908a7133f6d1af5fc31b16a870 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Tue, 21 May 2013 09:56:38 +0200 Subject: build silently by default --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 022ce75a..78eee752 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,9 @@ AC_PROG_YACC AM_PROG_LEX AC_PATH_PROG(AR, ar, ar, $PATH:/usr/ucb:/usr/ccs/bin) dnl for Solaris +# If you need to see the details, just run make V=1. +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) + case "$host_os" in cygwin) case "$target" in -- cgit v1.2.3 From 92096162d2beefb9b63eef9cf3f3885b9cc414ff Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Tue, 21 May 2013 11:38:04 +0200 Subject: check for alloca --- asn1c/sys-common.h | 2 ++ configure.ac | 1 + 2 files changed, 3 insertions(+) diff --git a/asn1c/sys-common.h b/asn1c/sys-common.h index cac71c01..9ab1e6bb 100644 --- a/asn1c/sys-common.h +++ b/asn1c/sys-common.h @@ -64,7 +64,9 @@ #ifndef EX_OSFILE #define EX_OSFILE 72 #endif +#if defined HAVE_DECL_ALLOCA && !HAVE_DECL_ALLOCA #define alloca _alloca +#endif #define snprintf _snprintf #endif /* _WIN32 */ diff --git a/configure.ac b/configure.ac index 78eee752..558acab3 100644 --- a/configure.ac +++ b/configure.ac @@ -66,6 +66,7 @@ AC_SEARCH_LIBS(getopt, iberty) AC_CHECK_FUNCS(strtoimax strtoll) AC_CHECK_FUNCS(mergesort) AC_CHECK_FUNCS(mkstemps) +AC_CHECK_DECL(alloca) AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])]) AC_OUTPUT( \ -- cgit v1.2.3 From cab30af3eeee62d39f71f2fc1aeb302436fd3c7c Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Tue, 21 May 2013 14:28:35 +0200 Subject: check for strcasecmp --- configure.ac | 2 +- libasn1fix/asn1fix_internal.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 558acab3..7564f63f 100644 --- a/configure.ac +++ b/configure.ac @@ -66,7 +66,7 @@ AC_SEARCH_LIBS(getopt, iberty) AC_CHECK_FUNCS(strtoimax strtoll) AC_CHECK_FUNCS(mergesort) AC_CHECK_FUNCS(mkstemps) -AC_CHECK_DECL(alloca) +AC_CHECK_DECLS(alloca strcasecmp) AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])]) AC_OUTPUT( \ diff --git a/libasn1fix/asn1fix_internal.h b/libasn1fix/asn1fix_internal.h index 3ccae818..cfd9ceca 100644 --- a/libasn1fix/asn1fix_internal.h +++ b/libasn1fix/asn1fix_internal.h @@ -27,8 +27,10 @@ #define EX_NOINPUT 66 #define EX_DATAERR 65 #define snprintf _snprintf +#if defined HAVE_DECL_STRCASECMP && !HAVE_DECL_STRCASECMP #define strcasecmp stricmp #endif +#endif #ifndef ETOOMANYREFS #define ETOOMANYREFS 144 -- cgit v1.2.3