move strndup() code into config.c for less complexity
change AC_REPLACE_FUNC(strndup) to AC_CHECK_FUNCS(strndup) sed expression checking for gcc-3.0 should be quoted beccause it fails under Solaris 2.7
This commit is contained in:
parent
2881d173b5
commit
06a5edb452
11
config.c
11
config.c
|
@ -57,6 +57,17 @@ config_defaults (config_t * conf)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_STRNDUP
|
||||||
|
static char *
|
||||||
|
strndup (const char *s, size_t nchars)
|
||||||
|
{
|
||||||
|
char *r = malloc (sizeof (char) * (nchars + 1));
|
||||||
|
strncpy (r, s, nchars);
|
||||||
|
r[nchars] = 0;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
#endif /* ! HAVE_STRNDUP */
|
||||||
|
|
||||||
char *
|
char *
|
||||||
expand_strdup (const char *s)
|
expand_strdup (const char *s)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,14 +8,13 @@ AC_ARG_WITH(ssl-dir, [ --with-ssl-dir=DIR location where openssl is insalled],
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR(can't find OpenSSL in $withval)
|
AC_MSG_ERROR(can't find OpenSSL in $withval)
|
||||||
fi])
|
fi])
|
||||||
AC_REPLACE_FUNCS(strndup)
|
AC_CHECK_FUNCS(getopt_long strndup)
|
||||||
AC_CHECK_FUNCS(getopt_long)
|
|
||||||
AC_CHECK_LIB(socket,socket)
|
AC_CHECK_LIB(socket,socket)
|
||||||
AC_CHECK_LIB(nsl,inet_ntoa)
|
AC_CHECK_LIB(nsl,inet_ntoa)
|
||||||
AC_CHECK_LIB(crypto,ERR_error_string)
|
AC_CHECK_LIB(crypto,ERR_error_string)
|
||||||
AC_CHECK_LIB(ssl,SSL_library_init)
|
AC_CHECK_LIB(ssl,SSL_library_init)
|
||||||
dnl test for gcc. use the prefix so we know that gcc-3.0 is also gcc
|
dnl test for gcc. use the prefix so we know that gcc-3.0 is also gcc
|
||||||
if test `echo $CC | sed s,^gcc.*,gcc,` = gcc; then
|
if test `echo $CC | sed 's/^gcc.*/gcc/'` = gcc; then
|
||||||
CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wmissing-prototypes"
|
CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wmissing-prototypes"
|
||||||
fi
|
fi
|
||||||
AC_OUTPUT(Makefile)
|
AC_OUTPUT(Makefile)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user