1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(libopm, [0.1])
3AC_CONFIG_SRCDIR(src/libopm.h)
4AM_CONFIG_HEADER(src/setup.h)
5AM_INIT_AUTOMAKE()
6AC_PREFIX_DEFAULT([/usr/local/libopm])
7AM_MAINTAINER_MODE
8
9# for documentation purposes
10DOX_DIR_HTML=api
11DOX_DIR_LATEX=latex
12DOX_DIR_MAN=man
13
14AC_SUBST(DOX_DIR_HTML)
15AC_SUBST(DOX_DIR_LATEX)
16AC_SUBST(DOX_DIR_MAN)
17
18AC_ARG_WITH(extra-fascism,
19    AC_HELP_STRING([--with-extra-fascism],
20    [add extra gcc3-specific warning flags]),
21    [CFLAGS="$CFLAGS -g -O0 -W -Wall -Wfloat-equal -Wbad-function-cast -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs"])
22
23dnl AC_ARG_WITH(faldo,
24dnl     AC_HELP_STRING([--with-faldo],
25dnl     [make some use of Nick Faldo]))
26
27dnl Checks for programs.
28AC_PROG_CC
29AC_PROG_LIBTOOL
30AC_SUBST(LIBTOOL_DEPS)
31
32dnl check if we need -lsocket or -lnsl
33ETR_SOCKET_NSL
34
35dnl Checks for header files.
36AC_HEADER_STDC
37
38AC_CHECK_HEADERS(sys/poll.h, have_poll_sys_h=yes, have_sys_poll_h=no)
39
40AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h strings.h)
41
42dnl Checks for typedefs, structures, and compiler characteristics.
43AC_C_CONST
44AC_TYPE_SIZE_T
45AC_HEADER_TIME
46
47AC_FUNC_SNPRINTF
48
49dnl if they want select() or they don't have poll() then we need to check
50dnl that we actually have select()
51if test "$have_sys_poll_h" = "no"; then
52 AC_CHECK_FUNCS(select, have_select=yes, have_select=no)
53 if test "$have_select" = "no"; then
54   AC_MSG_ERROR([No select() implementation found])
55 fi
56fi
57
58AC_CHECK_FUNCS(inet_aton inet_pton)
59
60dnl Check if we can use gethostbyname2 for ipv6
61AC_CHECK_FUNCS(gethostbyname gethostbyname2)
62
63dnl AIX fun
64AC_C_BIGENDIAN
65
66dnl Solaris has to be weird doesn't it...
67AC_CHECK_LIB(socket, socket, AC_SUBST(LSOCKET, [-lsocket]))
68AC_CHECK_LIB(nsl, gethostbyname, AC_SUBST(LNSL, [-lnsl]))
69
70dnl teehee - taken from MRTG / Tobias Oetiker
71dnl if test "$with_faldo" != "no"; then
72dnl  echo $ECHO_N "checking for Nick Faldo $ECHO_C"
73dnl  for bleh in 1 2 3; do
74dnl   echo $ECHO_N "."
75dnl   sleep 1
76dnl  done
77dnl  AC_MSG_RESULT([ http://blitzed.org/advocacy/enjoy.jpg])
78dnl fi
79
80LTLIBOBJS=`echo "$LIB@&t@OBJS" |
81           sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
82AC_SUBST(LTLIBOBJS)
83
84dnl This comes last because configure won't actually work with -Werror in
85dnl the CFLAGS
86AC_ARG_WITH(werror,
87    AC_HELP_STRING([--with-werror],
88    [use -Werror to abort compilation on any warning]),
89    [CFLAGS="$CFLAGS -Werror"])
90
91AC_OUTPUT(Makefile src/Makefile doc/Makefile doc/Doxyfile)
92
93echo "##############################################################################"
94echo "Everything is now configured.  To compile libopm now, just type make.  It"
95echo "requires GNU Make, which may be installed as gmake on your system."
96echo
97echo "libopm will be installed in ${prefix}.  To change this, run:"
98echo "   ./configure --prefix=DIRECTORY"
99echo
100echo "##############################################################################"
101echo
102