Skip to content

Commit

Permalink
configure: check for u_int and friends
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Apr 16, 2020
1 parent cb4b529 commit 7691fc4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
45 changes: 45 additions & 0 deletions acsite.m4
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,51 @@ AC_DEFUN([AC_TYPE_UINT16_T], [_AC_TYPE_UNSIGNED_INT(16)])
AC_DEFUN([AC_TYPE_UINT32_T], [_AC_TYPE_UNSIGNED_INT(32)])
AC_DEFUN([AC_TYPE_UINT64_T], [_AC_TYPE_UNSIGNED_INT(64)])

AC_DEFUN([AC_TYPE_UINT], [_AC_TYPE_UTYPE(u_int)])
AC_DEFUN([AC_TYPE_ULONG], [_AC_TYPE_UTYPE(u_long)])
AC_DEFUN([AC_TYPE_UCHAR], [_AC_TYPE_UTYPE(u_char)])
AC_DEFUN([AC_TYPE_USHORT], [_AC_TYPE_UTYPE(u_short)])

# _AC_TYPE_UTYPE(BASE)
# -------------------
AC_DEFUN([_AC_TYPE_UTYPE],
[
AC_CACHE_CHECK([for $1], [ac_cv_c_$1],
[ac_cv_c_$1=no
case $1 in
"u_long")
ac_cv_c_$1_type="U_LONG"
;;
"u_int")
ac_cv_c_$1_type="U_INT"
;;
"u_short")
ac_cv_c_$1_type="U_SHORT"
;;
"u_char")
ac_cv_c_$1_type="U_CHAR"
;;
*)
;;
esac
AC_COMPILE_IFELSE(
[AC_LANG_BOOL_COMPILE_TRY(
[AC_INCLUDES_DEFAULT],
[[($1) -1 >> ((sizeof($1) * 8) - 1) == 1]])],
[AS_CASE([$1], [$1],
[ac_cv_c_$1=yes],
[ac_cv_c_$1=no])])
])
case $ac_cv_c_$1 in #(
no)
AC_DEFINE_UNQUOTED([HAVE_TYPE_$ac_cv_c_$1_type_NOT_DEFINED], [1], [$1 is undefined])
;;
*)
;;
esac
])# _AC_TYPE_UTYPE

# _AC_TYPE_INT(NBITS)
# -------------------
AC_DEFUN([_AC_TYPE_INT],
Expand Down
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT
AC_TYPE_USHORT
AC_TYPE_ULONG
AC_TYPE_UCHAR
AC_STRUCT_TIMEZONE
AC_CHECK_TYPES([ptrdiff_t])
AC_HEADER_STDBOOL
Expand Down
13 changes: 13 additions & 0 deletions src/suricata-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@
#include <sched.h> /* for sched_setaffinity(2) */
#endif

#ifdef HAVE_TYPE_U_LONG_NOT_DEFINED
typedef unsigned long int u_long
#endif
#ifdef HAVE_TYPE_U_INT_NOT_DEFINED
typedef unsigned int u_int
#endif
#ifdef HAVE_TYPE_U_SHORT_NOT_DEFINED
typedef unsigned short u_short
#endif
#ifdef HAVE_TYPE_U_CHAR_NOT_DEFINED
typedef unsigned char u_char
#endif

#include <pcre.h>

#ifdef HAVE_SYSLOG_H
Expand Down

0 comments on commit 7691fc4

Please sign in to comment.