fixed some build problems on mac os x 10.1

This commit is contained in:
hyung-hwan 2015-04-26 16:20:21 +00:00
parent f9b3428a21
commit 0a8e84add2
9 changed files with 92 additions and 30 deletions

View File

@ -36,7 +36,7 @@
# include <fcntl.h> # include <fcntl.h>
#endif #endif
#if defined(HAVE_SSL) #if defined(HAVE_OPENSSL_SSL_H) && defined(HAVE_SSL)
# include <openssl/ssl.h> # include <openssl/ssl.h>
# if defined(HAVE_OPENSSL_ERR_H) # if defined(HAVE_OPENSSL_ERR_H)
# include <openssl/err.h> # include <openssl/err.h>
@ -44,12 +44,17 @@
# if defined(HAVE_OPENSSL_ENGINE_H) # if defined(HAVE_OPENSSL_ENGINE_H)
# include <openssl/engine.h> # include <openssl/engine.h>
# endif # endif
# define USE_SSL
#endif #endif
#if defined(HAVE_SYS_PRCTL_H) #if defined(HAVE_SYS_PRCTL_H)
# include <sys/prctl.h> # include <sys/prctl.h>
#endif #endif
#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
#endif
#if defined(HAVE_SYS_RESOURCE_H) #if defined(HAVE_SYS_RESOURCE_H)
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif
@ -2852,14 +2857,14 @@ int qse_main (int argc, qse_achar_t* argv[])
/*trace2com_init (1, 38400);*/ /*trace2com_init (1, 38400);*/
#endif #endif
#if defined(HAVE_SSL) #if defined(USE_SSL)
SSL_load_error_strings (); SSL_load_error_strings ();
SSL_library_init (); SSL_library_init ();
#endif #endif
ret = qse_runmain (argc, argv, httpd_main); ret = qse_runmain (argc, argv, httpd_main);
#if defined(HAVE_SSL) #if defined(USE_SSL)
/* ERR_remove_state() should be called for each thread if the application is thread */ /* ERR_remove_state() should be called for each thread if the application is thread */
ERR_remove_state (0); ERR_remove_state (0);
#if defined(HAVE_ENGINE_CLEANUP) #if defined(HAVE_ENGINE_CLEANUP)

View File

@ -59,6 +59,10 @@
# include <sys/prctl.h> # include <sys/prctl.h>
#endif #endif
#if defined(HAVE_SYS_TIME_H)
# include <sys/time.h>
#endif
#if defined(HAVE_SYS_RESOURCE_H) #if defined(HAVE_SYS_RESOURCE_H)
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif

2
qse/configure vendored
View File

@ -18198,7 +18198,7 @@ fi
if test "x$enable_ssl_is" = "xyes" if test "x$enable_ssl_is" = "xyes"
then then
for ac_header in openssl/err.h openssl/engine.h for ac_header in openssl/ssl.h openssl/err.h openssl/engine.h
do : do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"

View File

@ -263,7 +263,7 @@ AC_ARG_ENABLE([ssl], [AS_HELP_STRING([--enable-ssl],[build the library in the ss
enable_ssl_is=$enableval,enable_ssl_is=yes) enable_ssl_is=$enableval,enable_ssl_is=yes)
if test "x$enable_ssl_is" = "xyes" if test "x$enable_ssl_is" = "xyes"
then then
AC_CHECK_HEADERS([openssl/err.h openssl/engine.h]) AC_CHECK_HEADERS([openssl/ssl.h openssl/err.h openssl/engine.h])
dnl check for an SSL library dnl check for an SSL library
AC_CHECK_FUNCS([SSL_library_init]) AC_CHECK_FUNCS([SSL_library_init])

View File

@ -156,6 +156,13 @@ available for the native makefile for Watcom C/C++ for OS/2 only.
wmake TCPV40HDRS=on wmake TCPV40HDRS=on
### C++ ###
C++ support is enabled by default as long as a C++ compiler is detected.
If you want to disable it for any reasons, you can specify `--disable-cxx`.
./configure --disable-cxx
### SCO UNIX System V/386 Release 3.2 ### ### SCO UNIX System V/386 Release 3.2 ###
- If /usr/include/netinet and /usr/include/net are missing, - If /usr/include/netinet and /usr/include/net are missing,
@ -173,13 +180,48 @@ available for the native makefile for Watcom C/C++ for OS/2 only.
for dificiency of the bundled make utility. for dificiency of the bundled make utility.
- Do not include -g in CFLAGS. - Do not include -g in CFLAGS.
./configure GREP=/bin/grep RANLIB=/bin/true CFLAGS="" RAN ./configure GREP=/bin/grep RANLIB=/bin/true CFLAGS=""
- Remove $(LIBLTDL) from LIBADD_LIB_COMMON in lib/awk/Makefile - Remove $(LIBLTDL) from LIBADD_LIB_COMMON in lib/awk/Makefile
- Remove $(LIBLTDL) from libqsehttp_la_LIBADD in lib/http/Makefile - Remove $(LIBLTDL) from libqsehttp_la_LIBADD in lib/http/Makefile
make make
### Mac OS X/Darwin ###
No special consideration is required if you work with moderately recent
version of developer tools. The GCC compiler by Apple before early 2000's
has an option called `-no-cpp-precomp`.
\code
% cc -E /tmp/a.c
#1 "/tmp/a.c"
int main ( )
{
Lxxxx ;
return 0 ;
}
% cc -E -no-cpp-precomp /tmp/a.c
#1 "/tmp/a.c"
int main ( )
{
Lxxxx ;
return 0 ;
}
\endcode
Without the `-no-cpp-precomp` option, some preprocessing produces erroneous
code. If your compiler behaves this way, you should specify `-no-cpp-precomp`
to CFLAGS or CXXFLAGS when running configure. For instance,
$ ./configure --prefix=/usr/local --disable-cxx CFLAGS="-Wall -g -no-cpp-precomp"
### More options ### ### More options ###
More options are available for the configure script. Execute this for more More options are available for the configure script. Execute this for more

View File

@ -416,6 +416,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/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H
/* Define to 1 if you have the `posix_spawn' function. */ /* Define to 1 if you have the `posix_spawn' function. */
#undef HAVE_POSIX_SPAWN #undef HAVE_POSIX_SPAWN

View File

@ -862,7 +862,9 @@ int qse_fio_init (
if (flags & QSE_FIO_CREATE) desired_access |= O_CREAT; if (flags & QSE_FIO_CREATE) desired_access |= O_CREAT;
if (flags & QSE_FIO_TRUNCATE) desired_access |= O_TRUNC; if (flags & QSE_FIO_TRUNCATE) desired_access |= O_TRUNC;
if (flags & QSE_FIO_EXCLUSIVE) desired_access |= O_EXCL; if (flags & QSE_FIO_EXCLUSIVE) desired_access |= O_EXCL;
#if defined(O_SYNC)
if (flags & QSE_FIO_SYNC) desired_access |= O_SYNC; if (flags & QSE_FIO_SYNC) desired_access |= O_SYNC;
#endif
#if defined(O_NOFOLLOW) #if defined(O_NOFOLLOW)
if (flags & QSE_FIO_NOFOLLOW) desired_access |= O_NOFOLLOW; if (flags & QSE_FIO_NOFOLLOW) desired_access |= O_NOFOLLOW;

View File

@ -421,8 +421,13 @@
#elif defined(HAVE_DIR_D_FD) #elif defined(HAVE_DIR_D_FD)
# define QSE_DIRFD(dir) ((dir)->d_fd) # define QSE_DIRFD(dir) ((dir)->d_fd)
#else #else
# if defined(dirfd)
/* mac os x 10.1 defines dirfd as a macro */
# define QSE_DIRFD(dir) dirfd(dir)
# else
# error OUCH!!! NO DIRFD AVAILABLE # error OUCH!!! NO DIRFD AVAILABLE
# endif # endif
#endif
#define QSE_DIR DIR #define QSE_DIR DIR
#if defined(HAVE_READDIR64) #if defined(HAVE_READDIR64)

View File

@ -130,7 +130,7 @@
# define USE_LTDL # define USE_LTDL
#endif #endif
#if defined(HAVE_SSL) #if defined(HAVE_OPENSSL_SSL_H) && defined(HAVE_SSL)
# include <openssl/ssl.h> # include <openssl/ssl.h>
# if defined(HAVE_OPENSSL_ERR_H) # if defined(HAVE_OPENSSL_ERR_H)
# include <openssl/err.h> # include <openssl/err.h>
@ -138,6 +138,7 @@
# if defined(HAVE_OPENSSL_ENGINE_H) # if defined(HAVE_OPENSSL_ENGINE_H)
# include <openssl/engine.h> # include <openssl/engine.h>
# endif # endif
# define USE_SSL
#endif #endif
#if defined(__linux) && !defined(SO_REUSEPORT) #if defined(__linux) && !defined(SO_REUSEPORT)
@ -147,7 +148,7 @@
#define HANDLE_TO_FIO(x) ((qse_fio_t*)(x)) #define HANDLE_TO_FIO(x) ((qse_fio_t*)(x))
#define FIO_TO_HANDLE(x) ((qse_httpd_hnd_t)(x)) #define FIO_TO_HANDLE(x) ((qse_httpd_hnd_t)(x))
#if defined(HAVE_SSL) #if defined(USE_SSL)
#define HANDLE_TO_SSL(x) ((SSL*)(x)) #define HANDLE_TO_SSL(x) ((SSL*)(x))
#define SSL_TO_HANDLE(x) ((qse_httpd_hnd_t)(x)) #define SSL_TO_HANDLE(x) ((qse_httpd_hnd_t)(x))
#endif #endif
@ -161,7 +162,7 @@ struct server_xtn_t
qse_httpd_serverstd_makersrc_t makersrc; qse_httpd_serverstd_makersrc_t makersrc;
qse_httpd_serverstd_freersrc_t freersrc; qse_httpd_serverstd_freersrc_t freersrc;
#if defined(HAVE_SSL) #if defined(USE_SSL)
SSL_CTX* ssl_ctx; SSL_CTX* ssl_ctx;
#endif #endif
@ -565,7 +566,7 @@ static QSE_INLINE qse_ssize_t __send_file_ssl (
qse_httpd_t* httpd, void* xout, qse_httpd_hnd_t in_fd, qse_httpd_t* httpd, void* xout, qse_httpd_hnd_t in_fd,
qse_foff_t* offset, qse_size_t count) qse_foff_t* offset, qse_size_t count)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
qse_mchar_t buf[MAX_SEND_SIZE]; qse_mchar_t buf[MAX_SEND_SIZE];
qse_ssize_t ret; qse_ssize_t ret;
qse_foff_t foff; qse_foff_t foff;
@ -615,7 +616,7 @@ static QSE_INLINE qse_ssize_t __send_file_ssl (
typedef struct httpd_xtn_t httpd_xtn_t; typedef struct httpd_xtn_t httpd_xtn_t;
struct httpd_xtn_t struct httpd_xtn_t
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
SSL_CTX* ssl_peer_ctx; SSL_CTX* ssl_peer_ctx;
#endif #endif
qse_httpd_ecb_t ecb; qse_httpd_ecb_t ecb;
@ -623,7 +624,7 @@ struct httpd_xtn_t
qse_httpd_ursstd_t urs; qse_httpd_ursstd_t urs;
}; };
#if defined(HAVE_SSL) #if defined(USE_SSL)
static int init_server_ssl (qse_httpd_t* httpd, qse_httpd_server_t* server) static int init_server_ssl (qse_httpd_t* httpd, qse_httpd_server_t* server)
{ {
SSL_CTX* ssl_ctx = QSE_NULL; SSL_CTX* ssl_ctx = QSE_NULL;
@ -729,7 +730,7 @@ static void cleanup_standard_httpd (qse_httpd_t* httpd)
httpd_xtn_t* xtn; httpd_xtn_t* xtn;
xtn = (httpd_xtn_t*)qse_httpd_getxtn (httpd); xtn = (httpd_xtn_t*)qse_httpd_getxtn (httpd);
#if defined(HAVE_SSL) #if defined(USE_SSL)
if (xtn->ssl_peer_ctx) fini_xtn_peer_ssl (xtn); if (xtn->ssl_peer_ctx) fini_xtn_peer_ssl (xtn);
#endif #endif
@ -766,7 +767,7 @@ qse_httpd_t* qse_httpd_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize)
lt_dlinited = 1; lt_dlinited = 1;
#endif #endif
#if defined(HAVE_SSL) #if defined(USE_SSL)
if (init_xtn_peer_ssl (httpd) <= -1) goto oops; if (init_xtn_peer_ssl (httpd) <= -1) goto oops;
#endif #endif
@ -778,7 +779,7 @@ qse_httpd_t* qse_httpd_openstdwithmmgr (qse_mmgr_t* mmgr, qse_size_t xtnsize)
return httpd; return httpd;
oops: oops:
#if defined(HAVE_SSL) #if defined(USE_SSL)
if (xtn && xtn->ssl_peer_ctx) fini_xtn_peer_ssl (xtn); if (xtn && xtn->ssl_peer_ctx) fini_xtn_peer_ssl (xtn);
#endif #endif
#if defined(USE_LTDL) #if defined(USE_LTDL)
@ -1159,7 +1160,7 @@ static qse_ssize_t client_recv (
{ {
if (client->status & QSE_HTTPD_CLIENT_SECURE) if (client->status & QSE_HTTPD_CLIENT_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
int ret = SSL_read (HANDLE_TO_SSL(client->handle2), buf, bufsize); int ret = SSL_read (HANDLE_TO_SSL(client->handle2), buf, bufsize);
if (ret <= -1) if (ret <= -1)
{ {
@ -1196,7 +1197,7 @@ static qse_ssize_t client_send (
{ {
if (client->status & QSE_HTTPD_CLIENT_SECURE) if (client->status & QSE_HTTPD_CLIENT_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
int ret = SSL_write (HANDLE_TO_SSL(client->handle2), buf, bufsize); int ret = SSL_write (HANDLE_TO_SSL(client->handle2), buf, bufsize);
if (ret <= -1) if (ret <= -1)
{ {
@ -1238,7 +1239,7 @@ static int client_accepted (qse_httpd_t* httpd, qse_httpd_client_t* client)
{ {
if (client->status & QSE_HTTPD_CLIENT_SECURE) if (client->status & QSE_HTTPD_CLIENT_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
int ret; int ret;
SSL* ssl; SSL* ssl;
server_xtn_t* server_xtn; server_xtn_t* server_xtn;
@ -1316,7 +1317,7 @@ static void client_closed (qse_httpd_t* httpd, qse_httpd_client_t* client)
{ {
if (client->status & QSE_HTTPD_CLIENT_SECURE) if (client->status & QSE_HTTPD_CLIENT_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
if ((SSL*)client->handle2) if ((SSL*)client->handle2)
{ {
SSL_shutdown ((SSL*)client->handle2); /* is this needed? */ SSL_shutdown ((SSL*)client->handle2); /* is this needed? */
@ -1338,7 +1339,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
int connected = 1; int connected = 1;
qse_sck_hnd_t fd = QSE_INVALID_SCKHND; qse_sck_hnd_t fd = QSE_INVALID_SCKHND;
#if defined(HAVE_SSL) #if defined(USE_SSL)
SSL* ssl = QSE_NULL; SSL* ssl = QSE_NULL;
#endif #endif
@ -1396,7 +1397,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
if (peer->flags & QSE_HTTPD_PEER_SECURE) if (peer->flags & QSE_HTTPD_PEER_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
QSE_ASSERT (xtn->ssl_peer_ctx != QSE_NULL); QSE_ASSERT (xtn->ssl_peer_ctx != QSE_NULL);
ssl = SSL_new (xtn->ssl_peer_ctx); ssl = SSL_new (xtn->ssl_peer_ctx);
@ -1453,7 +1454,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
if ((peer->flags & QSE_HTTPD_PEER_SECURE) && connected) if ((peer->flags & QSE_HTTPD_PEER_SECURE) && connected)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
int ret = SSL_connect (ssl); int ret = SSL_connect (ssl);
if (ret <= 0) if (ret <= 0)
{ {
@ -1482,7 +1483,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
peer->handle = fd; peer->handle = fd;
if (peer->flags & QSE_HTTPD_PEER_SECURE) if (peer->flags & QSE_HTTPD_PEER_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
peer->handle2 = SSL_TO_HANDLE(ssl); peer->handle2 = SSL_TO_HANDLE(ssl);
#endif #endif
} }
@ -1490,7 +1491,7 @@ static int peer_open (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
oops: oops:
qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM()); qse_httpd_seterrnum (httpd, SKERR_TO_ERRNUM());
#if defined(HAVE_SSL) #if defined(USE_SSL)
if (ssl) SSL_free (ssl); if (ssl) SSL_free (ssl);
#endif #endif
if (qse_isvalidsckhnd(fd)) qse_closesckhnd (fd); if (qse_isvalidsckhnd(fd)) qse_closesckhnd (fd);
@ -1503,7 +1504,7 @@ static void peer_close (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
{ {
if (peer->flags & QSE_HTTPD_PEER_SECURE) if (peer->flags & QSE_HTTPD_PEER_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
SSL_free (HANDLE_TO_SSL(peer->handle2)); SSL_free (HANDLE_TO_SSL(peer->handle2));
#endif #endif
} }
@ -1581,7 +1582,7 @@ static int is_peer_socket_connected (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
static int is_peer_connected_securely (qse_httpd_t* httpd, qse_httpd_peer_t* peer) static int is_peer_connected_securely (qse_httpd_t* httpd, qse_httpd_peer_t* peer)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
int ret = SSL_connect (HANDLE_TO_SSL(peer->handle2)); int ret = SSL_connect (HANDLE_TO_SSL(peer->handle2));
if (ret <= 0) if (ret <= 0)
{ {
@ -1632,7 +1633,7 @@ static qse_ssize_t peer_recv (
{ {
if (peer->flags & QSE_HTTPD_PEER_SECURE) if (peer->flags & QSE_HTTPD_PEER_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
int ret = SSL_read (HANDLE_TO_SSL(peer->handle2), buf, bufsize); int ret = SSL_read (HANDLE_TO_SSL(peer->handle2), buf, bufsize);
if (ret <= -1) if (ret <= -1)
{ {
@ -1668,7 +1669,7 @@ static qse_ssize_t peer_send (
{ {
if (peer->flags & QSE_HTTPD_PEER_SECURE) if (peer->flags & QSE_HTTPD_PEER_SECURE)
{ {
#if defined(HAVE_SSL) #if defined(USE_SSL)
int ret = SSL_write (HANDLE_TO_SSL(peer->handle2), buf, bufsize); int ret = SSL_write (HANDLE_TO_SSL(peer->handle2), buf, bufsize);
if (ret <= -1) if (ret <= -1)
{ {
@ -3368,7 +3369,7 @@ static void detach_server (qse_httpd_t* httpd, qse_httpd_server_t* server)
if (server_xtn->detach) server_xtn->detach (httpd, server); if (server_xtn->detach) server_xtn->detach (httpd, server);
if (server_xtn->auth.ptr) QSE_MMGR_FREE (httpd->mmgr, server_xtn->auth.ptr); if (server_xtn->auth.ptr) QSE_MMGR_FREE (httpd->mmgr, server_xtn->auth.ptr);
#if defined(HAVE_SSL) #if defined(USE_SSL)
if (server_xtn->ssl_ctx) fini_server_ssl (server_xtn); if (server_xtn->ssl_ctx) fini_server_ssl (server_xtn);
#endif #endif
} }