diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-03-14 16:52:56 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-03-14 21:32:18 +0300 |
commit | ccf820530b8c4964636718fa5c78f64891e1e4f4 (patch) | |
tree | e3b2dfc63d61e55d0250d6ba7c64b685f33e5a71 | |
parent | 60fa305ab8e6f118b171d146b95356fc083a2b44 (diff) | |
download | libmicrohttpd-ccf820530b8c4964636718fa5c78f64891e1e4f4.tar.gz libmicrohttpd-ccf820530b8c4964636718fa5c78f64891e1e4f4.zip |
configure: fixed checking for system libs, fixed .pc file
Fixed compiler warning when checking for libraries.
The private libraries var (used when linking with static lib) were fixed
in pkg-conf file.
-rw-r--r-- | configure.ac | 114 |
1 files changed, 91 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac index b3b666db..6f74f889 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -483,7 +483,8 @@ AC_CHECK_HEADERS_ONCE([stdio.h string.h stdint.h errno.h limits.h fcntl.h], [], | |||
483 | [AC_MSG_ERROR([Compiling libmicrohttpd requires standard POSIX headers files])], [AC_INCLUDES_DEFAULT]) | 483 | [AC_MSG_ERROR([Compiling libmicrohttpd requires standard POSIX headers files])], [AC_INCLUDES_DEFAULT]) |
484 | 484 | ||
485 | # Check for basic optional headers | 485 | # Check for basic optional headers |
486 | AC_CHECK_HEADERS([stddef.h stdlib.h inttypes.h sys/types.h sys/stat.h unistd.h], [], [], [AC_INCLUDES_DEFAULT]) | 486 | AC_CHECK_HEADERS([stddef.h stdlib.h inttypes.h sys/types.h sys/stat.h unistd.h \ |
487 | sys/uio.h], [], [], [AC_INCLUDES_DEFAULT]) | ||
487 | 488 | ||
488 | # Check for clock-specific optional headers | 489 | # Check for clock-specific optional headers |
489 | AC_CHECK_HEADERS([sys/time.h time.h], [], [], [AC_INCLUDES_DEFAULT]) | 490 | AC_CHECK_HEADERS([sys/time.h time.h], [], [], [AC_INCLUDES_DEFAULT]) |
@@ -983,8 +984,7 @@ AS_CASE(["$host_os"], | |||
983 | AC_DEFINE([_REENTRANT],[1],[Need with solaris or errno does not work]) | 984 | AC_DEFINE([_REENTRANT],[1],[Need with solaris or errno does not work]) |
984 | mhd_host_os='Solaris' | 985 | mhd_host_os='Solaris' |
985 | AC_MSG_RESULT([[$mhd_host_os]]) | 986 | AC_MSG_RESULT([[$mhd_host_os]]) |
986 | AC_SEARCH_LIBS([gethostbyname], [nsl]) | 987 | AC_SEARCH_LIBS([gethostbyname], [nsl])], |
987 | AC_SEARCH_LIBS([socket], [socket])], | ||
988 | [*linux*], | 988 | [*linux*], |
989 | [AC_DEFINE([LINUX],[1],[This is a Linux kernel]) | 989 | [AC_DEFINE([LINUX],[1],[This is a Linux kernel]) |
990 | mhd_host_os='Linux' | 990 | mhd_host_os='Linux' |
@@ -1000,7 +1000,6 @@ AS_CASE(["$host_os"], | |||
1000 | AC_DEFINE([WINDOWS],[1],[This is a Windows system]) | 1000 | AC_DEFINE([WINDOWS],[1],[This is a Windows system]) |
1001 | mhd_host_os='Windows/MinGW' | 1001 | mhd_host_os='Windows/MinGW' |
1002 | AC_MSG_RESULT([[$mhd_host_os]]) | 1002 | AC_MSG_RESULT([[$mhd_host_os]]) |
1003 | LIBS="-lws2_32 ${LIBS}" | ||
1004 | AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([[Winsock2 headers are required for W32]])], [AC_INCLUDES_DEFAULT]) | 1003 | AC_CHECK_HEADERS([winsock2.h ws2tcpip.h], [], [AC_MSG_ERROR([[Winsock2 headers are required for W32]])], [AC_INCLUDES_DEFAULT]) |
1005 | AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool], | 1004 | AC_CACHE_CHECK([for MS lib utility], [ac_cv_use_ms_lib_tool], |
1006 | [mslibcheck=`lib 2>&1` | 1005 | [mslibcheck=`lib 2>&1` |
@@ -1586,12 +1585,36 @@ AM_CONDITIONAL([W32_SHARED_LIB_EXP], [test "x$w32_shared_lib_exp" = "xyes"]) | |||
1586 | AM_CONDITIONAL([USE_MS_LIB_TOOL], [test "x$ac_cv_use_ms_lib_tool" = "xyes"]) | 1585 | AM_CONDITIONAL([USE_MS_LIB_TOOL], [test "x$ac_cv_use_ms_lib_tool" = "xyes"]) |
1587 | AM_CONDITIONAL([USE_EXPORT_FILE], [test "x$use_expfile" = "xyes"]) | 1586 | AM_CONDITIONAL([USE_EXPORT_FILE], [test "x$use_expfile" = "xyes"]) |
1588 | 1587 | ||
1588 | MHD_FIND_LIB([socket], | ||
1589 | [[ | ||
1590 | #ifdef HAVE_SYS_TYPES_H | ||
1591 | #include <sys/types.h> | ||
1592 | #endif | ||
1593 | #ifdef HAVE_SYS_SOCKET_H | ||
1594 | #include <sys/socket.h> | ||
1595 | #endif | ||
1596 | #ifdef HAVE_SOCKLIB_H | ||
1597 | #include <sockLib.h> | ||
1598 | #endif | ||
1599 | #if defined(_WIN32) && ! defined(__CYGWIN__) | ||
1600 | #include <winsock2.h> | ||
1601 | #endif | ||
1602 | ]], | ||
1603 | [(void)socket(0, 0, 0);], | ||
1604 | [socket ws2_32], | ||
1605 | [ | ||
1606 | AS_VAR_IF([[mhd_cv_find_lib_socket]],[["none required"]], [], | ||
1607 | [ | ||
1608 | MHD_LIBDEPS_PKGCFG="${mhd_cv_find_lib_socket} $MHD_LIBDEPS_PKGCFG" | ||
1609 | ] | ||
1610 | ) | ||
1611 | ], | ||
1612 | [AC_MSG_ERROR([[cannot find header or library required for function socket()]])] | ||
1613 | ) | ||
1614 | |||
1589 | MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([AC_DEFINE([HAVE_LISTEN_SHUTDOWN],[1],[can use shutdown on listen sockets])]) | 1615 | MHD_CHECK_SOCKET_SHUTDOWN_TRIGGER([AC_DEFINE([HAVE_LISTEN_SHUTDOWN],[1],[can use shutdown on listen sockets])]) |
1590 | AM_CONDITIONAL([HAVE_LISTEN_SHUTDOWN], [test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"]) | 1616 | AM_CONDITIONAL([HAVE_LISTEN_SHUTDOWN], [test "x$mhd_cv_host_shtdwn_trgr_select" = "xyes"]) |
1591 | 1617 | ||
1592 | # SENDMSG. Should we check for SCM_RIGHTS instead? | ||
1593 | # https://lists.x.org/archives/xorg-devel/2013-November/038687.html | ||
1594 | AC_SEARCH_LIBS([sendmsg], [socket], [AC_DEFINE([HAVE_SENDMSG],[1],[Define if your platform supports sendmsg])]) | ||
1595 | MHD_CHECK_FUNC([writev], | 1618 | MHD_CHECK_FUNC([writev], |
1596 | [[#include <sys/uio.h>]], | 1619 | [[#include <sys/uio.h>]], |
1597 | [[ | 1620 | [[ |
@@ -1603,6 +1626,51 @@ MHD_CHECK_FUNC([writev], | |||
1603 | return 2; | 1626 | return 2; |
1604 | ]] | 1627 | ]] |
1605 | ) | 1628 | ) |
1629 | MHD_FIND_LIB([sendmsg], | ||
1630 | [[ | ||
1631 | #ifdef HAVE_SYS_TYPES_H | ||
1632 | #include <sys/types.h> | ||
1633 | #endif | ||
1634 | #ifdef HAVE_SYS_SOCKET_H | ||
1635 | #include <sys/socket.h> | ||
1636 | #endif | ||
1637 | #ifdef HAVE_SOCKLIB_H | ||
1638 | #include <sockLib.h> | ||
1639 | #endif | ||
1640 | #ifdef HAVE_SYS_UIO_H | ||
1641 | #include <sys/uio.h> | ||
1642 | #endif | ||
1643 | ]], | ||
1644 | [[ | ||
1645 | struct msghdr msg; | ||
1646 | struct iovec iov; | ||
1647 | unsigned int i; | ||
1648 | char some_str[5] = "test"; | ||
1649 | |||
1650 | iov.iov_base = (void*)some_str; | ||
1651 | iov.iov_len = 4; | ||
1652 | |||
1653 | for (i = 0; i < (unsigned int) sizeof(msg); i++) | ||
1654 | { | ||
1655 | *(((unsigned char *)&msg) + i) = 0; | ||
1656 | } | ||
1657 | msg.msg_iov = &iov; | ||
1658 | msg.msg_iovlen = 1; | ||
1659 | |||
1660 | if (0 > sendmsg(1, &msg, 0)) | ||
1661 | return -1; | ||
1662 | ]], | ||
1663 | [socket], | ||
1664 | [ | ||
1665 | AC_DEFINE([HAVE_SENDMSG],[1],[Define to '1' if your have sendmsg() function]) | ||
1666 | AS_VAR_IF([[mhd_cv_find_lib_sendmsg]],[["none required"]], [], | ||
1667 | [ | ||
1668 | MHD_LIBDEPS_PKGCFG="${mhd_cv_find_lib_sendmsg} $MHD_LIBDEPS_PKGCFG" | ||
1669 | ] | ||
1670 | ) | ||
1671 | ],[], | ||
1672 | [MHD_LIBDEPS] | ||
1673 | ) | ||
1606 | 1674 | ||
1607 | AC_C_BIGENDIAN | 1675 | AC_C_BIGENDIAN |
1608 | AC_C_VARARRAYS | 1676 | AC_C_VARARRAYS |
@@ -2446,23 +2514,23 @@ AC_CHECK_DECL([SOCK_NONBLOCK], [AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], [SOCK_NONBL | |||
2446 | ]] | 2514 | ]] |
2447 | ) | 2515 | ) |
2448 | 2516 | ||
2449 | 2517 | MHD_FIND_LIB([clock_gettime],[[#include <time.h>]], | |
2450 | AC_CHECK_DECL([[clock_gettime]], | 2518 | [[ |
2519 | struct timespec tp; | ||
2520 | if (0 > clock_gettime(CLOCK_REALTIME, &tp)) | ||
2521 | return 3; | ||
2522 | ]], | ||
2523 | [rt], | ||
2451 | [ | 2524 | [ |
2452 | SAVE_LIBS="$LIBS" | 2525 | AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Define to '1' if you have clock_gettime() function]) |
2453 | AC_SEARCH_LIBS([clock_gettime], [rt], | 2526 | AS_VAR_IF([[mhd_cv_find_lib_clock_gettime]],[["none required"]], [], |
2454 | [ | 2527 | [ |
2455 | AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime]) | 2528 | MHD_LIBDEPS_PKGCFG="${mhd_cv_find_lib_clock_gettime} $MHD_LIBDEPS_PKGCFG" |
2456 | AS_VAR_IF([[ac_cv_search_clock_gettime]],[["none required"]], [], | 2529 | ] |
2457 | [ | 2530 | ) |
2458 | MHD_LIBDEPS="$ac_cv_search_clock_gettime $MHD_LIBDEPS" | 2531 | ],[], |
2459 | MHD_LIBDEPS_PKGCFG="$ac_cv_search_clock_gettime $MHD_LIBDEPS_PKGCFG" | 2532 | [MHD_LIBDEPS] |
2460 | ]) | 2533 | ) |
2461 | ], [], [$MHD_LIBDEPS]) | ||
2462 | LIBS="$SAVE_LIBS" | ||
2463 | ], [], [[ | ||
2464 | #include <time.h> | ||
2465 | ]]) | ||
2466 | 2534 | ||
2467 | AC_MSG_CHECKING([[for clock_get_time]]) | 2535 | AC_MSG_CHECKING([[for clock_get_time]]) |
2468 | AC_LINK_IFELSE( | 2536 | AC_LINK_IFELSE( |