summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2015-08-29 12:23:45 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2015-08-29 12:23:45 +0000
commitc6f0d92388baf742018e2296678668e3a7a24bd6 (patch)
treed5ef0b9a0aa4847fa9f30508ab950b0518f6168e
parent998028e887f893df6556614386656770ef08abf8 (diff)
downloadlighttpd-c6f0d92388baf742018e2296678668e3a7a24bd6.tar.gz
[scons] fix crypt() detection, other improvements
From: Stefan Bühler <stbuehler@web.de> git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@3032 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r--SConstruct71
-rw-r--r--src/http_auth.c3
2 files changed, 42 insertions, 32 deletions
diff --git a/SConstruct b/SConstruct
index 069cd706..1486560f 100644
--- a/SConstruct
+++ b/SConstruct
@@ -13,8 +13,8 @@ def checkCHeaders(autoconf, hdrs):
if not hdr:
continue
_hdr = Split(hdr)
- if autoconf.CheckCHeader(_hdr):
- autoconf.env.Append(CPPFLAGS = [ '-DHAVE_' + p.sub('_', _hdr[-1].upper()) ])
+ if autoconf.CheckCHeader(_hdr):
+ autoconf.env.Append(CPPFLAGS = [ '-DHAVE_' + p.sub('_', _hdr[-1].upper()) ])
def checkFuncs(autoconf, funcs):
p = re.compile('[^A-Z0-9]')
@@ -127,49 +127,53 @@ if 1:
if 'LIBS' in os.environ:
autoconf.env.Append(APPEND_LIBS = os.environ['LIBS'])
print(">> Appending custom libraries : " + os.environ['LIBS'])
+ else:
+ autoconf.env.Append(APPEND_LIBS = '')
autoconf.headerfile = "foo.h"
checkCHeaders(autoconf, string.split("""
arpa/inet.h
+ crypt.h
fcntl.h
+ getopt.h
+ inttypes.h
netinet/in.h
- sys/types.h netinet/in.h
+ poll.h
+ pwd.h
+ stdint.h
stdlib.h
string.h
- sys/socket.h
- sys/types.h sys/socket.h
- sys/time.h
- unistd.h
- sys/sendfile.h
- sys/uio.h
- sys/types.h sys/uio.h
- getopt.h
- sys/epoll.h
- sys/select.h
- sys/types.h sys/select.h
- poll.h
- sys/poll.h
sys/devpoll.h
+ sys/epoll.h
+ sys/event.h
sys/filio.h
sys/mman.h
- sys/types.h sys/mman.h
- sys/event.h
- sys/types.h sys/event.h
+ sys/poll.h
sys/port.h
- winsock2.h
- pwd.h
+ sys/prctl.h
sys/resource.h
+ sys/select.h
+ sys/sendfile.h
+ sys/socket.h
+ sys/time.h
sys/time.h sys/types.h sys/resource.h
- sys/un.h
+ sys/types.h netinet/in.h
+ sys/types.h sys/event.h
+ sys/types.h sys/mman.h
+ sys/types.h sys/select.h
+ sys/types.h sys/socket.h
+ sys/types.h sys/uio.h
sys/types.h sys/un.h
+ sys/uio.h
+ sys/un.h
+ sys/wait.h
syslog.h
- stdint.h
- inttypes.h
- sys/prctl.h
- sys/wait.h""", "\n"))
+ unistd.h
+ winsock2.h
+ """, "\n"))
checkFuncs(autoconf, Split('fork stat lstat strftime dup2 getcwd inet_ntoa inet_ntop memset mmap munmap strchr \
- strdup strerror strstr strtol sendfile getopt socket \
+ strdup strerror strstr strtol sendfile getopt socket \
gethostbyname poll epoll_ctl getrlimit chroot \
getuid select signal pathconf madvise prctl\
writev sigaction sendfile64 send_file kqueue port_create localtime_r posix_fadvise issetugid inet_pton'))
@@ -178,16 +182,21 @@ if 1:
autoconf.env.Append( LIBSQLITE3 = '', LIBXML2 = '', LIBMYSQL = '', LIBZ = '',
LIBBZ2 = '', LIBCRYPT = '', LIBMEMCACHE = '', LIBFCGI = '', LIBPCRE = '',
- LIBLDAP = '', LIBLBER = '', LIBLUA = '', LIBDL = '')
+ LIBLDAP = '', LIBLBER = '', LIBLUA = '', LIBDL = '', LIBUUID = '')
if env['with_fam']:
if autoconf.CheckLibWithHeader('fam', 'fam.h', 'C'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_FAM_H', '-DHAVE_LIBFAM' ], LIBS = 'fam')
checkFuncs(autoconf, ['FAMNoExists']);
-
- if autoconf.CheckLibWithHeader('crypt', 'crypt.h', 'C'):
- autoconf.env.Append(CPPFLAGS = [ '-DHAVE_CRYPT_H', '-DHAVE_LIBCRYPT' ], LIBCRYPT = 'crypt')
+ if autoconf.CheckLib('crypt'):
+ autoconf.env.Append(CPPFLAGS = [ '-DHAVE_LIBCRYPT' ], LIBCRYPT = 'crypt')
+ oldlib = env['LIBS']
+ env['LIBS'] += ['crypt']
+ checkFuncs(autoconf, ['crypt', 'crypt_r']);
+ env['LIBS'] = oldlib
+ else:
+ checkFuncs(autoconf, ['crypt', 'crypt_r']);
if autoconf.CheckLibWithHeader('uuid', 'uuid/uuid.h', 'C'):
autoconf.env.Append(CPPFLAGS = [ '-DHAVE_UUID_UUID_H', '-DHAVE_LIBUUID' ], LIBUUID = 'uuid')
diff --git a/src/http_auth.c b/src/http_auth.c
index dacf70a4..710d6f1b 100644
--- a/src/http_auth.c
+++ b/src/http_auth.c
@@ -11,7 +11,8 @@
# define _XOPEN_SOURCE
#endif
-#ifdef HAVE_LIBCRYPT
+#if defined(HAVE_LIBCRYPT) && !defined(HAVE_CRYPT)
+/* always assume crypt() is present if we have -lcrypt */
# define HAVE_CRYPT
#endif