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

This commit is contained in:
Gerhard Rieger 2015-04-02 17:09:31 +02:00
parent 3d0c9f5ae9
commit 5ddf9c99ce
4 changed files with 26 additions and 1 deletions

View file

@ -315,6 +315,10 @@ porting:
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.
new features:
added option max-children that limits the number of concurrent child
processes. Thanks to Sam Liddicott for providing the patch.

View file

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

View file

@ -782,6 +782,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_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
# socklen_t might be defined
#AC_CHECK_TYPE(socklen_t, int)

View file

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