@@ -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 \
@@ -502,6 +498,44 @@ AC_ARG_WITH([resolvconf-config-file],
502498 AC_DEFINE_UNQUOTED ( [ RESOLV_CONF_FILE_PATH] ,[ "$withval"] )
503499)
504500
501+ AC_COMPILE_IFELSE ( [ AC_LANG_SOURCE ( [
502+ #include <sys/types.h>
503+ #if STDC_HEADERS
504+ #include <stdlib.h>
505+ #include <stddef.h>
506+ #endif
507+ #include <sys/socket.h>
508+ #include <netinet/in.h>
509+ #include <arpa/inet.h>
510+ #include <ifaddrs.h>
511+ #include <netdb.h>
512+ int main(int argc, char **argv){
513+ struct ifaddrs *ifp = NULL;
514+ int ret = getifaddrs (&ifp);
515+ freeifaddrs(ifp);
516+ }
517+ ] ) ] , [
518+ libreplace_required=no
519+ AC_MSG_NOTICE ( [ HAVE_IFADDRS... 1] )
520+ ] ,[
521+ libreplace_required=yes
522+ AC_MSG_NOTICE ( [ HAVE_IFADDRS... 0] )
523+ ] )
524+
525+ AC_ARG_ENABLE ( [ libreplace] ,
526+ [ AS_HELP_STRING ( [ --enable-libreplace] , [ Force to use libreplace ifaddrs implementation] ) ] ,
527+ [ enable_libreplace=yes] ,
528+ [ enable_libreplace=no] )
529+ AS_CASE ( [ "$enable_libreplace"] ,
530+ [ yes] , [
531+ AC_MSG_NOTICE ( [ Force using libreplace...] )
532+ ] ,
533+ [ no] , [
534+ ] ,
535+ [ AC_MSG_ERROR ( [ unknown option '$enable_libreplace' for --enable-libreplace] ) ] )
536+ AS_IF ( [ test "x$enable_libreplace" != "xno" -o "x$libreplace_required" != "xno"] , [ AC_DEFINE ( [ HAVE_IFADDRS] ,[ 0] ) ] , [ AC_DEFINE ( [ HAVE_IFADDRS] ,[ 1] ) ] )
537+ AM_CONDITIONAL([ LIBREPLACE_REQUIRED] , [ test "x$enable_libreplace" = "xyes" -o "x$libreplace_required" = "xyes"] )
538+
505539# prepare to get rid of obsolete code (FortiOS 4)
506540AC_ARG_ENABLE ( [ obsolete] ,
507541 [ AS_HELP_STRING ( [ --disable-obsolete] , [ disable support for FortiOS 4] ) ] ,,
0 commit comments