Prevent multiple definition of bool,Min(),Max() (MacOS X)

This commit is contained in:
Gerhard Rieger 2014-11-16 21:53:36 +01:00
parent 4228399da0
commit fb0246084a
4 changed files with 26 additions and 2 deletions

View file

@ -1,5 +1,4 @@
security: security:
(CVE Id pending) (CVE Id pending)
Fixed problems with signal handling caused by use of not async signal Fixed problems with signal handling caused by use of not async signal
@ -104,6 +103,10 @@ porting:
Joachim Fenkes provided an new adapted spec file. Joachim Fenkes provided an new adapted spec file.
Type bool and macros Min and Max are defined by socat which led to
compile errors when they were already provided by build framework.
Thanks to Liyu Liu for providing a patch.
testing: testing:
Do not distribute testcert.conf with socat source but generate it Do not distribute testcert.conf with socat source but generate it
(and new testcert6.conf) during test.sh run. (and new testcert6.conf) during test.sh run.

View file

@ -452,6 +452,9 @@
/* is sig_atomic_t declared */ /* is sig_atomic_t declared */
#undef HAVE_TYPE_SIG_ATOMIC_T #undef HAVE_TYPE_SIG_ATOMIC_T
/* is bool already typedef'd? */
#undef HAVE_TYPE_BOOL
/* is socklen_t already typedef'd? */ /* is socklen_t already typedef'd? */
#undef HAVE_TYPE_SOCKLEN #undef HAVE_TYPE_SOCKLEN

View file

@ -766,6 +766,16 @@ AC_MSG_RESULT($sc_cv_type_longlong)
AC_CHECK_TYPE(sig_atomic_t,AC_DEFINE(HAVE_TYPE_SIG_ATOMIC_T),,[#include "sysincludes.h"]) AC_CHECK_TYPE(sig_atomic_t,AC_DEFINE(HAVE_TYPE_SIG_ATOMIC_T),,[#include "sysincludes.h"])
AC_MSG_CHECKING(for bool)
AC_CACHE_VAL(sc_cv_type_bool,
[AC_TRY_COMPILE([],[bool b;],
[sc_cv_type_bool=yes],
[sc_cv_type_bool=no])])
if test $sc_cv_type_bool = yes; then
AC_DEFINE(HAVE_TYPE_BOOL)
fi
AC_MSG_RESULT($sc_cv_type_bool)
# following builtin macro does not check unistd.h and sys/socket.h where # following builtin macro does not check unistd.h and sys/socket.h where
# socklen_t might be defined # socklen_t might be defined
#AC_CHECK_TYPE(socklen_t, int) #AC_CHECK_TYPE(socklen_t, int)

View file

@ -1,5 +1,5 @@
/* source: mytypes.h */ /* source: mytypes.h */
/* Copyright Gerhard Rieger 2001-2006 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __mytypes_h_included #ifndef __mytypes_h_included
@ -7,10 +7,18 @@
/* some types and macros I miss in C89 */ /* some types and macros I miss in C89 */
#ifndef HAVE_TYPE_BOOL
# undef bool
typedef enum { false, true } bool; typedef enum { false, true } bool;
#endif
#ifndef Min
#define Min(x,y) ((x)<=(y)?(x):(y)) #define Min(x,y) ((x)<=(y)?(x):(y))
#endif
#ifndef Max
#define Max(x,y) ((x)>=(y)?(x):(y)) #define Max(x,y) ((x)>=(y)?(x):(y))
#endif
#define SOCKADDR_MAX UNIX_PATH_MAX #define SOCKADDR_MAX UNIX_PATH_MAX