| 1 | AC_PREREQ(2.50) |
| 2 | AC_INIT([libnfs], [1.3.0], [ronniesahlberg@gmail.com]) |
| 3 | AC_CONFIG_HEADERS([config.h]) |
| 4 | AM_INIT_AUTOMAKE([foreign]) |
| 5 | AC_CANONICAL_HOST |
| 6 | |
| 7 | # Work around stupid autoconf default cflags. pt 1 |
| 8 | SAVE_CFLAGS="x${CFLAGS}" |
| 9 | |
| 10 | AC_PROG_CC |
| 11 | AC_PROG_LIBTOOL |
| 12 | |
| 13 | AM_PROG_CC_C_O |
| 14 | PKG_PROG_PKG_CONFIG |
| 15 | |
| 16 | # Work around stupid autoconf default cflags. pt 2 |
| 17 | if test "$SAVE_CFLAGS" = "x"; then |
| 18 | CFLAGS="" |
| 19 | fi |
| 20 | |
| 21 | # We always want 64 bit file offsets |
| 22 | CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64" |
| 23 | |
| 24 | AC_CHECK_PROG([HAVE_RPCGEN], [rpcgen], [yes], [no]) |
| 25 | if test x$HAVE_RPCGEN != xyes; then |
| 26 | AC_MSG_ERROR([Can not find required program]) |
| 27 | fi |
| 28 | |
| 29 | #option: examples |
| 30 | AC_ARG_ENABLE([examples], |
| 31 | [AC_HELP_STRING([--enable-examples], |
| 32 | [Build example programs])], |
| 33 | [ENABLE_EXAMPLES=$enableval], |
| 34 | [ENABLE_EXAMPLES="no"]) |
| 35 | |
| 36 | if test x$ENABLE_EXAMPLES = xyes; then |
| 37 | MAYBE_EXAMPLES="examples" |
| 38 | fi |
| 39 | AC_SUBST(MAYBE_EXAMPLES) |
| 40 | |
| 41 | AC_ARG_ENABLE(tirpc, |
| 42 | [AC_HELP_STRING([--enable-tirpc], |
| 43 | [enable use of TI-RPC @<:@default=no@:>@])], |
| 44 | enable_tirpc=$enableval, |
| 45 | enable_tirpc='no') |
| 46 | |
| 47 | case $host in |
| 48 | *darwin*) |
| 49 | RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t" |
| 50 | ;; |
| 51 | *cygwin*) |
| 52 | RPCGENFLAGS=-DU_INT64_PLATTFORM_TYPE="u_int64_t" |
| 53 | ;; |
| 54 | *solaris*) |
| 55 | AC_CHECK_HEADERS([sys/filio.h]) |
| 56 | AC_CHECK_HEADERS([sys/sockio.h]) |
| 57 | if test x$ENABLE_EXAMPLES = xyes; then |
| 58 | AC_CHECK_LIB([socket], [main], , [AC_MSG_ERROR([Can not find required library])]) |
| 59 | AC_CHECK_LIB([nsl], [main], , [AC_MSG_ERROR([Can not find required library])]) |
| 60 | fi |
| 61 | ;; |
| 62 | *) |
| 63 | ;; |
| 64 | esac |
| 65 | |
| 66 | AC_SUBST(RPCGENFLAGS) |
| 67 | |
| 68 | # check for SA_LEN |
| 69 | dnl Check if sockaddr data structure includes a "sa_len" |
| 70 | AC_CHECK_MEMBER([struct sockaddr.sa_len], |
| 71 | [ AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len]) ], |
| 72 | [], |
| 73 | [ |
| 74 | #include <sys/types.h> |
| 75 | #include <sys/socket.h> |
| 76 | ]) |
| 77 | |
| 78 | LIBNFS_PC_REQ_PRIVATE= |
| 79 | |
| 80 | if test "$enable_tirpc" = "yes"; then |
| 81 | PKG_CHECK_MODULES(TIRPC, libtirpc, [], |
| 82 | AC_MSG_ERROR([unable to locate libtirpc files])) |
| 83 | CFLAGS="${CFLAGS} ${TIRPC_CFLAGS}" |
| 84 | LIBS="${LIBS} ${TIRPC_LIBS}" |
| 85 | LIBNFS_PC_REQ_PRIVATE="${LIBNFS_PC_REQ_PRIVATE} libtirpc" |
| 86 | fi |
| 87 | |
| 88 | AC_SUBST(LIBNFS_PC_REQ_PRIVATE) |
| 89 | |
| 90 | #output |
| 91 | AC_CONFIG_FILES([Makefile] |
| 92 | [include/Makefile] |
| 93 | [lib/Makefile] |
| 94 | [mount/Makefile] |
| 95 | [nfs/Makefile] |
| 96 | [nlm/Makefile] |
| 97 | [portmap/Makefile] |
| 98 | [rquota/Makefile] |
| 99 | [examples/Makefile] |
| 100 | ) |
| 101 | |
| 102 | AC_OUTPUT([libnfs.pc]) |