@@ -103,8 +103,6 @@ AC_TYPE_UINT8_T
103103AC_CHECK_TYPES ( [ struct termios] , [ ] , [ ] , [ #include <termios.h>] )
104104
105105# Checks for library functions.
106- AC_FUNC_MALLOC
107- AC_FUNC_REALLOC
108106AC_CHECK_FUNCS ( [ \
109107access \
110108atoi \
@@ -125,15 +123,13 @@ fputs \
125123fread \
126124free \
127125freeaddrinfo \
128- freeifaddrs \
129126freopen \
130127fwrite \
131128gai_strerror \
132129getaddrinfo \
133130getchar \
134131getenv \
135132geteuid \
136- getifaddrs \
137133getopt_long \
138134htons \
139135index \
@@ -498,6 +494,44 @@ AC_ARG_WITH([resolvconf-config-file],
498494 AC_DEFINE_UNQUOTED ( [ RESOLV_CONF_FILE_PATH] ,[ "$withval"] )
499495)
500496
497+ AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [
498+ #include <sys/types.h>
499+ #if STDC_HEADERS
500+ #include <stdlib.h>
501+ #include <stddef.h>
502+ #endif
503+ #include <sys/socket.h>
504+ #include <netinet/in.h>
505+ #include <arpa/inet.h>
506+ #include <ifaddrs.h>
507+ #include <netdb.h>
508+ int main(int argc, char **argv){
509+ struct ifaddrs *ifp = NULL;
510+ int ret = getifaddrs (&ifp);
511+ freeifaddrs(ifp);
512+ }
513+ ] ) ] , [
514+ libreplace_required=no
515+ AC_MSG_NOTICE ( [ HAVE_IFADDRS... 1] )
516+ ] ,[
517+ libreplace_required=yes
518+ AC_MSG_NOTICE ( [ HAVE_IFADDRS... 0] )
519+ ] )
520+
521+ AC_ARG_ENABLE ( [ libreplace] ,
522+ [ AS_HELP_STRING ( [ --enable-libreplace] , [ Force to use libreplace ifaddrs implementation] ) ] ,
523+ [ enable_libreplace=yes] ,
524+ [ enable_libreplace=no] )
525+ AS_CASE ( [ "$enable_libreplace"] ,
526+ [ yes] , [
527+ AC_MSG_NOTICE ( [ Force using libreplace...] )
528+ ] ,
529+ [ no] , [
530+ ] ,
531+ [ AC_MSG_ERROR ( [ unknown option '$enable_libreplace' for --enable-libreplace] ) ] )
532+ AS_IF ( [ test "x$enable_libreplace" != "xno" -o "x$libreplace_required" != "xno"] , [ AC_DEFINE ( [ HAVE_IFADDRS] ,[ 0] ) ] , [ AC_DEFINE ( [ HAVE_IFADDRS] ,[ 1] ) ] )
533+ AM_CONDITIONAL([ LIBREPLACE_REQUIRED] , [ test "x$enable_libreplace" = "xyes" -o "x$libreplace_required" = "xyes"] )
534+
501535# prepare to get rid of obsolete code (FortiOS 4)
502536AC_ARG_ENABLE ( [ obsolete] ,
503537 [ AS_HELP_STRING ( [ --disable-obsolete] , [ disable support for FortiOS 4] ) ] ,,
0 commit comments