summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-08-23 07:23:42 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-08-23 07:23:42 +0000
commitd4731b70505d308064e85bfa1ea1f88904442af2 (patch)
treeaf88b993286e656d7b15062a704963142062ccc8 /configure.in
parent8d2c24265d6d8ed74e3d2dc646cb1c3d20f290f3 (diff)
downloadcurl-d4731b70505d308064e85bfa1ea1f88904442af2.tar.gz
Albert Chin-A-Young's fixes
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in313
1 files changed, 175 insertions, 138 deletions
diff --git a/configure.in b/configure.in
index 58701d335..8942c99be 100644
--- a/configure.in
+++ b/configure.in
@@ -161,164 +161,200 @@ then
AC_DEFINE(DISABLED_THREADSAFE, 1, \
Set to explicitly specify we don't want to use thread-safe functions)
else
+ dnl check for number of arguments to gethostbyname_r. it might take
+ dnl either 3, 5, or 6 arguments.
+ AC_CHECK_FUNCS(gethostbyname_r,[
+ AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
+ AC_TRY_RUN([
+#include <string.h>
+#include <sys/types.h>
+#include <netdb.h>
-dnl check for a few thread-safe functions
-
- AC_CHECK_FUNCS( gethostbyname_r \
- gethostbyaddr_r \
- localtime_r \
- inet_ntoa_r
- )
-
- if test "$ac_cv_func_gethostbyname_r" = "yes"; then
-
- dnl **********************************************************************
- dnl Time to make a check for gethostbyname_r
- dnl If it exists, it may use one of three different interfaces
- dnl **********************************************************************
-
- AC_MSG_CHECKING(for gethostbyname_r)
- if test -z "$ac_cv_gethostbyname_args"; then
- AC_TRY_COMPILE(
- [
+int
+main () {
+struct hostent h;
+struct hostent_data hdata;
+char *name = "localhost";
+int rc;
+memset(&h, 0, sizeof(struct hostent));
+memset(&hdata, 0, sizeof(struct hostent_data));
+rc = gethostbyname_r(name, &h, &hdata);
+exit (rc != 0 ? 1 : 0); }],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
+ ac_cv_gethostbyname_args=3],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
+ AC_TRY_RUN([
+#define _REENTRANT
+
+#include <string.h>
#include <sys/types.h>
-#include <netdb.h>],
- [
+#include <netdb.h>
+
+int
+main () {
struct hostent h;
struct hostent_data hdata;
-char *name;
-int rc;
-rc = gethostbyname_r(name, &h, &hdata);],
- ac_cv_gethostbyname_args=3)
- fi
- if test -z "$ac_cv_gethostbyname_args"; then
- AC_TRY_COMPILE(
- [
+char *name = "localhost";
+int rc;
+memset(&h, 0, sizeof(struct hostent));
+memset(&hdata, 0, sizeof(struct hostent_data));
+rc = gethostbyname_r(name, &h, &hdata);
+exit (rc != 0 ? 1 : 0); }],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
+ AC_DEFINE(NEED_REENTRANT)
+ ac_cv_gethostbyname_args=3],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
+ AC_TRY_RUN([
#include <sys/types.h>
-#include <netdb.h>],
- [
+#include <netdb.h>
+
+int
+main () {
struct hostent *hp;
struct hostent h;
-char *name;
-char buffer[10];
-int h_errno;
-hp = gethostbyname_r(name, &h, buffer, 10, &h_errno);],
- ac_cv_gethostbyname_args=5)
- fi
- if test -z "$ac_cv_gethostbyname_args"; then
- AC_TRY_COMPILE(
- [
+char *name = "localhost";
+char buffer[8192];
+int h_errno;
+hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
+exit (hp == NULL ? 1 : 0); }],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
+ ac_cv_gethostbyname_args=5],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
+ AC_TRY_RUN([
#include <sys/types.h>
-#include <netdb.h>],
- [
+#include <netdb.h>
+
+int
+main () {
struct hostent h;
struct hostent *hp;
-char *name;
+char *name = "localhost";
char buf[10];
int rc;
int h_errno;
-
rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno);
- ],
- ac_cv_gethostbyname_args=6)
- fi
- if test -z "$ac_cv_gethostbyname_args"; then
- AC_MSG_RESULT(no)
- have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"
- else
- if test "$ac_cv_gethostbyname_args" = 3; then
- AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
- elif test "$ac_cv_gethostbyname_args" = 5; then
- AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
- elif test "$ac_cv_gethostbyname_args" = 6; then
- AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
- fi
- AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyname_args arguments])
- fi
-
-dnl **********************************************************************
-dnl Time to make a check for gethostbyaddr_r
-dnl If it exists, it may use one of three different interfaces
-dnl **********************************************************************
- AC_MSG_CHECKING(for gethostbyaddr_r)
- if test -z "$ac_cv_gethostbyaddr_args"; then
- AC_TRY_COMPILE(
- [
+exit (rc != 0 ? 1 : 0); }],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
+ ac_cv_gethostbyname_args=6],[
+ AC_MSG_RESULT(no)
+ have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"])])])])])
+
+ dnl check for number of arguments to gethostbyaddr_r. it might take
+ dnl either 5, 7, or 8 arguments.
+ AC_CHECK_FUNCS(gethostbyaddr_r,[
+ AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
+ AC_TRY_COMPILE([
#include <sys/types.h>
-#include <netdb.h>],
- [
- char * address;
- int length;
- int type;
- struct hostent h;
- struct hostent_data hdata;
- int rc;
- rc = gethostbyaddr_r(address, length, type, &h, &hdata);
- ],
- ac_cv_gethostbyaddr_args=5)
-
- fi
- if test -z "$ac_cv_gethostbyaddr_args"; then
- AC_TRY_COMPILE(
- [
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+struct hostent_data hdata;
+int rc;
+rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
+ ac_cv_gethostbyaddr_args=5],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
+ AC_TRY_COMPILE([
+#define _REENTRANT
#include <sys/types.h>
-#include <netdb.h>],
- [
- char * address;
- int length;
- int type;
- struct hostent h;
- char buffer[10];
- int buflen;
- int h_errnop;
- struct hostent * hp;
-
- hp = gethostbyaddr_r(address, length, type, &h,
- buffer, buflen, &h_errnop);
- ],
- ac_cv_gethostbyaddr_args=7)
- fi
-
- if test -z "$ac_cv_gethostbyaddr_args"; then
- AC_TRY_COMPILE(
- [
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+struct hostent_data hdata;
+int rc;
+rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
+ AC_DEFINE(NEED_REENTRANT)
+ ac_cv_gethostbyaddr_args=5],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
+ AC_TRY_COMPILE([
#include <sys/types.h>
-#include <netdb.h>],
- [
- char * address;
- int length;
- int type;
- struct hostent h;
- char buffer[10];
- int buflen;
- int h_errnop;
- struct hostent * hp;
- int rc;
-
- rc = gethostbyaddr_r(address, length, type, &h,
- buffer, buflen, &hp, &h_errnop);
- ],
- ac_cv_gethostbyaddr_args=8)
- fi
- if test -z "$ac_cv_gethostbyaddr_args"; then
- AC_MSG_RESULT(no)
- have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"
- else
- if test "$ac_cv_gethostbyaddr_args" = 5; then
- AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
- elif test "$ac_cv_gethostbyaddr_args" = 7; then
- AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
- elif test "$ac_cv_gethostbyaddr_args" = 8; then
- AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
- fi
- AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyaddr_args arguments])
- fi
-
- fi
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+char buffer[10];
+int buflen;
+int h_errnop;
+struct hostent * hp;
+
+hp = gethostbyaddr_r(address, length, type, &h,
+ buffer, buflen, &h_errnop);],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
+ ac_cv_gethostbyaddr_args=7],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <netdb.h>],[
+char * address;
+int length;
+int type;
+struct hostent h;
+char buffer[10];
+int buflen;
+int h_errnop;
+struct hostent * hp;
+int rc;
+rc = gethostbyaddr_r(address, length, type, &h,
+ buffer, buflen, &hp, &h_errnop);],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
+ ac_cv_gethostbyaddr_args=8],[
+ AC_MSG_RESULT(no)
+ have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
+
+ dnl determine if function definition for inet_ntoa_r exists.
+ AC_CHECK_FUNCS(inet_ntoa_r,[
+ AC_MSG_CHECKING(whether inet_ntoa_r is declared)
+ AC_EGREP_CPP(inet_ntoa_r,[
+#include <arpa/inet.h>],[
+ AC_DEFINE(HAVE_INET_NTOA_R_DECL)
+ AC_MSG_RESULT(yes)],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
+ AC_EGREP_CPP(inet_ntoa_r,[
+#define _REENTRANT
+#include <arpa/inet.h>],[
+ AC_DEFINE(HAVE_INET_NTOA_R_DECL)
+ AC_DEFINE(NEED_REENTRANT)
+ AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))])])
+
+ dnl check for a few thread-safe functions
+ AC_CHECK_FUNCS(localtime_r,[
+ AC_MSG_CHECKING(whether localtime_r is declared)
+ AC_EGREP_CPP(localtime_r,[
+#include <time.h>],[
+ AC_MSG_RESULT(yes)],[
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
+ AC_EGREP_CPP(localtime_r,[
+#define _REENTRANT
+#include <time.h>],[
+ AC_DEFINE(NEED_REENTRANT)
+ AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))])])
fi
-
dnl **********************************************************************
dnl Back to "normal" configuring
dnl **********************************************************************
@@ -332,6 +368,7 @@ AC_CHECK_HEADERS( \
arpa/inet.h \
net/if.h \
netinet/in.h \
+ netinet/if_ether.h \
netdb.h \
sys/select.h \
sys/socket.h \