Annotation of embedaddon/ntp/sntp/configure.ac, revision 1.1.1.1

1.1       misho       1: #                                               -*- Autoconf -*-
                      2: # Process this file with autoconf to produce a configure script.
                      3: m4_include([../version.m4])
                      4: AC_PREREQ([2.61])
                      5: AC_INIT([sntp], [VERSION_NUMBER])
                      6: AC_CONFIG_MACRO_DIR([../m4])
                      7: AC_CONFIG_AUX_DIR([.])
                      8: 
                      9: # Increment sntp_configure_cache_version by one for each change to
                     10: # configure.ac or .m4 files which invalidates cached values from
                     11: # previous versions.
                     12: #
                     13: # If the change affects cache variables used only by the main NTP
                     14: # configure.ac, then only its version number should be bumped, while
                     15: # the subdir configure.ac version numbers should be unchanged.  The
                     16: # same is true for a test/variable that is used only by one subdir
                     17: # being changed incompatibly; only that subdir's cache version needs
                     18: # bumping.
                     19: #
                     20: # If a change affects variables shared by all NTP configure scripts,
                     21: # please bump the version numbers of all three.  If you are not sure,
                     22: # the safe choice is to bump all three on any cache-invalidating change.
                     23: #
                     24: # In order to avoid the risk of version stamp collision between -stable
                     25: # and -dev branches, do not simply increment the version, instead use
                     26: # the date YYYYMMDD optionally with -HHMM if there is more than one
                     27: # bump in a day.
                     28: 
                     29: sntp_configure_cache_version=20091117
                     30: 
                     31: # When the version of config.cache and configure do not
                     32: # match, NTP_CACHEVERSION will flush the cache.
                     33: 
                     34: NTP_CACHEVERSION([sntp], [$sntp_configure_cache_version])
                     35: 
                     36: AM_INIT_AUTOMAKE
                     37: AC_CANONICAL_BUILD
                     38: AC_CANONICAL_HOST
                     39: dnl the 'build' machine is where we run configure and compile
                     40: dnl the 'host' machine is where the resulting stuff runs.
                     41: AC_DEFINE_UNQUOTED([STR_SYSTEM], "$host", [canonical system (cpu-vendor-os) of where we should run])
                     42: AC_CONFIG_HEADER([config.h])
                     43: dnl AC_ARG_PROGRAM
                     44: 
                     45: # Checks for programs.
                     46: AM_PROG_CC_C_O
                     47: AC_PROG_CPP
                     48: 
                     49: # AC_PROG_CC_STDC has two functions.  It attempts to find a compiler
                     50: # capable of C99, or failing that, for C89.  CC is set afterward with
                     51: # the selected invocation, such as "gcc --std=gnu99".  Also, the
                     52: # ac_cv_prog_cc_stdc variable is no if the compiler selected for CC
                     53: # does not accept C89.
                     54: 
                     55: AC_PROG_CC_STDC
                     56: 
                     57: case "$ac_cv_prog_cc_stdc" in
                     58:  no)
                     59:     AC_MSG_WARN([ANSI C89/ISO C90 is the minimum to compile SNTP ]
                     60:                [version 4.2.5 and higher.])
                     61: esac
                     62: 
                     63: AC_CACHE_CHECK(
                     64:     [if $CC can handle @%:@warning],
                     65:     [ntp_cv_cpp_warning],
                     66:     [AC_COMPILE_IFELSE(
                     67:        [AC_LANG_PROGRAM([[]], [[#warning foo]])],
                     68:        [ntp_cv_cpp_warning=yes],
                     69:        [ntp_cv_cpp_warning=no]
                     70:     )]
                     71: )
                     72: case "$ntp_cv_cpp_warning" in
                     73:  no)
                     74:     AC_DEFINE([NO_OPTION_NAME_WARNINGS], [1],
                     75:        [Should we avoid @%:@warning on option name collisions?])
                     76: esac
                     77: 
                     78: case "$GCC" in
                     79:  yes)
                     80:     SAVED_CFLAGS_NTP="$CFLAGS"
                     81:     CFLAGS="$CFLAGS -Wstrict-overflow"
                     82:     AC_CACHE_CHECK(
                     83:        [if $CC can handle -Wstrict-overflow], 
                     84:        [ntp_cv_gcc_Wstrict_overflow], 
                     85:        [AC_COMPILE_IFELSE(
                     86:            [AC_LANG_PROGRAM([[]], [[]])],
                     87:            [ntp_cv_gcc_Wstrict_overflow=yes],
                     88:            [ntp_cv_gcc_Wstrict_overflow=no]
                     89:        )       ]
                     90:     )
                     91:     #
                     92:     # $ntp_cv_gcc_Wstrict_overflow is tested later to add the 
                     93:     # flag to CFLAGS.
                     94:     #
                     95:     CFLAGS="$SAVED_CFLAGS_NTP -Winit-self"
                     96:     AC_CACHE_CHECK(
                     97:        [if $CC can handle -Winit-self], 
                     98:        [ntp_cv_gcc_Winit_self],
                     99:        [
                    100:            AC_COMPILE_IFELSE(
                    101:                [AC_LANG_PROGRAM([[]], [[]])],
                    102:                [ntp_cv_gcc_Winit_self=yes],
                    103:                [ntp_cv_gcc_Winit_self=no]
                    104:            )
                    105:        ]
                    106:     )
                    107:     CFLAGS="$SAVED_CFLAGS_NTP"
                    108:     AS_UNSET([SAVED_CFLAGS_NTP])
                    109:     #
                    110:     # $ntp_cv_gcc_Winit_self is tested later to add the 
                    111:     # flag to CFLAGS.
                    112:     #
                    113: esac
                    114: 
                    115: # HMS: These need to be moved to AM_CPPFLAGS and/or AM_CFLAGS
                    116: case "$host" in
                    117:  *-*-solaris*)
                    118:     # see "man standards".
                    119:     # -D_XOPEN_SOURCE=500 is probably OK for c89 and before
                    120:     # -D_XOPEN_SOURCE=600 seems OK for c99
                    121:     #CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D__EXTENSIONS__"
                    122:     CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
                    123:     libxnet=-lxnet
                    124:     ;;
                    125: esac
                    126: 
                    127: AC_DISABLE_SHARED
                    128: 
                    129: # NTP has (so far) been relying on leading-edge autogen.
                    130: # Therefore, by default:
                    131: # - use the version we ship with
                    132: # - do not install it
                    133: # - build a static copy (AC_DISABLE_SHARED - done earlier)
                    134: case "${enable_local_libopts+set}" in
                    135:  set) ;;
                    136:  *) enable_local_libopts=yes ;;
                    137: esac
                    138: case "${enable_libopts_install+set}" in
                    139:  set) ;;
                    140:  *) enable_libopts_install=no ;;
                    141: esac
                    142: LIBOPTS_CHECK
                    143: 
                    144: AC_PROG_LIBTOOL
                    145: NTP_DIR_SEP
                    146: 
                    147: # Checks for libraries.
                    148: NTP_LIB_M
                    149: 
                    150: case "$GCC" in
                    151:  yes)
                    152:     CFLAGS="$CFLAGS -Wall"
                    153:     # CFLAGS="$CFLAGS -Wcast-align"
                    154:     CFLAGS="$CFLAGS -Wcast-qual"
                    155:     # CFLAGS="$CFLAGS -Wconversion"
                    156:     # CFLAGS="$CFLAGS -Werror"
                    157:     # CFLAGS="$CFLAGS -Wextra"
                    158:     # CFLAGS="$CFLAGS -Wfloat-equal"
                    159:     CFLAGS="$CFLAGS -Wmissing-prototypes"
                    160:     CFLAGS="$CFLAGS -Wpointer-arith"
                    161:     CFLAGS="$CFLAGS -Wshadow"
                    162:     # CFLAGS="$CFLAGS -Wtraditional"
                    163:     # CFLAGS="$CFLAGS -Wwrite-strings"
                    164:     case "$ntp_cv_gcc_Winit_self" in
                    165:      yes)
                    166:        CFLAGS="$CFLAGS -Winit-self"
                    167:     esac
                    168:     case "$ntp_cv_gcc_Wstrict_overflow" in
                    169:      yes)
                    170:        CFLAGS="$CFLAGS -Wstrict-overflow"
                    171:     esac
                    172:     # -W[no-]strict-prototypes is added later depending on OpenSSL
                    173: esac
                    174: 
                    175: AC_CHECK_FUNC([gethostent], ,
                    176:        [AC_SEARCH_LIBS([gethostent], [nsl], , , [$libxnet -lsocket])])
                    177: AC_CHECK_FUNC([openlog], , 
                    178:        [AC_SEARCH_LIBS([openlog], [gen], , 
                    179:                [AC_SEARCH_LIBS([openlog], [syslog], , , [$libxnet -lsocket])])])
                    180: 
                    181: AC_SEARCH_LIBS([setsockopt], [socket xnet])
                    182: 
                    183: # Checks for header files.
                    184: AC_HEADER_STDC
                    185: 
                    186: dnl  HP-UX 11.31 on HPPA has a net/if.h that can't be compiled with gcc4
                    187: dnl  due to an incomplete type (a union) mpinfou used in an array.  gcc3
                    188: dnl  compiles it without complaint.  The mpinfou union is defined later
                    189: dnl  in the resulting preprocessed source than the spu_info array in
                    190: dnl  /usr/include/machine/sys/getppdp.h:
                    191: dnl    extern union mpinfou spu_info[];
                    192: dnl  triggering the error.  Our strategy is on HP-UX only, test for
                    193: dnl  net/netmp.h, which is the file included by net/if.h that leads to
                    194: dnl  getppdp.h.  If it is present but can't be compiled, try adding
                    195: dnl  a duplicate definition of mpinfou, which should then allow the
                    196: dnl  following net/if.h and net/if6.h tests to proceed normally.
                    197: dnl  Using net/netmp.h allows us to avoid polluting test results for
                    198: dnl  net/if.h.
                    199: #
                    200: case "$host" in
                    201:  *-hp-hpux*)
                    202:     AC_CHECK_HEADERS(
                    203:        [net/netmp.h],
                    204:        [netmp_h_works=yes],
                    205:        [netmp_h_works=no]
                    206:     )
                    207:     case "$netmp_h_works" in
                    208:      no)
                    209:        cat >>confdefs.h <<_ACEOF
                    210: #ifndef MPINFOU_PREDECLARED
                    211: # define MPINFOU_PREDECLARED
                    212: typedef union mpinfou {                /* For lint */
                    213:        struct pdk_mpinfo *pdkptr;
                    214:        struct mpinfo *pikptr;
                    215: } mpinfou_t;
                    216: #endif
                    217: _ACEOF
                    218:        AH_BOTTOM([
                    219: #ifndef MPINFOU_PREDECLARED
                    220: # define MPINFOU_PREDECLARED
                    221: typedef union mpinfou {                /* For lint */
                    222:        struct pdk_mpinfo *pdkptr;
                    223:        struct mpinfo *pikptr;
                    224: } mpinfou_t;
                    225: #endif
                    226: ])
                    227:        ;;
                    228:     esac
                    229:     ;;
                    230: esac
                    231: 
                    232: AC_CHECK_HEADERS([netdb.h netinet/in.h stdlib.h string.h strings.h syslog.h])
                    233: AC_CHECK_HEADERS([sys/socket.h sys/time.h])
                    234: AC_HEADER_TIME
                    235: 
                    236: # Checks for typedefs, structures, and compiler characteristics.
                    237: AC_HEADER_STDBOOL
                    238: AC_C_CONST
                    239: AC_TYPE_SIZE_T
                    240: AC_CHECK_SIZEOF([time_t])
                    241: 
                    242: AC_C_INLINE
                    243: 
                    244: case "$ac_cv_c_inline" in
                    245:  '')
                    246:     ;;
                    247:  *)
                    248:     AC_DEFINE(HAVE_INLINE,1,[inline keyword or macro available])
                    249:     AC_SUBST(HAVE_INLINE)
                    250: esac
                    251: 
                    252: AC_C_CHAR_UNSIGNED             dnl CROSS_COMPILE?
                    253: AC_CHECK_SIZEOF([signed char])
                    254: AC_CHECK_SIZEOF([int])
                    255: AC_CHECK_SIZEOF([long])
                    256: 
                    257: AC_CHECK_TYPES([s_char])
                    258: case "$ac_cv_c_char_unsigned$ac_cv_sizeof_signed_char$ac_cv_type_s_char" in
                    259:  *yes)
                    260:     # We have a typedef for s_char.  Might as well believe it...
                    261:     ;;
                    262:  no0no)
                    263:     # We have signed chars, can't say 'signed char', no s_char typedef.
                    264:     AC_DEFINE([NEED_S_CHAR_TYPEDEF], 1, [Do we need an s_char typedef?])
                    265:     ;;
                    266:  no1no)
                    267:     # We have signed chars, can say 'signed char', no s_char typedef.
                    268:     AC_DEFINE([NEED_S_CHAR_TYPEDEF])
                    269:     ;;
                    270:  yes0no)
                    271:     # We have unsigned chars, can't say 'signed char', no s_char typedef.
                    272:     AC_MSG_ERROR([No way to specify a signed character!])
                    273:     ;;
                    274:  yes1no)
                    275:     # We have unsigned chars, can say 'signed char', no s_char typedef.
                    276:     AC_DEFINE([NEED_S_CHAR_TYPEDEF])
                    277:     ;;
                    278: esac
                    279: AC_TYPE_UID_T
                    280: 
                    281: NTP_OPENSSL
                    282: 
                    283: AC_CACHE_CHECK(
                    284:     [type of socklen arg for getsockname()],
                    285:     [ntp_cv_getsockname_socklen_type],
                    286:     [
                    287:     getsockname_socklen_type_found=no
                    288:     for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
                    289:        for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
                    290:            AC_COMPILE_IFELSE(
                    291:                [AC_LANG_PROGRAM(
                    292:                    [[
                    293:                        #ifdef HAVE_SYS_TYPES_H
                    294:                        # include <sys/types.h>
                    295:                        #endif
                    296:                        #ifdef HAVE_SYS_SOCKET_H
                    297:                        # include <sys/socket.h>
                    298:                        #endif
                    299:                    ]], [[
                    300:                        extern
                    301:                        getsockname(int, $getsockname_arg2, 
                    302:                                $ntp_cv_getsockname_socklen_type *);
                    303:                    ]]
                    304:                )],
                    305:                [getsockname_socklen_type_found=yes ; break 2],
                    306:                []
                    307:            )
                    308:        done
                    309:     done
                    310:     case "$getsockname_socklen_type_found" in
                    311:      no)
                    312:        ntp_cv_getsockname_socklen_type='socklen_t'
                    313:     esac
                    314:     AS_UNSET([getsockname_arg2])
                    315:     AS_UNSET([getsockname_socklen_type_found])
                    316:     ]
                    317: )
                    318: AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
                    319:                   $ntp_cv_getsockname_socklen_type,
                    320:                   [What is getsockname()'s socklen type?])
                    321: 
                    322: AC_CACHE_CHECK(
                    323:     [for struct sockaddr_storage],
                    324:     [ntp_cv_sockaddr_storage],
                    325:     [AC_COMPILE_IFELSE(
                    326:        [AC_LANG_PROGRAM(
                    327:            [[
                    328:                #ifdef HAVE_SYS_TYPES_H
                    329:                # include <sys/types.h>
                    330:                #endif
                    331:                #ifdef HAVE_SYS_SOCKET_H
                    332:                # include <sys/socket.h>
                    333:                #endif
                    334:                #ifdef HAVE_NETINET_IN_H
                    335:                # include <netinet/in.h>
                    336:                #endif
                    337:            ]],
                    338:            [[
                    339:                struct sockaddr_storage n;
                    340:            ]]
                    341:        )],
                    342:        [ntp_cv_sockaddr_storage=yes],
                    343:        [ntp_cv_sockaddr_storage=no]
                    344:     )]
                    345: )
                    346: case "$ntp_cv_sockaddr_storage" in
                    347:  yes)
                    348:     AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
                    349:        [Does a system header define struct sockaddr_storage?])
                    350: esac
                    351: 
                    352: AC_CACHE_CHECK(
                    353:     [for sockaddr_storage.ss_family],
                    354:     [ntp_cv_have_ss_family],
                    355:     [AC_COMPILE_IFELSE(
                    356:        [AC_LANG_PROGRAM(
                    357:            [[
                    358:                #ifdef HAVE_SYS_TYPES_H
                    359:                # include <sys/types.h>
                    360:                #endif
                    361:                #ifdef HAVE_SYS_SOCKET_H
                    362:                # include <sys/socket.h>
                    363:                #endif
                    364:                #ifdef HAVE_NETINET_IN_H
                    365:                # include <netinet/in.h>
                    366:                #endif
                    367:            ]],
                    368:            [[
                    369:                struct sockaddr_storage s;
                    370:                s.ss_family = 1;
                    371:            ]]
                    372:        )],
                    373:        [ntp_cv_have_ss_family=yes],
                    374:        [ntp_cv_have_ss_family=no]
                    375:     )]
                    376: )
                    377: 
                    378: case "$ntp_cv_have_ss_family" in
                    379:  no)
                    380:     AC_CACHE_CHECK(
                    381:        [for sockaddr_storage.__ss_family],
                    382:        [ntp_cv_have___ss_family],
                    383:        [AC_COMPILE_IFELSE(
                    384:            [AC_LANG_PROGRAM(
                    385:                [[
                    386:                    #ifdef HAVE_SYS_TYPES_H
                    387:                    # include <sys/types.h>
                    388:                    #endif
                    389:                    #ifdef HAVE_SYS_SOCKET_H
                    390:                    # include <sys/socket.h>
                    391:                    #endif
                    392:                    #ifdef HAVE_NETINET_IN_H
                    393:                    # include <netinet/in.h>
                    394:                    #endif
                    395:                ]],
                    396:                [[
                    397:                    struct sockaddr_storage s;
                    398:                    s.__ss_family = 1;
                    399:                ]]
                    400:            )],
                    401:            [ntp_cv_have___ss_family=yes],
                    402:            [ntp_cv_have___ss_family=no]
                    403:        )]
                    404:     )
                    405:     case "$ntp_cv_have___ss_family" in
                    406:      yes)
                    407:        AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
                    408:            [Does struct sockaddr_storage have __ss_family?])
                    409:     esac
                    410: esac
                    411: 
                    412: AH_VERBATIM(
                    413:     [HAVE___SS_FAMILY_IN_SS_VERBATIM],
                    414:     [
                    415:        /* Handle sockaddr_storage.__ss_family */
                    416:        #ifdef HAVE___SS_FAMILY_IN_SS
                    417:        # define ss_family __ss_family
                    418:        #endif /* HAVE___SS_FAMILY_IN_SS */
                    419:     ]
                    420: )
                    421: 
                    422: AC_CACHE_CHECK(
                    423:     [for sockaddr_storage.ss_len],
                    424:     [ntp_cv_have_ss_len],
                    425:     [AC_COMPILE_IFELSE(
                    426:        [AC_LANG_PROGRAM(
                    427:            [[
                    428:                #ifdef HAVE_SYS_TYPES_H
                    429:                # include <sys/types.h>
                    430:                #endif
                    431:                #ifdef HAVE_SYS_SOCKET_H
                    432:                # include <sys/socket.h>
                    433:                #endif
                    434:                #ifdef HAVE_NETINET_IN_H
                    435:                # include <netinet/in.h>
                    436:                #endif
                    437:            ]],
                    438:            [[
                    439:                struct sockaddr_storage s;
                    440:                s.ss_len = 1;
                    441:            ]]
                    442:        )],
                    443:        [ntp_cv_have_ss_len=yes],
                    444:        [ntp_cv_have_ss_len=no]
                    445:     )]
                    446: )
                    447: 
                    448: case "$ntp_cv_have_ss_len" in
                    449:  no)
                    450:     AC_CACHE_CHECK(
                    451:        [for sockaddr_storage.__ss_len],
                    452:        [ntp_cv_have___ss_len],
                    453:        [AC_COMPILE_IFELSE(
                    454:            [AC_LANG_PROGRAM(
                    455:                [[
                    456:                    #ifdef HAVE_SYS_TYPES_H
                    457:                    # include <sys/types.h>
                    458:                    #endif
                    459:                    #ifdef HAVE_SYS_SOCKET_H
                    460:                    # include <sys/socket.h>
                    461:                    #endif
                    462:                    #ifdef HAVE_NETINET_IN_H
                    463:                    # include <netinet/in.h>
                    464:                    #endif
                    465:                ]],
                    466:                [[
                    467:                    struct sockaddr_storage s;
                    468:                    s.__ss_len = 1;
                    469:                ]]
                    470:            )],
                    471:            [ntp_cv_have___ss_len=yes],
                    472:            [ntp_cv_have___ss_len=no]
                    473:        )]
                    474:     )
                    475:     case "$ntp_cv_have___ss_len" in
                    476:      yes)
                    477:        AC_DEFINE([HAVE___SS_LEN_IN_SS], [1],
                    478:            [Does struct sockaddr_storage have __ss_len?])
                    479:     esac
                    480: esac
                    481: 
                    482: AH_VERBATIM(
                    483:     [HAVE___SS_LEN_IN_SS_VERBATIM],
                    484:     [
                    485:        /* Handle sockaddr_storage.__ss_len */
                    486:        #ifdef HAVE___SS_LEN_IN_SS
                    487:        # define ss_len __ss_len
                    488:        #endif /* HAVE___SS_LEN_IN_SS */
                    489:     ]
                    490: )
                    491: 
                    492: #
                    493: # Look for in_port_t.
                    494: #
                    495: AC_CACHE_CHECK(
                    496:     [for in_port_t],
                    497:     [isc_cv_have_in_port_t],
                    498:     [AC_COMPILE_IFELSE(
                    499:        [AC_LANG_PROGRAM(
                    500:            [[
                    501:                #include <sys/types.h>
                    502:                #include <netinet/in.h>
                    503:            ]],
                    504:            [[
                    505:                in_port_t port = 25; 
                    506:                return (0);
                    507:            ]]
                    508:        )],
                    509:        [isc_cv_have_in_port_t=yes],
                    510:        [isc_cv_have_in_port_t=no]
                    511:     )]
                    512: )
                    513: case "$isc_cv_have_in_port_t" in
                    514:  no)
                    515:        AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
                    516:            [Declare in_port_t?])
                    517: esac
                    518: 
                    519: AC_CACHE_CHECK(
                    520:     [for multicast IP support],
                    521:     [ntp_cv_multicast],
                    522:     [
                    523:        ntp_cv_multicast=no
                    524:        case "$host" in
                    525:         i386-sequent-sysv4)
                    526:            ;;
                    527:         *)
                    528:            AC_COMPILE_IFELSE(
                    529:                [AC_LANG_PROGRAM(
                    530:                    [[
                    531:                        #ifdef HAVE_NETINET_IN_H
                    532:                        #include <netinet/in.h>
                    533:                        #endif
                    534:                    ]],
                    535:                    [[
                    536:                        struct ip_mreq ipmr;
                    537:                        ipmr.imr_interface.s_addr = 0;
                    538:                    ]]
                    539:                )],
                    540:                [ntp_cv_multicast=yes],
                    541:                []
                    542:            )
                    543:        esac
                    544:     ]
                    545: )
                    546: case "$ntp_cv_multicast" in
                    547:  yes)
                    548:     AC_DEFINE([MCAST], [1], [Does the target support multicast IP?])
                    549:     AC_CACHE_CHECK(
                    550:        [arg type needed for setsockopt() IP*_MULTICAST_LOOP],
                    551:        [ntp_cv_typeof_ip_multicast_loop],
                    552:        [
                    553:            case "$host" in
                    554:             *-*-netbsd*|*-*-*linux*)
                    555:                ntp_cv_typeof_ip_multicast_loop=u_int
                    556:                ;;
                    557:             *)
                    558:                ntp_cv_typeof_ip_multicast_loop=u_char
                    559:            esac
                    560:        ]
                    561:     )
                    562:     AC_DEFINE_UNQUOTED([TYPEOF_IP_MULTICAST_LOOP],
                    563:        $ntp_cv_typeof_ip_multicast_loop,
                    564:        [What type to use for setsockopt])
                    565: esac
                    566: 
                    567: # HMS: We don't need res_init, but since we may be using cached 
                    568: # values from ntpd we need to test the same way 
                    569: AC_SEARCH_LIBS([res_init], [resolv], , , [-lsocket -lnsl]) 
                    570: AC_SEARCH_LIBS([inet_ntop], [resolv], , , [-lsocket -lnsl])
                    571: AC_CHECK_FUNC([inet_ntop], [], 
                    572:     [AC_DEFINE([ISC_PLATFORM_NEEDNTOP], [1], [ISC: provide inet_ntop()])])
                    573: AC_CHECK_FUNC([inet_pton], [],
                    574:     [AC_DEFINE([ISC_PLATFORM_NEEDPTON], [1], [ISC: provide inet_pton()])])
                    575: 
                    576: AC_CACHE_CHECK(
                    577:     [struct sockaddr for sa_len],
                    578:     [isc_cv_platform_havesalen],
                    579:     [AC_COMPILE_IFELSE(
                    580:        [AC_LANG_PROGRAM(
                    581:            [[
                    582:                #include <sys/types.h>
                    583:                #include <sys/socket.h>
                    584:            ]],
                    585:            [[
                    586:                extern struct sockaddr *ps;
                    587:                return ps->sa_len;
                    588:            ]]
                    589:        )],
                    590:        [isc_cv_platform_havesalen=yes],
                    591:        [isc_cv_platform_havesalen=no]
                    592:     )]
                    593: )
                    594: case "$isc_cv_platform_havesalen" in
                    595:  yes)
                    596:     AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
                    597:         [struct sockaddr has sa_len?])
                    598: esac
                    599: 
                    600: AC_ARG_ENABLE(
                    601:     [ipv6],
                    602:     [AS_HELP_STRING(
                    603:        [--enable-ipv6],
                    604:        [s use IPv6?]
                    605:     )]
                    606: )
                    607: 
                    608: case "$enable_ipv6" in
                    609:  yes|''|autodetect)
                    610:     case "$host" in
                    611:      powerpc-ibm-aix4*)
                    612:        ;;
                    613:      *)
                    614:        AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
                    615:        ;;
                    616:     esac
                    617:     ;;
                    618:  no)
                    619:     ;;
                    620: esac
                    621: 
                    622: 
                    623: dnl [Bug 1984] ntp/libisc fails to compile on OS X 10.7 (Lion)
                    624: case "$host" in
                    625:  *-*-darwin*)
                    626:     AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Are we _special_?])
                    627: esac
                    628: 
                    629: 
                    630: AC_CACHE_CHECK(
                    631:     [for IPv6 structures],
                    632:     [isc_cv_found_ipv6],
                    633:     [AC_COMPILE_IFELSE(
                    634:        [AC_LANG_PROGRAM(
                    635:            [[
                    636:                #include <sys/types.h>
                    637:                #include <sys/socket.h>
                    638:                #include <netinet/in.h>
                    639:            ]],
                    640:            [[
                    641:                struct sockaddr_in6 sin6;
                    642:            ]]
                    643:        )],
                    644:        [isc_cv_found_ipv6=yes],
                    645:        [isc_cv_found_ipv6=no]
                    646:     )]
                    647: )
                    648: 
                    649: #
                    650: # See whether IPv6 support is provided via a Kame add-on.
                    651: # This is done before other IPv6 linking tests so LIBS is properly set.
                    652: #
                    653: AC_MSG_CHECKING([for Kame IPv6 support])
                    654: AC_ARG_WITH(
                    655:     [kame],
                    656:     [AS_HELP_STRING(
                    657:        [--with-kame],
                    658:        [- =/usr/local/v6]
                    659:     )],
                    660:     [use_kame="$withval"],
                    661:     [use_kame="no"]
                    662: )
                    663: case "$use_kame" in
                    664:  no)
                    665:     ;;
                    666:  yes)
                    667:     kame_path=/usr/local/v6
                    668:     ;;
                    669:  *)
                    670:     kame_path="$use_kame"
                    671:     ;;
                    672: esac
                    673: case "$use_kame" in
                    674:  no)
                    675:     AC_MSG_RESULT([no])
                    676:     ;;
                    677:  *)
                    678:     if test -f $kame_path/lib/libinet6.a; then
                    679:        AC_MSG_RESULT([$kame_path/lib/libinet6.a])
                    680:        LIBS="-L$kame_path/lib -linet6 $LIBS"
                    681:     else
                    682:        AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
                    683: 
                    684: Please choose the proper path with the following command:
                    685: 
                    686:     configure --with-kame=PATH
                    687: ])
                    688:     fi
                    689:     ;;
                    690: esac
                    691: 
                    692: #
                    693: # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
                    694: # Including it on Kame-using platforms is very bad, though, because
                    695: # Kame uses #error against direct inclusion.   So include it on only
                    696: # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
                    697: # This is done before the in6_pktinfo check because that's what
                    698: # netinet6/in6.h is needed for.
                    699: #
                    700: case "$host" in
                    701:  *-bsdi4.[[01]]*)
                    702:     AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
                    703:        [Do we need netinet6/in6.h?])
                    704:     isc_netinet6in6_hack="#include <netinet6/in6.h>"
                    705:     ;;
                    706:  *)
                    707:     isc_netinet6in6_hack=""
                    708:     ;;
                    709: esac
                    710: 
                    711: #
                    712: # This is similar to the netinet6/in6.h issue.
                    713: #
                    714: case "$host" in
                    715:  *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
                    716:     AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
                    717:        [Do we need to fix in6isaddr?])
                    718:     isc_netinetin6_hack="#include <netinet/in6.h>"
                    719:     ;;
                    720:  *)
                    721:     isc_netinetin6_hack=""
                    722:     ;;
                    723: esac
                    724: 
                    725: 
                    726: case "$isc_cv_found_ipv6" in
                    727:  yes)
                    728:     AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
                    729:     AC_CACHE_CHECK(
                    730:        [for in6_pktinfo],
                    731:        [isc_cv_have_in6_pktinfo],
                    732:        [AC_COMPILE_IFELSE(
                    733:            [AC_LANG_PROGRAM(
                    734:                [[
                    735:                    #include <sys/types.h>
                    736:                    #include <sys/socket.h>
                    737:                    #include <netinet/in.h>
                    738:                    $isc_netinetin6_hack
                    739:                    $isc_netinet6in6_hack
                    740:                ]],
                    741:                [[
                    742:                    struct in6_pktinfo xyzzy;
                    743:                ]]
                    744:            )],
                    745:            [isc_cv_have_in6_pktinfo=yes],
                    746:            [isc_cv_have_in6_pktinfo=no]
                    747:        )]
                    748:     )
                    749:     case "$isc_cv_have_in6_pktinfo" in
                    750:      yes)
                    751:        AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
                    752:                [have struct in6_pktinfo?])
                    753:     esac
                    754: 
                    755: 
                    756:     # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
                    757:     AC_CACHE_CHECK(
                    758:        [for sockaddr_in6.sin6_scope_id],
                    759:        [isc_cv_have_sin6_scope_id],
                    760:        [AC_COMPILE_IFELSE(
                    761:            [AC_LANG_PROGRAM(
                    762:                [[
                    763:                    #include <sys/types.h>
                    764:                    #include <sys/socket.h>
                    765:                    #include <netinet/in.h>
                    766:                    $isc_netinetin6_hack
                    767:                    $isc_netinet6in6_hack
                    768:                ]],
                    769:                [[
                    770:                    struct sockaddr_in6 xyzzy;
                    771:                    xyzzy.sin6_scope_id = 0;
                    772:                ]]
                    773:            )],
                    774:            [isc_cv_have_sin6_scope_id=yes],
                    775:            [isc_cv_have_sin6_scope_id=no]
                    776:        )]
                    777:     )
                    778: 
                    779:     case "$isc_cv_have_sin6_scope_id" in
                    780:      yes)
                    781:        AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
                    782:     esac
                    783: esac
                    784: 
                    785: 
                    786: # We need this check run even without isc_cv_found_ipv6=yes
                    787: 
                    788: AC_CACHE_CHECK(
                    789:     [for in6addr_any],
                    790:     [isc_cv_have_in6addr_any],
                    791:     [AC_LINK_IFELSE(
                    792:        [AC_LANG_PROGRAM(
                    793:            [[
                    794:                #include <sys/types.h>
                    795:                #include <sys/socket.h>
                    796:                #include <netinet/in.h>
                    797:                $isc_netinetin6_hack
                    798:                $isc_netinet6in6_hack
                    799:            ]],
                    800:            [[
                    801:                struct in6_addr in6; 
                    802:                in6 = in6addr_any;
                    803:            ]]
                    804:        )],
                    805:        [isc_cv_have_in6addr_any=yes],
                    806:        [isc_cv_have_in6addr_any=no]
                    807:     )]
                    808: )
                    809: 
                    810: case "$isc_cv_have_in6addr_any" in
                    811:  no)
                    812:     AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
                    813: esac
                    814: 
                    815: 
                    816: AC_CACHE_CHECK(
                    817:     [for struct if_laddrconf],
                    818:     [isc_cv_struct_if_laddrconf],
                    819:     [AC_COMPILE_IFELSE(
                    820:        [AC_LANG_PROGRAM(
                    821:            [[
                    822:                #include <sys/types.h>
                    823:                #include <net/if6.h>
                    824:            ]],
                    825:            [[
                    826:                struct if_laddrconf a;
                    827:            ]]
                    828:        )],
                    829:        [isc_cv_struct_if_laddrconf=yes],
                    830:        [isc_cv_struct_if_laddrconf=no]
                    831:     )]
                    832: )
                    833: 
                    834: case "$isc_cv_struct_if_laddrconf" in
                    835:  yes)
                    836:     AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
                    837:        [have struct if_laddrconf?])
                    838: esac
                    839: 
                    840: AC_CACHE_CHECK(
                    841:     [for struct if_laddrreq],
                    842:     isc_cv_struct_if_laddrreq,
                    843:     [AC_COMPILE_IFELSE(
                    844:        [AC_LANG_PROGRAM(
                    845:            [[
                    846:                #include <sys/types.h>
                    847:                #include <net/if6.h>
                    848:            ]],
                    849:            [[
                    850:                struct if_laddrreq a;
                    851:            ]]
                    852:        )],
                    853:        [isc_cv_struct_if_laddrreq=yes],
                    854:        [isc_cv_struct_if_laddrreq=no]
                    855:     )]
                    856: )
                    857: 
                    858: case "$isc_cv_struct_if_laddrreq" in
                    859:  yes)
                    860:     AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
                    861:        [have struct if_laddrreq?])
                    862: esac
                    863: 
                    864: 
                    865: ###
                    866: 
                    867: # Hacks
                    868: # these need work if we're to move libntp under sntp
                    869: AC_DEFINE([HAVE_NO_NICE], 1, [sntp does not care about 'nice'])
                    870: AC_DEFINE([HAVE_TERMIOS], 1, [sntp does not care about TTY stuff])
                    871: 
                    872: # Checks for library functions.
                    873: AC_CHECK_FUNCS([socket vsnprintf vsprintf])
                    874: 
                    875: AC_MSG_CHECKING([for bin subdirectory])
                    876: AC_ARG_WITH(
                    877:     [binsubdir],
                    878:     [AS_HELP_STRING(
                    879:        [--with-binsubdir],
                    880:        [bin ={bin,sbin}]
                    881:     )],
                    882:     [use_binsubdir="$withval"],
                    883:     [use_binsubdir="bin"]
                    884: )
                    885: case "$use_binsubdir" in
                    886:  bin)
                    887:     ;;
                    888:  sbin)
                    889:     ;;
                    890:  *)
                    891:     AC_MSG_ERROR([<$use_binsubdir> is illegal - must be "bin" or "sbin"])
                    892:     ;;
                    893: esac
                    894: AC_MSG_RESULT([$use_binsubdir])
                    895: 
                    896: BINSUBDIR=$use_binsubdir
                    897: AC_SUBST([BINSUBDIR])
                    898: AM_CONDITIONAL([NTP_BINSUBDIR_IS_BIN], [test "bin" = "$BINSUBDIR"])
                    899: 
                    900: AC_CONFIG_FILES([Makefile])
                    901: AC_OUTPUT

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>