From 0dd581ff1432fd4ca4cb342ab73a5a0f85d4dd9b Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 26 Dec 2009 14:52:58 +0100 Subject: [PATCH] Attempt to autoconfigure ioctl_req_t --- bacula/autoconf/config.h.in | 6 ++++++ bacula/autoconf/configure.in | 26 +++++++++++++++++++++++++- bacula/src/baconfig.h | 21 ++++++--------------- 3 files changed, 37 insertions(+), 16 deletions(-) diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index 4224448f3d..f773e60802 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -474,6 +474,9 @@ declares uintmax_t. */ #undef HAVE_INTTYPES_H_WITH_UINTMAX +/* Set if ioctl request is unsigned long int */ +#undef HAVE_IOCTL_ULINT_REQUEST + /* Whether to enable IPv6 support */ #undef HAVE_IPV6 @@ -654,6 +657,9 @@ /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF +/* Set if socklen_t exists */ +#undef HAVE_SOCKLEN_T + /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H diff --git a/bacula/autoconf/configure.in b/bacula/autoconf/configure.in index d52dcfb030..148a38cade 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1870,7 +1870,31 @@ AC_CACHE_CHECK(for socklen_t, ba_cv_header_socklen_t, ) ] ) -test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T) +test $ba_cv_header_socklen_t = yes && AC_DEFINE(HAVE_SOCKLEN_T, 1, [Set if socklen_t exists]) + +dnl -------------------------------------------------------------------------- +dnl Check for ioctl request type +dnl -------------------------------------------------------------------------- +AC_CACHE_CHECK(for ioctl_req_t, ba_cv_header_ioctl_req_t, + [ + AC_TRY_COMPILE( + [ + #include + #include + ], [ + unsigned long int req; + int fd; + ioctl(fd, req); + ], [ + ba_cv_header_ioctl_req_t=yes + ], [ + ba_cv_header_ioct_req_t_t=no + ] + ) + ] +) +test $ba_cv_header_ioctl_req_t = yes && AC_DEFINE(HAVE_IOCTL_ULINT_REQUEST, 1, [Set if ioctl request is unsigned long int]) + dnl -------------------------------------------------------------------------- dnl Check for typeof() diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index 657830a09c..f1f2f71ef5 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -53,7 +53,11 @@ #define ETIME ETIMEDOUT #endif -#define ioctl_req_t long unsigned int +#ifdef HAVE_IOCTL_ULINT_REQUEST +#define ioctl_req_t unsigned long int +#else +#define ioctl_req_t int +#endif #ifdef PROTOTYPES # define __PROTO(p) p @@ -655,16 +659,9 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) /* take this 'shortcut' */ #define fseeko fseek #define ftello ftell -#undef ioctl_req_t -#define ioctl_req_t int #endif -#ifdef HAVE_OSF1_OS -#undef ioctl_req_t -#define ioctl_req_t int -#endif - #ifdef HAVE_SUN_OS /* * On Solaris 2.5, threads are not timesliced by default, so we need to @@ -674,8 +671,6 @@ int m_msg(const char *file, int line, POOLMEM *&pool_buf, const char *fmt, ...) #define set_thread_concurrency(x) thr_setconcurrency(x) extern int thr_setconcurrency(int); #define SunOS 1 -#undef ioctl_req_t -#define ioctl_req_t int #else @@ -729,17 +724,13 @@ extern int h_errno; */ extern "C" int getdomainname(char *name, int namelen); extern "C" int setdomainname(char *name, int namelen); -#undef ioctl_req_t -#define ioctl_req_t int #endif /* HAVE_HPUX_OS */ #ifdef HAVE_OSF1_OS extern "C" int fchdir(int filedes); extern "C" long gethostid(void); -extern "C" int mknod ( const char *path, int mode, dev_t device ); -#undef ioctl_req_t -#define ioctl_req_t int +extern "C" int mknod(const char *path, int mode, dev_t device ); #endif -- 2.39.5