enhanced the openssl library check in configure.ac

This commit is contained in:
hyung-hwan 2019-01-30 19:07:05 +00:00
parent 559d125874
commit 4aa0da2011
9 changed files with 175 additions and 33 deletions

View File

@ -347,6 +347,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@
@ -577,7 +578,7 @@ distdir: $(DISTFILES)
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)" || chmod -R a+r "$(distdir)"
dist-gzip: distdir dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-bzip2: distdir dist-bzip2: distdir
@ -603,7 +604,7 @@ dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \ @echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2 "deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__post_remove_distdir) $(am__post_remove_distdir)
dist-zip: distdir dist-zip: distdir
@ -621,7 +622,7 @@ dist dist-all:
distcheck: dist distcheck: dist
case '$(DIST_ARCHIVES)' in \ case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \ *.tar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \ *.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lz*) \ *.tar.lz*) \
@ -631,7 +632,7 @@ distcheck: dist
*.tar.Z*) \ *.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \ *.shar.gz*) \
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \ *.zip*) \
unzip $(distdir).zip ;;\ unzip $(distdir).zip ;;\
esac esac

120
mio/configure vendored
View File

@ -771,6 +771,7 @@ infodir
docdir docdir
oldincludedir oldincludedir
includedir includedir
runstatedir
localstatedir localstatedir
sharedstatedir sharedstatedir
sysconfdir sysconfdir
@ -861,6 +862,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc' sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com' sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var' localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include' includedir='${prefix}/include'
oldincludedir='/usr/include' oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@ -1113,6 +1115,15 @@ do
| -silent | --silent | --silen | --sile | --sil) | -silent | --silent | --silen | --sile | --sil)
silent=yes ;; silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;; ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@ -1250,7 +1261,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \ datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir libdir localedir mandir runstatedir
do do
eval ac_val=\$$ac_var eval ac_val=\$$ac_var
# Remove trailing slashes. # Remove trailing slashes.
@ -1403,6 +1414,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var] --localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib] --libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include] --includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include] --oldincludedir=DIR C header files for non-gcc [/usr/include]
@ -18546,7 +18558,19 @@ fi
done done
if test "x$ac_cv_func_SSL_library_init" = "xyes" for ac_func in OPENSSL_init_ssl
do :
ac_fn_c_check_func "$LINENO" "OPENSSL_init_ssl" "ac_cv_func_OPENSSL_init_ssl"
if test "x$ac_cv_func_OPENSSL_init_ssl" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_OPENSSL_INIT_SSL 1
_ACEOF
fi
done
if test "x$ac_cv_func_SSL_library_init" = "xyes" -o "x$ac_cv_func_OPENSSL_init_ssl" = "xyes"
then then
$as_echo "#define HAVE_SSL 1" >>confdefs.h $as_echo "#define HAVE_SSL 1" >>confdefs.h
@ -18641,6 +18665,98 @@ fi
$as_echo "#define HAVE_SSL_LIBRARY_INIT 1" >>confdefs.h $as_echo "#define HAVE_SSL_LIBRARY_INIT 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL_init_ssl in -lssl" >&5
$as_echo_n "checking for OPENSSL_init_ssl in -lssl... " >&6; }
if ${ac_cv_lib_ssl_OPENSSL_init_ssl+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lssl $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char OPENSSL_init_ssl ();
int
main ()
{
return OPENSSL_init_ssl ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_ssl_OPENSSL_init_ssl=yes
else
ac_cv_lib_ssl_OPENSSL_init_ssl=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_OPENSSL_init_ssl" >&5
$as_echo "$ac_cv_lib_ssl_OPENSSL_init_ssl" >&6; }
if test "x$ac_cv_lib_ssl_OPENSSL_init_ssl" = xyes; then :
SSL_LIBS="-lssl"
$as_echo "#define HAVE_SSL 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ERR_get_error in -lcrypto" >&5
$as_echo_n "checking for ERR_get_error in -lcrypto... " >&6; }
if ${ac_cv_lib_crypto_ERR_get_error+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char ERR_get_error ();
int
main ()
{
return ERR_get_error ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_crypto_ERR_get_error=yes
else
ac_cv_lib_crypto_ERR_get_error=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_ERR_get_error" >&5
$as_echo "$ac_cv_lib_crypto_ERR_get_error" >&6; }
if test "x$ac_cv_lib_crypto_ERR_get_error" = xyes; then :
SSL_LIBS="${SSL_LIBS} -lcrypto"
fi
$as_echo "#define HAVE_OPENSSL_INIT_SSL 1" >>confdefs.h
fi fi
fi fi

View File

@ -279,7 +279,11 @@ then
dnl check for an SSL library dnl check for an SSL library
AC_CHECK_FUNCS([SSL_library_init]) AC_CHECK_FUNCS([SSL_library_init])
if test "x$ac_cv_func_SSL_library_init" = "xyes" dnl SSL_library_init is a macro aliasing OPENSSL_init_ssl in openssl 1.1.0 or later
dnl #define SSL_library_init() OPENSSL_init_ssl(0, NULL)
AC_CHECK_FUNCS([OPENSSL_init_ssl])
if test "x$ac_cv_func_SSL_library_init" = "xyes" -o "x$ac_cv_func_OPENSSL_init_ssl" = "xyes"
then then
AC_DEFINE(HAVE_SSL, 1, [ssl support]) AC_DEFINE(HAVE_SSL, 1, [ssl support])
else else
@ -295,6 +299,19 @@ then
dnl only for consistency with AC_CHECK_FUNCS dnl only for consistency with AC_CHECK_FUNCS
AC_DEFINE(HAVE_SSL_LIBRARY_INIT, 1) AC_DEFINE(HAVE_SSL_LIBRARY_INIT, 1)
]) ])
AC_CHECK_LIB([ssl], [OPENSSL_init_ssl], [
SSL_LIBS="-lssl"
AC_DEFINE(HAVE_SSL, 1, [ssl support])
dnl additional check
AC_CHECK_LIB([crypto], [ERR_get_error], [
SSL_LIBS="${SSL_LIBS} -lcrypto"
])
dnl only for consistency with AC_CHECK_FUNCS
AC_DEFINE(HAVE_OPENSSL_INIT_SSL, 1)
])
fi fi
OLDLIBS="$LIBS" OLDLIBS="$LIBS"

View File

@ -365,6 +365,7 @@ pdfdir = @pdfdir@
prefix = @prefix@ prefix = @prefix@
program_transform_name = @program_transform_name@ program_transform_name = @program_transform_name@
psdir = @psdir@ psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@ sharedstatedir = @sharedstatedir@
srcdir = @srcdir@ srcdir = @srcdir@

View File

@ -657,7 +657,7 @@ int main (int argc, char* argv[])
tcp_conn.options = MIO_DEV_SCK_CONNECT_SSL; tcp_conn.options = MIO_DEV_SCK_CONNECT_SSL;
if (mio_dev_sck_connect(tcp[0], &tcp_conn) <= -1) if (mio_dev_sck_connect(tcp[0], &tcp_conn) <= -1)
{ {
printf ("mio_dev_sck_connect() failed....\n"); MIO_INFO0 (mio, "tcp[0] mio_dev_sck_connect() failed....\n");
/* carry on regardless of failure */ /* carry on regardless of failure */
} }
@ -672,7 +672,7 @@ int main (int argc, char* argv[])
tcp[1] = mio_dev_sck_make(mio, MIO_SIZEOF(tcp_server_t), &tcp_make); tcp[1] = mio_dev_sck_make(mio, MIO_SIZEOF(tcp_server_t), &tcp_make);
if (!tcp[1]) if (!tcp[1])
{ {
printf ("Cannot make tcp\n"); MIO_INFO0 (mio, "cannot make tcp[1]....\n");
goto oops; goto oops;
} }
ts = (tcp_server_t*)(tcp[1] + 1); ts = (tcp_server_t*)(tcp[1] + 1);
@ -684,7 +684,7 @@ int main (int argc, char* argv[])
if (mio_dev_sck_bind(tcp[1],&tcp_bind) <= -1) if (mio_dev_sck_bind(tcp[1],&tcp_bind) <= -1)
{ {
printf ("tcp[1] mio_dev_sck_bind() failed....\n"); MIO_INFO0 (mio, "tcp[1] mio_dev_sck_bind() failed....\n");
goto oops; goto oops;
} }
@ -692,7 +692,7 @@ int main (int argc, char* argv[])
tcp_lstn.backlogs = 100; tcp_lstn.backlogs = 100;
if (mio_dev_sck_listen(tcp[1], &tcp_lstn) <= -1) if (mio_dev_sck_listen(tcp[1], &tcp_lstn) <= -1)
{ {
printf ("tcp[1] mio_dev_sck_listen() failed....\n"); MIO_INFO0 (mio, "tcp[1] mio_dev_sck_listen() failed....\n");
goto oops; goto oops;
} }
@ -722,14 +722,14 @@ int main (int argc, char* argv[])
if (mio_dev_sck_bind(tcp[2], &tcp_bind) <= -1) if (mio_dev_sck_bind(tcp[2], &tcp_bind) <= -1)
{ {
printf ("tcp[2] mio_dev_sck_bind() failed....\n"); MIO_INFO0 (mio, "tcp[2] mio_dev_sck_bind() failed....\n");
goto oops; goto oops;
} }
tcp_lstn.backlogs = 100; tcp_lstn.backlogs = 100;
if (mio_dev_sck_listen(tcp[2], &tcp_lstn) <= -1) if (mio_dev_sck_listen(tcp[2], &tcp_lstn) <= -1)
{ {
printf ("tcp[2] mio_dev_sck_listen() failed....\n"); MIO_INFO0 (mio, "tcp[2] mio_dev_sck_listen() failed....\n");
goto oops; goto oops;
} }

View File

@ -370,6 +370,9 @@
/* Define to 1 if you have the <openssl/err.h> header file. */ /* Define to 1 if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H #undef HAVE_OPENSSL_ERR_H
/* Define to 1 if you have the `OPENSSL_init_ssl' function. */
#undef HAVE_OPENSSL_INIT_SSL
/* Define to 1 if you have the <openssl/ssl.h> header file. */ /* Define to 1 if you have the <openssl/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H #undef HAVE_OPENSSL_SSL_H

View File

@ -1268,25 +1268,6 @@ int mio_dev_timedwrite (mio_dev_t* dev, const void* data, mio_iolen_t len, const
return __dev_write(dev, data, len, tmout, wrctx, dstaddr); return __dev_write(dev, data, len, tmout, wrctx, dstaddr);
} }
int mio_makesyshndasync (mio_t* mio, mio_syshnd_t hnd)
{
#if defined(F_GETFL) && defined(F_SETFL) && defined(O_NONBLOCK)
int flags;
if ((flags = fcntl(hnd, F_GETFL)) <= -1 ||
(flags = fcntl(hnd, F_SETFL, flags | O_NONBLOCK)) <= -1)
{
mio_seterrwithsyserr (mio, 0, errno);
return -1;
}
return 0;
#else
mio_seterrnum (mio, MIO_ENOIMPL);
return -1;
#endif
}
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
void mio_gettime (mio_t* mio, mio_ntime_t* now) void mio_gettime (mio_t* mio, mio_ntime_t* now)

View File

@ -67,3 +67,26 @@ void mio_sys_fini (mio_t* mio)
mio_freemem (mio, mio->sysdep); mio_freemem (mio, mio->sysdep);
mio->sysdep = MIO_NULL; mio->sysdep = MIO_NULL;
} }
/* TODO: migrate this function */
#include <fcntl.h>
#include <errno.h>
int mio_makesyshndasync (mio_t* mio, mio_syshnd_t hnd)
{
#if defined(F_GETFL) && defined(F_SETFL) && defined(O_NONBLOCK)
int flags;
if ((flags = fcntl(hnd, F_GETFL)) <= -1 ||
(flags = fcntl(hnd, F_SETFL, flags | O_NONBLOCK)) <= -1)
{
mio_seterrwithsyserr (mio, 0, errno);
return -1;
}
return 0;
#else
mio_seterrnum (mio, MIO_ENOIMPL);
return -1;
#endif
}