Annotation of nono/configure.ac, revision 1.1.1.14

1.1       root        1: #
                      2: # nono
1.1.1.3   root        3: # Copyright (C) 2020 nono project
                      4: # Licensed under nono-license.txt
1.1       root        5: #
                      6: 
1.1.1.10  root        7: AC_PREREQ([2.71])
                      8: AC_INIT([nono],[0.0],[])
1.1       root        9: AC_CONFIG_SRCDIR(wx/wxapp.cpp)
1.1.1.6   root       10: AC_CONFIG_AUX_DIR([scripts])
1.1       root       11: 
                     12: # Checks for programs.
                     13: AC_PROG_CXX
                     14: AC_PROG_CC
1.1.1.3   root       15: AC_PROG_INSTALL
1.1       root       16: 
1.1.1.6   root       17: # OS
                     18: AC_CANONICAL_HOST
                     19: AC_SUBST([host_cpu])
                     20: 
1.1.1.4   root       21: # コンパイラをチェック。今のところ clang/gcc のみ。
                     22: # (autoconf がやってる gcc かどうかのチェックは clang を検出できず使えない)
                     23: AC_MSG_CHECKING(for compiler)
                     24: if test -n "`${CC} -v 2>&1 | grep clang`" ; then
                     25:        AC_MSG_RESULT([clang])
                     26:        COMPILER=CLANG
                     27: elif test -n "`${CC} -v 2>&1 | grep GCC`"; then
                     28:        AC_MSG_RESULT([gcc])
                     29:        COMPILER=GCC
                     30: else
                     31:        AC_MSG_RESULT([unknown])
                     32:        COMPILER=
                     33: fi
                     34: AC_SUBST([COMPILER])
                     35: 
1.1.1.3   root       36: # C++ のバージョンをチェック
                     37: CXX_STD=-std=c++14
                     38: AC_LANG_PUSH([C++])
                     39: AC_MSG_CHECKING(for ${CXX_STD})
1.1       root       40: old_CXXFLAGS="${CXXFLAGS}"
1.1.1.3   root       41: CXXFLAGS="${CXX_STD} ${CXXFLAGS}"
1.1       root       42: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
1.1.1.3   root       43:        AC_MSG_RESULT([yes]),
                     44:        AC_MSG_ERROR("*** C++ compiler '${CXX}' doesn't support ${CXX_STD}."))
1.1       root       45: CXXFLAGS="${old_CXXFLAGS}"
1.1.1.3   root       46: CXX="${CXX} ${CXX_STD}"
                     47: AC_LANG_POP([C++])
                     48: 
                     49: # C コンパイラのワーニングオプション
                     50: AC_LANG_PUSH([C])
1.1.1.4   root       51: AC_DEFUN([ADD_CC_WARN_IF],[
1.1.1.3   root       52:        AC_MSG_CHECKING([whether cc accepts $1])
                     53:        old_CFLAGS="${CFLAGS}"
                     54:        CFLAGS="${CFLAGS} -Werror $1"
                     55:        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
                     56:                AC_MSG_RESULT([yes])
1.1.1.11  root       57:                eval `echo cc_has$1=yes | sed -e 's/-/_/g'`
1.1.1.3   root       58:                WARNFLAGS_C="${WARNFLAGS_C} $1",
                     59:                AC_MSG_RESULT([no]))
                     60:        CFLAGS="${old_CFLAGS}"
                     61: ])
1.1.1.4   root       62: ADD_CC_WARN_IF(-Wcast-qual)
                     63: ADD_CC_WARN_IF(-Wextra-semi)
                     64: ADD_CC_WARN_IF(-Wlogical-op)
                     65: ADD_CC_WARN_IF(-Wmissing-prototypes)
                     66: ADD_CC_WARN_IF(-Wmissing-variable-declarations)
1.1.1.11  root       67: # -Wshadow-local があればそっちを使う(gcc>=7)、なければ -Wshadow (clang)
                     68: ADD_CC_WARN_IF(-Wshadow-local)
                     69: if test x"${cc_has_Wshadow_local}" != xyes; then
                     70:        ADD_CC_WARN_IF(-Wshadow)
                     71: fi
1.1.1.3   root       72: AC_LANG_POP([C])
                     73: AC_SUBST([WARNFLAGS_C])
                     74: 
                     75: # C++ コンパイラのワーニングオプション
                     76: # (AC_LANG は C++ のまま継続する)
1.1.1.10  root       77: AC_LANG([C++])
1.1.1.4   root       78: AC_DEFUN([ADD_CXX_WARN_IF],[
1.1.1.3   root       79:        AC_MSG_CHECKING([whether c++ accepts $1])
                     80:        old_CXXFLAGS="${CXXFLAGS}"
                     81:        CXXFLAGS="${CXXFLAGS} -Werror $1"
                     82:        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
                     83:                AC_MSG_RESULT([yes])
1.1.1.11  root       84:                eval `echo cxx_has$1=yes | sed -e 's/-/_/g'`
1.1.1.3   root       85:                WARNFLAGS_CXX="${WARNFLAGS_CXX} $1",
                     86:                AC_MSG_RESULT([no]))
                     87:        CXXFLAGS="${old_CXXFLAGS}"
                     88: ])
1.1.1.4   root       89: ADD_CXX_WARN_IF(-Wcast-qual)
                     90: ADD_CXX_WARN_IF(-Wextra-semi)
                     91: ADD_CXX_WARN_IF(-Winconsistent-missing-override)
                     92: ADD_CXX_WARN_IF(-Winconsistent-missing-destructor-override)
                     93: ADD_CXX_WARN_IF(-Wlogical-op)
                     94: ADD_CXX_WARN_IF(-Wmissing-prototypes)
                     95: ADD_CXX_WARN_IF(-Wmissing-variable-declarations)
1.1.1.11  root       96: # -Wshadow-local があればそっちを使う(gcc>=7)、なければ -Wshadow (clang)
                     97: ADD_CXX_WARN_IF(-Wshadow-local)
                     98: if test x"${cxx_has_Wshadow_local}" != xyes; then
                     99:        ADD_CXX_WARN_IF(-Wshadow)
                    100: fi
1.1.1.12  root      101: ADD_CXX_WARN_IF(-Wsuggest-override)
1.1.1.4   root      102: ADD_CXX_WARN_IF(-Wvla-extension)
1.1.1.3   root      103: AC_SUBST([WARNFLAGS_CXX])
1.1       root      104: 
1.1.1.14! root      105: # CPU が AVX2 をサポートしているか。
        !           106: # (OS がレジスタの退避などをサポートしているかとかはたぶん知る方法がない)
        !           107: AC_ARG_ENABLE([avx2],
        !           108:        [AS_HELP_STRING([--disable-avx2], [disable avx2 support])],
        !           109:        [],
        !           110:        [enable_avx2=yes])
        !           111: 
        !           112: AS_IF([test x"${enable_avx2}" != x"no"], [
        !           113:        AC_MSG_CHECKING(for AVX2)
        !           114:        if test x"${host_cpu}" = x"x86_64"; then
        !           115:                if test x"${host_cpu}" = x"${build_cpu}"; then
        !           116:                        old_CXXFLAGS="${CXXFLAGS}"
        !           117:                        CXXFLAGS="${CXXFLAGS} -mavx2"
        !           118:                        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
        !           119:                                        #include <x86intrin.h>
        !           120:                                ], [
        !           121:                                        #if !defined(__AVX2__)
        !           122:                                        #error __AVX2__ is not defined by the compiler.
        !           123:                                        #endif
        !           124:                                        __m256i v;
        !           125:                                ])], [
        !           126:                                        have_avx2=yes
        !           127:                                ])
        !           128:                        CXXFLAGS="${old_CXXFLAGS}"
        !           129:                fi
        !           130:        fi
        !           131:        if test x"${have_avx2}" = x"yes"; then
        !           132:                AC_MSG_RESULT([yes])
        !           133:                AC_DEFINE([HAVE_AVX2])
        !           134:                AC_SUBST(HOST_HAS_AVX2, yes)
        !           135:        else
        !           136:                AC_MSG_RESULT([no])
        !           137:        fi
        !           138: ], [
        !           139: ])
        !           140: 
1.1       root      141: # Checks for libraries.
                    142: 
                    143: # Checks for header files.
                    144: AC_CHECK_HEADERS([bsd/bsd.h])
1.1.1.10  root      145: AC_CHECK_HEADERS([bsd/stdio.h])
                    146: AC_CHECK_HEADERS([byteswap.h])
1.1       root      147: AC_CHECK_HEADERS([endian.h])
                    148: AC_CHECK_HEADERS([kqueue/sys/event.h])
1.1.1.3   root      149: AC_CHECK_HEADERS([pthread_np.h])
1.1       root      150: AC_CHECK_HEADERS([sys/endian.h])
                    151: AC_CHECK_HEADERS([sys/event.h])
                    152: AC_CHECK_HEADERS([net/bpf.h])
                    153: AC_CHECK_HEADERS([net/if_tap.h])
                    154: AC_CHECK_HEADERS([linux/if_tun.h])
1.1.1.10  root      155: AC_CHECK_HEADERS([libkern/OSByteOrder.h])
                    156: AC_CHECK_HEADERS([machine/endian.h])
1.1       root      157: 
                    158: # Linux で <kqueue/sys/event.h> がなければここで停止したほうがいい
1.1.1.6   root      159: case "${host_os}" in
                    160:  linux*)
                    161:        if test "$ac_cv_header_kqueue_sys_event_h" != "yes"; then
                    162:                AC_MSG_ERROR([*** kqueue is not found.
1.1.1.7   root      163: *** If you use Ubuntu, sudo apt install libkqueue-dev])
1.1.1.6   root      164:        fi
                    165:        ;;
                    166: esac
1.1       root      167: 
                    168: # Checks for typedefs, structures, and compiler characteristics.
                    169: AC_CHECK_HEADER_STDBOOL
                    170: #AC_C_INLINE
                    171: #AC_TYPE_INT16_T
                    172: #AC_TYPE_INT32_T
                    173: #AC_TYPE_INT64_T
                    174: #AC_TYPE_INT8_T
                    175: #AC_TYPE_SIZE_T
                    176: #AC_TYPE_UINT16_T
                    177: #AC_TYPE_UINT32_T
                    178: #AC_TYPE_UINT64_T
                    179: #AC_TYPE_UINT8_T
                    180: 
                    181: AC_MSG_CHECKING(for __builtin_assume)
1.1.1.10  root      182: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
                    183:        [[
1.1       root      184:                __builtin_assume(1);
1.1.1.10  root      185:        ]])], [
                    186:                AC_MSG_RESULT(yes)
                    187:                AC_DEFINE(HAVE___BUILTIN_ASSUME)
                    188:        ], [
                    189:                AC_MSG_RESULT(no)
                    190:        ])
1.1       root      191: 
                    192: AC_MSG_CHECKING(for __builtin_bswap16)
1.1.1.10  root      193: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
                    194:        [[
1.1       root      195:                return __builtin_bswap16(0);
1.1.1.10  root      196:        ]])], [
                    197:                AC_MSG_RESULT(yes)
                    198:                AC_DEFINE(HAVE___BUILTIN_BSWAP16)
                    199:        ], [
                    200:                AC_MSG_RESULT(no)
                    201:        ])
1.1       root      202: 
                    203: AC_MSG_CHECKING(for __builtin_bswap32)
1.1.1.10  root      204: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
                    205:        [[
1.1       root      206:                return __builtin_bswap32(0);
1.1.1.10  root      207:        ]])], [
                    208:                AC_MSG_RESULT(yes)
                    209:                AC_DEFINE(HAVE___BUILTIN_BSWAP32)
                    210:        ], [
                    211:                AC_MSG_RESULT(no)
                    212:        ])
1.1       root      213: 
1.1.1.2   root      214: AC_MSG_CHECKING(for __builtin_bswap64)
1.1.1.10  root      215: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
                    216:        [[
1.1.1.2   root      217:                return __builtin_bswap64(0);
1.1.1.10  root      218:        ]])], [
                    219:                AC_MSG_RESULT(yes)
                    220:                AC_DEFINE(HAVE___BUILTIN_BSWAP64)
                    221:        ], [
                    222:                AC_MSG_RESULT(no)
                    223:        ])
1.1.1.2   root      224: 
1.1       root      225: AC_MSG_CHECKING(for __builtin_expect)
1.1.1.10  root      226: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1.1       root      227:                if (__builtin_expect(1, 1)) return 0;
1.1.1.10  root      228:        ]])], [
                    229:                AC_MSG_RESULT(yes)
                    230:                AC_DEFINE(HAVE___BUILTIN_EXPECT)
                    231:        ], [
                    232:                AC_MSG_RESULT(no)
                    233:        ])
1.1       root      234: 
                    235: AC_MSG_CHECKING(for __builtin_unreachable)
1.1.1.10  root      236: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
1.1       root      237:                __builtin_unreachable();
1.1.1.10  root      238:        ]])], [
                    239:                AC_MSG_RESULT(yes)
                    240:                AC_DEFINE(HAVE___BUILTIN_UNREACHABLE)
                    241:        ], [
                    242:                AC_MSG_RESULT(no)
                    243:        ])
1.1       root      244: 
                    245: AC_MSG_CHECKING(for __attribute__((__fallthrough__)))
                    246: old_CXXFLAGS="${CXXFLAGS}"
                    247: CXXFLAGS="${CXXFLAGS} -Wall -Werror"
1.1.1.10  root      248: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
                    249:        [
1.1       root      250:                extern int x;
                    251:                switch (x) {
                    252:                 case 0:
                    253:                        __attribute__((__fallthrough__));
                    254:                 case 1:
                    255:                        break;
                    256:                }
1.1.1.10  root      257:        ])], [
                    258:                AC_MSG_RESULT([yes])
                    259:                AC_DEFINE([HAVE___ATTRIBUTE_FALLTHROUGH])
                    260:        ], [
                    261:                AC_MSG_RESULT([no])
                    262:        ])
1.1       root      263: CXXFLAGS="${old_CXXFLAGS}"
                    264: 
                    265: dnl とりあえず __format__ までしか調べてないので、
                    266: dnl その中の __printf__ とかまで調べる必要ができたら直すこと。
                    267: AC_MSG_CHECKING(for __attribute__((__format__)))
                    268: old_CXXFLAGS="${CXXFLAGS}"
                    269: CXXFLAGS="${CXXFLAGS} -Wall -Werror"
                    270: AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
                    271:        [
                    272:                extern int f(const char *f, ...)
                    273:                        __attribute__((__format__(__printf__, 1, 2)));
1.1.1.10  root      274:        ], [])], [
                    275:                AC_MSG_RESULT([yes])
                    276:                AC_DEFINE([HAVE___ATTRIBUTE_FORMAT])
1.1       root      277:        ], [
1.1.1.10  root      278:                AC_MSG_RESULT([no])
                    279:        ])
1.1       root      280: CXXFLAGS="${old_CXXFLAGS}"
                    281: 
                    282: AC_MSG_CHECKING(for __attribute__((no_sanitize)))
                    283: old_CXXFLAGS="${CXXFLAGS}"
                    284: CXXFLAGS="${CXXFLAGS} -Werror"
                    285: AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
                    286:        [
                    287:                __attribute__((no_sanitize("undefined")))
                    288:                int func() { return 0; }
1.1.1.10  root      289:        ], [])], [
                    290:                AC_MSG_RESULT([yes])
                    291:                AC_DEFINE([HAVE___ATTRIBUTE_NO_SANITIZE])
1.1       root      292:        ], [
1.1.1.10  root      293:                AC_MSG_RESULT([no])
                    294:        ])
1.1       root      295: CXXFLAGS="${old_CXXFLAGS}"
                    296: 
                    297: 
                    298: AC_MSG_CHECKING(for __attribute__((__packed__)))
                    299: old_CXXFLAGS="${CXXFLAGS}"
                    300: CXXFLAGS="${CXXFLAGS} -Werror"
1.1.1.10  root      301: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
                    302:        [
1.1       root      303:                struct x { char a; int b; } __attribute__((__packed__));
1.1.1.10  root      304:        ])], [
                    305:                AC_MSG_RESULT([yes])
                    306:                AC_DEFINE([HAVE___ATTRIBUTE_PACKED])
                    307:        ], [
                    308:                AC_MSG_RESULT([no])
                    309:        ])
1.1       root      310: CXXFLAGS="${old_CXXFLAGS}"
                    311: 
                    312: AC_MSG_CHECKING(for __attribute__((__unused__)))
                    313: old_CXXFLAGS="${CXXFLAGS}"
                    314: CXXFLAGS="${CXXFLAGS} -Wunused-variable -Werror"
1.1.1.10  root      315: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
                    316:        [
1.1       root      317:                int a __attribute__((__unused__));
1.1.1.10  root      318:        ])], [
                    319:                AC_MSG_RESULT([yes])
                    320:                AC_DEFINE([HAVE___ATTRIBUTE_UNUSED])
                    321:        ], [
                    322:                AC_MSG_RESULT([no])
                    323:        ])
1.1       root      324: CXXFLAGS="${old_CXXFLAGS}"
                    325: 
                    326: # Checks for library functions.
                    327: #AC_FUNC_MALLOC
                    328: #AC_FUNC_MMAP
                    329: 
1.1.1.10  root      330: AC_MSG_CHECKING(for bswap16)
                    331: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    332:                #if defined(HAVE_SYS_ENDIAN_H)
                    333:                #include <sys/endian.h>
                    334:                #endif
                    335:        ], [
                    336:                bswap16(0);
                    337:        ])], [
                    338:                AC_MSG_RESULT([yes])
                    339:                AC_DEFINE([HAVE_BSWAP16])
                    340:        ], [
                    341:                AC_MSG_RESULT([no])
                    342:        ])
                    343: 
                    344: AC_MSG_CHECKING(for bswap32)
                    345: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    346:                #if defined(HAVE_SYS_ENDIAN_H)
                    347:                #include <sys/endian.h>
                    348:                #endif
                    349:        ], [
                    350:                bswap32(0);
                    351:        ])], [
                    352:                AC_MSG_RESULT([yes])
                    353:                AC_DEFINE([HAVE_BSWAP32])
                    354:        ], [
                    355:                AC_MSG_RESULT([no])
                    356:        ])
                    357: 
                    358: AC_MSG_CHECKING(for bswap64)
                    359: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    360:                #if defined(HAVE_SYS_ENDIAN_H)
                    361:                #include <sys/endian.h>
                    362:                #endif
                    363:        ], [
                    364:                bswap64(0);
                    365:        ])], [
                    366:                AC_MSG_RESULT([yes])
                    367:                AC_DEFINE([HAVE_BSWAP64])
                    368:        ], [
                    369:                AC_MSG_RESULT([no])
                    370:        ])
                    371: 
                    372: AC_MSG_CHECKING(for bswap_16)
                    373: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    374:                #if defined(HAVE_BYTESWAP_H)
                    375:                #include <byteswap.h>
                    376:                #endif
                    377:        ], [
                    378:                bswap_16(0);
                    379:        ])], [
                    380:                AC_MSG_RESULT([yes])
                    381:                AC_DEFINE([HAVE_BSWAP_16])
                    382:        ], [
                    383:                AC_MSG_RESULT([no])
                    384:        ])
                    385: 
                    386: AC_MSG_CHECKING(for bswap_32)
                    387: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    388:                #if defined(HAVE_BYTESWAP_H)
                    389:                #include <byteswap.h>
                    390:                #endif
                    391:        ], [
                    392:                bswap_32(0);
                    393:        ])], [
                    394:                AC_MSG_RESULT([yes])
                    395:                AC_DEFINE([HAVE_BSWAP_32])
                    396:        ], [
                    397:                AC_MSG_RESULT([no])
                    398:        ])
                    399: 
                    400: AC_MSG_CHECKING(for bswap_64)
                    401: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    402:                #if defined(HAVE_BYTESWAP_H)
                    403:                #include <byteswap.h>
                    404:                #endif
                    405:        ], [
                    406:                bswap_64(0);
                    407:        ])], [
                    408:                AC_MSG_RESULT([yes])
                    409:                AC_DEFINE([HAVE_BSWAP_64])
                    410:        ], [
                    411:                AC_MSG_RESULT([no])
                    412:        ])
                    413: 
                    414: AC_MSG_CHECKING(for swap16)
                    415: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    416:                #if defined(HAVE_SYS_ENDIAN_H)
                    417:                #include <sys/endian.h>
                    418:                #endif
                    419:        ], [
                    420:                swap16(0);
                    421:        ])], [
                    422:                AC_MSG_RESULT([yes])
                    423:                AC_DEFINE([HAVE_SWAP16])
                    424:        ], [
                    425:                AC_MSG_RESULT([no])
                    426:        ])
                    427: 
                    428: AC_MSG_CHECKING(for swap32)
                    429: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    430:                #if defined(HAVE_SYS_ENDIAN_H)
                    431:                #include <sys/endian.h>
                    432:                #endif
                    433:        ], [
                    434:                swap32(0);
                    435:        ])], [
                    436:                AC_MSG_RESULT([yes])
                    437:                AC_DEFINE([HAVE_SWAP32])
                    438:        ], [
                    439:                AC_MSG_RESULT([no])
                    440:        ])
                    441: 
                    442: AC_MSG_CHECKING(for swap64)
                    443: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    444:                #if defined(HAVE_SYS_ENDIAN_H)
                    445:                #include <sys/endian.h>
                    446:                #endif
                    447:        ], [
                    448:                swap64(0);
                    449:        ])], [
                    450:                AC_MSG_RESULT([yes])
                    451:                AC_DEFINE([HAVE_SWAP64])
                    452:        ], [
                    453:                AC_MSG_RESULT([no])
                    454:        ])
                    455: 
                    456: AC_MSG_CHECKING(for htobe16)
                    457: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
                    458:                #if defined(HAVE_ENDIAN_H)
                    459:                #include <endian.h>
                    460:                #endif
                    461:                #if defined(HAVE_SYS_ENDIAN_H)
                    462:                #include <sys/endian.h>
                    463:                #endif
                    464:                #if defined(HAVE_MACHINE_ENDIAN_H)
                    465:                #include <machine/endian.h>
                    466:                #endif
                    467:        ], [
                    468:                htobe16(0);
                    469:        ])], [
                    470:                AC_MSG_RESULT([yes])
                    471:                AC_DEFINE([HAVE_HTOBE16])
                    472:        ], [
                    473:                AC_MSG_RESULT([no])
                    474:        ])
                    475: 
1.1.1.14! root      476: AC_MSG_CHECKING(for statfs)
        !           477: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
        !           478:                #include <sys/statfs.h>
        !           479:        ], [
        !           480:                struct statfs buf;
        !           481:                statfs("", &buf);
        !           482:        ])], [
        !           483:                AC_MSG_RESULT([yes])
        !           484:                AC_DEFINE([HAVE_STATFS])
        !           485:                have_statxxfs=statfs
        !           486:        ], [
        !           487:                AC_MSG_RESULT([no])
        !           488:        ])
        !           489: 
        !           490: AC_MSG_CHECKING(for statvfs)
        !           491: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
        !           492:                #include <sys/statvfs.h>
        !           493:        ], [
        !           494:                struct statvfs buf;
        !           495:                statvfs("", &buf);
        !           496:        ])], [
        !           497:                AC_MSG_RESULT([yes])
        !           498:                AC_DEFINE([HAVE_STATVFS])
        !           499:                have_statxxfs=statvfs
        !           500:        ], [
        !           501:                AC_MSG_RESULT([no])
        !           502:        ])
        !           503: 
        !           504: if test -z "${have_statxxfs}"; then
        !           505:        AC_MSG_FAILURE([*** No statfs() nor statvfs() found])
        !           506: fi
        !           507: 
        !           508: AC_CHECK_MEMBER([struct stat.st_mtimespec], [
        !           509:                AC_DEFINE([HAVE_STAT_ST_TIMESPEC])
        !           510:        ], [], [
        !           511:                #include <sys/stat.h>
        !           512:        ])
        !           513: 
        !           514: AC_MSG_CHECKING(for timegm)
        !           515: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
        !           516:                #include <time.h>
        !           517:        ], [
        !           518:                timegm(NULL);
        !           519:        ])], [
        !           520:                AC_MSG_RESULT([yes])
        !           521:        ], [
        !           522:                AC_MSG_RESULT([no])
        !           523:                AC_MSG_FAILURE([*** No timegm() found])
        !           524:        ])
        !           525: 
1.1.1.10  root      526: AC_MSG_CHECKING(for pthread_getname_np)
                    527: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1.1.1.3   root      528:                #include <pthread.h>
                    529:                #if defined(HAVE_PTHREAD_NP_H)
                    530:                #include <pthread_np.h>
                    531:                #endif
1.1.1.10  root      532:        ]], [[
                    533:                char name[32];
                    534:                pthread_getname_np(pthread_self(), name, sizeof(name));
                    535:        ]])], [
                    536:                AC_MSG_RESULT(yes)
                    537:                AC_DEFINE(HAVE_PTHREAD_GETNAME_NP)
1.1.1.3   root      538:        ], [
1.1.1.10  root      539:                AC_MSG_RESULT(no)
                    540:        ])
                    541: 
                    542: AC_MSG_CHECKING(for pthread_get_name_np)
                    543: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
                    544:                #include <pthread.h>
                    545:                #if defined(HAVE_PTHREAD_NP_H)
                    546:                #include <pthread_np.h>
                    547:                #endif
                    548:        ]], [[
                    549:                char name[32];
                    550:                pthread_get_name_np(pthread_self(), name, sizeof(name));
                    551:        ]])], [
                    552:                AC_MSG_RESULT(yes)
                    553:                AC_DEFINE(HAVE_PTHREAD_GET_NAME_NP)
                    554:        ], [
                    555:                AC_MSG_RESULT(no)
                    556:        ])
                    557: 
                    558: AC_MSG_CHECKING(for pthread_setname_np(name))
                    559: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
                    560:                #include <pthread.h>
                    561:                #if defined(HAVE_PTHREAD_NP_H)
                    562:                #include <pthread_np.h>
                    563:                #endif
                    564:        ]], [[
1.1       root      565:                pthread_setname_np("");
1.1.1.10  root      566:        ]])], [
                    567:                AC_MSG_RESULT(yes)
                    568:                AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_name)
                    569:        ], [
                    570:                AC_MSG_RESULT(no)
                    571:        ])
1.1       root      572: 
                    573: AC_MSG_CHECKING(for pthread_setname_np(thread, name))
1.1.1.10  root      574: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1.1.1.3   root      575:                #include <pthread.h>
                    576:                #if defined(HAVE_PTHREAD_NP_H)
                    577:                #include <pthread_np.h>
                    578:                #endif
1.1.1.10  root      579:        ]], [[
1.1       root      580:                pthread_setname_np(pthread_self(), "");
1.1.1.10  root      581:        ]])], [
                    582:                AC_MSG_RESULT(yes)
                    583:                AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_th_name)
                    584:        ], [
                    585:                AC_MSG_RESULT(no)
                    586:        ])
1.1       root      587: 
                    588: AC_MSG_CHECKING(for pthread_setname_np(thread, name, arg))
1.1.1.10  root      589: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1.1.1.3   root      590:                #include <pthread.h>
                    591:                #if defined(HAVE_PTHREAD_NP_H)
                    592:                #include <pthread_np.h>
                    593:                #endif
1.1.1.10  root      594:        ]], [[
1.1       root      595:                pthread_setname_np(pthread_self(), "", (void*)0);
1.1.1.10  root      596:        ]])], [
                    597:                AC_MSG_RESULT(yes)
                    598:                AC_DEFINE(HAVE_PTHREAD_SETNAME_NP_th_name_arg)
                    599:        ], [
                    600:                AC_MSG_RESULT(no)
                    601:        ])
1.1.1.3   root      602: 
                    603: AC_MSG_CHECKING(for pthread_set_name_np(thread, name))
1.1.1.10  root      604: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1.1.1.3   root      605:                #include <pthread.h>
                    606:                #if defined(HAVE_PTHREAD_NP_H)
                    607:                #include <pthread_np.h>
                    608:                #endif
1.1.1.10  root      609:        ]], [[
1.1.1.3   root      610:                pthread_set_name_np(pthread_self(), "");
1.1.1.10  root      611:        ]])],[
                    612:                AC_MSG_RESULT(yes)
                    613:                AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP_th_name)
                    614:        ], [
                    615:                AC_MSG_RESULT(no)
                    616:        ])
1.1       root      617: 
1.1.1.8   root      618: #
                    619: # Network
                    620: #
                    621: AC_MSG_CHECKING(for AF_PACKET)
1.1.1.10  root      622: AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1.1.1.8   root      623:                #include <sys/socket.h>
1.1.1.10  root      624:        ]], [[
1.1.1.8   root      625:                AF_PACKET;
1.1.1.10  root      626:        ]])], [
                    627:                AC_MSG_RESULT(yes)
                    628:                AC_DEFINE(HAVE_HOSTNET_AFPACKET)
                    629:                AC_SUBST(HOSTNET_AFPACKET, yes)
                    630:        ], [
                    631:                AC_MSG_RESULT(no)
                    632:        ])
1.1.1.8   root      633: 
                    634: AC_MSG_CHECKING(for tap(4))
1.1.1.6   root      635: case "${host_os}" in
                    636:  linux*)
                    637:        if test x"$ac_cv_header_linux_if_tun_h" = xyes; then
1.1.1.8   root      638:                netdriver_tap=yes
1.1.1.6   root      639:        fi
                    640:        ;;
                    641:  openbsd*)
                    642:        # OpenBSD has no <net/if_tap.h> but supports tap(4).
1.1.1.8   root      643:        netdriver_tap=yes
1.1.1.6   root      644:        ;;
1.1.1.8   root      645:  *)
1.1.1.6   root      646:        if test x"$ac_cv_header_net_if_tap_h" = xyes; then
1.1.1.8   root      647:                netdriver_tap=yes
1.1.1.6   root      648:        fi
1.1.1.8   root      649:        ;;
                    650: esac
                    651: if test x"$netdriver_tap" = xyes; then
                    652:        AC_MSG_RESULT([yes])
                    653:        AC_DEFINE([HAVE_HOSTNET_TAP])
                    654:        AC_SUBST([HOSTNET_TAP], [yes])
                    655: else
                    656:        AC_MSG_RESULT([no])
                    657: fi
                    658: 
                    659: AC_MSG_CHECKING(for bpf(4))
                    660: if test x"$ac_cv_header_net_bpf_h" = xyes; then
                    661:        AC_MSG_RESULT([yes])
                    662:        AC_DEFINE([HAVE_HOSTNET_BPF])
                    663:        AC_SUBST([HOSTNET_BPF], [yes])
                    664: else
                    665:        AC_MSG_RESULT([no])
1.1       root      666: fi
                    667: 
1.1.1.14! root      668: #
        !           669: # Other libraries
        !           670: #
        !           671: 
        !           672: # CHECK_LIB($1=name, $2=libs, $3=include, $4=src)
        !           673: AC_DEFUN([CHECK_LIB], [
        !           674:        AC_MSG_CHECKING([for $1])
        !           675:        for path in ${PATHS}; do
        !           676:                old_CPPFLAGS=${CPPFLAGS}
        !           677:                old_LIBS=${LIBS}
        !           678:                case ${path} in
        !           679:                 none)
        !           680:                        LIBS="${LIBS} $2"
        !           681:                        ;;
        !           682:                 *)
        !           683:                        CPPFLAGS="${CPPFLAGS} -I${path}/include"
        !           684:                        LIBS="${LIBS} -L${path}/lib $2"
        !           685:                        ;;
        !           686:                esac
        !           687:                AC_LINK_IFELSE([AC_LANG_PROGRAM([$3], [$4])], [
        !           688:                        has_$1=yes
        !           689:                        break
        !           690:                ], [
        !           691:                        has_$1=no
        !           692:                ])
        !           693:                CPPFLAGS=${old_CPPFLAGS}
        !           694:                LIBS=${old_LIBS}
        !           695:        done
        !           696:        if test x"${has_$1}" = x"yes"; then
        !           697:                AC_MSG_RESULT([yes])
        !           698:        else
        !           699:                AC_MSG_RESULT([no])
        !           700:        fi
        !           701: ])
        !           702: 
        !           703: PATHS="none /usr/pkg /usr/local"
        !           704: 
1.1       root      705: # libbsd on Linux
1.1.1.5   root      706: AC_CHECK_LIB(c, getprogname, ,)
1.1       root      707: AC_CHECK_LIB(bsd, getprogname,
1.1.1.6   root      708:        LIBS="${LIBS} -lbsd"
                    709: )
1.1.1.5   root      710: # なければ停止する
                    711: AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
                    712:        [
                    713:                #include <stdlib.h>
                    714:                #include "confdefs.h"
                    715:                #if defined(HAVE_BSD_BSD_H)
                    716:                #include <bsd/bsd.h>
                    717:                #endif
                    718:        ], [
                    719:                getprogname()
1.1.1.10  root      720:        ])], [
1.1.1.5   root      721:        # nothing to do on success
1.1.1.10  root      722:        ], [
                    723:                AC_MSG_ERROR([*** getprogname is not found.
1.1.1.7   root      724: *** If you use Ubuntu, sudo apt install libbsd-dev])
1.1.1.5   root      725:        ]
                    726: )
1.1       root      727: 
                    728: # libkqueue on Linux
                    729: AC_CHECK_LIB(kqueue, kqueue,
1.1.1.6   root      730:        LIBS="${LIBS} -lkqueue"
                    731: )
1.1       root      732: 
1.1.1.5   root      733: AC_CHECK_LIB(z, gzclose,
1.1.1.6   root      734:        LIBS="${LIBS} -lz",
1.1.1.5   root      735:        [AC_MSG_ERROR([*** zlib is not found.
1.1.1.7   root      736: *** If use use Ubuntu, sudo apt install zlib1g-dev])]
1.1.1.5   root      737: )
                    738: 
1.1       root      739: # wxWidgets
1.1.1.10  root      740: AC_ARG_WITH([gui],
                    741:        [AS_HELP_STRING([--without-gui], [disable GUI support])],
                    742:        [],
                    743:        [with_gui=yes])
                    744: 
                    745: AS_IF([test "x$with_gui" != xno], [
                    746:        AC_MSG_CHECKING(for wx-config)
1.1.1.14! root      747:        wxconfig_paths="${WX_CONFIG} wx-config-3.2 wx-config-3.0 wx-config"
1.1.1.10  root      748:        wxconfig=""
                    749:        for c in ${wxconfig_paths}; do
                    750:                ver=`$c --version 2>&1 | cut -f 1 -d .`
                    751:                if test "$ver" = "3"; then
                    752:                        wxconfig=$c
                    753:                        break
                    754:                fi
                    755:        done
                    756:        if test -z "$wxconfig"; then
1.1.1.14! root      757:                AC_MSG_ERROR([*** wxWidgets-3.2 nor -3.0 not found in ${wxconfig_paths}
        !           758: *** If you use pkgsrc, install x11/wxGTK32.
1.1.1.7   root      759: *** If you use Ubuntu, sudo apt install libwxgtk3.0-gtk3-dev])
1.1.1.10  root      760:        else
                    761:                AC_MSG_RESULT([$wxconfig])
1.1       root      762: 
1.1.1.10  root      763:                AC_MSG_CHECKING(for wxWidgets version)
                    764:                wxversion=`$wxconfig --version`
                    765:                AC_MSG_RESULT([$wxversion])
1.1.1.14! root      766:                wxmajorminor=`echo $wxversion | awk -F . '{print $1 $2}'`
        !           767:                AC_SUBST([WX_MAJORMINOR], [${wxmajorminor}])
1.1.1.10  root      768: 
                    769:                wxcppflags=`$wxconfig --cppflags`
                    770:                wxlibs=`$wxconfig --libs`
                    771: 
                    772:                case "${host_os}" in
                    773:                 netbsd*)
                    774:                        # rpath。どうしたもんだかこれ
                    775:                        wxlibs=[`echo $wxlibs | sed -e 's/-L\([^ ]*\) /-L\1 -Wl,-R,\1 /'`]
                    776:                        ;;
                    777: 
                    778:                 darwin*)
                    779:                        # XXX -framework AudioToolbox が指定されているとリンカがこけるorz
                    780:                        wxlibs=[`echo $wxlibs | sed -e 's/-framework AudioToolbox//'`]
                    781:                        ;;
                    782:                esac
                    783: 
                    784:                AC_SUBST([WITH_GUI], [yes])
                    785:                AC_SUBST([WXWIDGETS_CPPFLAGS], [$wxcppflags])
                    786:                AC_SUBST([WXWIDGETS_LIBS], [$wxlibs])
                    787:        fi
1.1       root      788: 
1.1.1.10  root      789:        # gettext
                    790:        AC_CHECK_TOOL([MSGFMT], [msgfmt], [:])
                    791:        if test $MSGFMT = [:]; then
                    792:                AC_MSG_ERROR([*** msgfmt not found.
1.1.1.7   root      793: *** If you use pkgsrc, install devel/gettext-tools.
                    794: *** If you use Ubuntu, sudo apt install gettext])
1.1.1.10  root      795:        fi
                    796: ], [
                    797:        AC_SUBST([WITH_GUI], [no])
                    798: ])
1.1.1.5   root      799: 
1.1.1.14! root      800: # nono 本体のチェックはここまで。
        !           801: nono_CPPFLAGS=${CPPFLAGS}
        !           802: nono_LIBS=${LIBS}
        !           803: AC_SUBST([NONO_CPPFLAGS], [${nono_CPPFLAGS}])
        !           804: AC_SUBST([NONO_LIBS], [${nono_LIBS}])
        !           805: 
        !           806: # iconv は util/ でのみ必要。
        !           807: CPPFLAGS=
        !           808: LIBS=
        !           809: CHECK_LIB([iconv], [-liconv], [
        !           810:        #include <iconv.h>
        !           811: ], [
        !           812:        iconv_open("", "");
        !           813: ])
        !           814: 
        !           815: if test x"${has_iconv}" = x"yes"; then
        !           816:        AC_MSG_CHECKING(whether iconv needs const)
        !           817:        old_CPPFLAGS="${CPPFLAGS}"
        !           818:        CPPFLAGS="${CPPFLAGS} -Werror"
        !           819:        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
        !           820:                        #include <iconv.h>
        !           821:                ]], [[
        !           822:                        const char **a;
        !           823:                        iconv(0, a, 0, 0, 0);
        !           824:                ]])], [
        !           825:                        AC_MSG_RESULT(yes)
        !           826:                        AC_DEFINE(HAVE_ICONV_CONST)
        !           827:                ], [
        !           828:                        AC_MSG_RESULT(no)
        !           829:                ])
        !           830:        CPPFLAGS="${old_CPPFLAGS}"
        !           831: fi
        !           832: 
        !           833: iconv_CPPFLAGS=${CPPFLAGS}
        !           834: iconv_LIBS=${LIBS}
        !           835: AC_SUBST([ICONV_CPPFLAGS], [${iconv_CPPFLAGS}])
        !           836: AC_SUBST([ICONV_LIBS], [${iconv_LIBS}])
        !           837: 
1.1       root      838: AC_CONFIG_FILES([Makefile.cfg
                    839:        host/Makefile
                    840:        wx/Makefile
1.1.1.14! root      841:        util/mkcgrom/Makefile
1.1       root      842:        util/viewcgrom/Makefile
                    843: ])
1.1.1.2   root      844: AC_CONFIG_HEADERS([config-nono.h])
1.1       root      845: AC_OUTPUT

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.