1dnl Process this file with autoconf to produce a configure script.
2AC_INIT([cups-bjnp], [2.0.3], [louis.lagendijk@gmail.com])
3
4AC_CONFIG_SRCDIR([bjnp.c])
5AM_INIT_AUTOMAKE([gnu])
6AC_LIBSOURCES([cups-bjnp.spec])
7
8## Check for programs
9AC_PROG_CC
10AC_PROG_INSTALL
11AC_PROG_MAKE_SET
12AM_PROG_CC_C_O
13##
14## Library directories
15##
16SRCH_LIB="/usr/local/lib /usr/lib /opt/cups/lib /opt/lib"
17ac_save_IFS=$IFS
18IFS="${IFS}:"
19## LIBRARY_DIRS comes from command line, SRCH_LIB s defined above.
20for dir in $LIBRARY_DIRS $SRCH_LIB; do
21  if test -d "$dir"; then
22    LIBDIRS="$LIBDIRS -L$dir"
23## else
24##    AC_MSG_WARN([*** Library directory $dir does not exist.])
25  fi
26done
27IFS=$ac_save_IFS
28
29dnl Checks for required library functions.
30AC_CHECK_FUNCS(ftime \
31               getaddrinfo \
32               getnameinfo \
33               gethostname \
34               inet_ntoa \
35               inet_ntop \
36               ntohl \
37               ntohs \
38               memset\
39               select \
40               socket \
41               strcasecmp \
42               strchr \
43               strerror \
44               strncasecmp \
45	       strstr \
46	       strtol \
47               ,,AC_MSG_ERROR( required library function missing ))
48
49AC_FUNC_MALLOC
50
51dnl check for optional functions
52AC_CHECK_FUNCS(getifaddrs)
53
54dnl check for Werror
55
56AC_ARG_ENABLE(Werror,
57        AC_HELP_STRING([--disable-Werror], [don't use gcc's -Werror option when building]))
58
59if test x"$enable_Werror" != xno
60then
61        EXTRA_CFLAGS="-Werror"
62fi
63AC_SUBST([EXTRA_CFLAGS])
64
65dnl check for IPv6 (can be overriden by --enable-ipv6)
66if test "$ac_cv_func_getnameinfo" = "yes" \
67  && test "$ac_cv_func_getaddrinfo" = "yes" ; then
68  BJNP_CHECK_IPV6
69else
70  ipv6="no"
71fi
72
73## find cups-configuration
74AC_MSG_CHECKING(cups development support)
75if test -n "`cups-config --build 2> /dev/null`"; then
76	cups_config_found=yes
77        AC_MSG_RESULT($cups_config_found)
78else
79	AC_MSG_ERROR([cups development files not found])
80fi
81
82## determine cups backend directory
83
84AC_MSG_CHECKING([cups backend directory])
85AC_ARG_WITH(cupsbackenddir,
86	    AC_HELP_STRING([--with-cupsbackenddir=DIR],
87                           [cups-backends directory (auto)]),
88	    [cupsbackenddir="${withval}"],
89	    [cupsbackenddir=`cups-config --serverbin`/backend])
90if test -d "$cupsbackenddir"; then
91	AC_SUBST([cupsbackenddir])
92	AC_MSG_RESULT([$cupsbackenddir])
93else
94	AC_MSG_ERROR([cups backend directory not found!])
95fi
96AC_SUBST([CUPS_CFLAGS], ["`cups-config --cflags`"])
97AC_SUBST([CUPS_LIBS], ["`cups-config --libs`"])
98AC_SUBST([CUPS_LDFLAGS], ["`cups-config --ldflags`"])
99
100## header file that contains output from configure
101
102AC_CONFIG_HEADERS([config.h])
103## AC_USE_SYSTEM_EXTENSIONS
104dnl Checks for programs.
105AC_SEARCH_LIBS([strerror],[cposix])
106
107## determine libraries that need to get linked
108
109AC_SEARCH_LIBS([socket], [socket])
110
111## Checks for header files.
112AC_HEADER_STDC
113AC_FUNC_SELECT_ARGTYPES
114AC_CHECK_HEADERS(string.h \
115                 fcntl.h \
116                 arpa/inet.h \
117                 netdb.h \
118                 netinet/in.h \
119                 sys/socket.h \
120                 sys/time.h \
121                 sys/timeb.h \
122                 wchar.h \
123                 cups/cups.h \
124		 cups/backend.h \
125                 cups/http.h \
126                ,, AC_MSG_ERROR( required header file missing ))
127
128AC_HEADER_RESOLV
129
130AC_TYPE_SIZE_T
131AC_TYPE_SSIZE_T
132AC_TYPE_UINT16_T
133AC_TYPE_UINT32_T
134AC_TYPE_UINT8_T
135
136## dnl internationalization macros
137## AM_GNU_GETTEXT
138AM_MAINTAINER_MODE
139## AC_CONFIG_FILES([Makefile])
140AC_OUTPUT([Makefile])
141