From: Kern Sibbald Date: Sat, 26 Dec 2009 13:50:29 +0000 (+0100) Subject: Attempt to autoconfig ioctl_req_t X-Git-Tag: Release-3.0.3b~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=78c64f1757419550411778b75f1018727d8f4e18;p=bacula%2Fbacula Attempt to autoconfig ioctl_req_t --- diff --git a/bacula/autoconf/config.h.in b/bacula/autoconf/config.h.in index 632f9c04f3..754a44d9c9 100644 --- a/bacula/autoconf/config.h.in +++ b/bacula/autoconf/config.h.in @@ -452,6 +452,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 @@ -617,6 +620,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 8a91a312eb..3147036165 100644 --- a/bacula/autoconf/configure.in +++ b/bacula/autoconf/configure.in @@ -1859,7 +1859,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 bigendian diff --git a/bacula/configure b/bacula/configure index b9c4dceff4..65d7dd1f95 100755 --- a/bacula/configure +++ b/bacula/configure @@ -32468,11 +32468,83 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ba_cv_header_socklen_t" >&5 echo "${ECHO_T}$ba_cv_header_socklen_t" >&6; } -test $ba_cv_header_socklen_t = yes && cat >>confdefs.h <<\_ACEOF +test $ba_cv_header_socklen_t = yes && +cat >>confdefs.h <<\_ACEOF #define HAVE_SOCKLEN_T 1 _ACEOF +{ echo "$as_me:$LINENO: checking for ioctl_req_t" >&5 +echo $ECHO_N "checking for ioctl_req_t... $ECHO_C" >&6; } +if test "${ba_cv_header_ioctl_req_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include + #include + +int +main () +{ + + unsigned long int req; + int fd; + ioctl(fd, req); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + + ba_cv_header_ioctl_req_t=yes + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + + ba_cv_header_ioct_req_t_t=no + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ echo "$as_me:$LINENO: result: $ba_cv_header_ioctl_req_t" >&5 +echo "${ECHO_T}$ba_cv_header_ioctl_req_t" >&6; } +test $ba_cv_header_ioctl_req_t = yes && +cat >>confdefs.h <<\_ACEOF +#define HAVE_IOCTL_ULINT_REQUEST 1 +_ACEOF + + + { echo "$as_me:$LINENO: checking for bigendian" >&5 echo $ECHO_N "checking for bigendian... $ECHO_C" >&6; } if test "${ba_cv_bigendian+set}" = set; then diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index f725630312..e93c98c920 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 @@ -643,16 +647,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 @@ -662,8 +659,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 @@ -717,17 +712,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