summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJoe Nahmias <joe@nahmias.net>2012-12-07 21:44:43 -0500
committerJoe Nahmias <joe@nahmias.net>2012-12-07 21:44:43 -0500
commit879e6db06338166657609930768f76d8d7e7afbb (patch)
tree3018a2ec0a6aca4150250084bdaf4451ec4e1c3b /configure.ac
Imported Upstream version 1.2
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac149
1 files changed, 149 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..4101df0
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,149 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(cups-bjnp, 1.2, louis.lagendijk@gmail.com)
+
+AC_CONFIG_SRCDIR([bjnp.c])
+AM_INIT_AUTOMAKE
+AC_LIBSOURCES([cups-bjnp.spec])
+
+## Check for programs
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AM_PROG_CC_C_O
+##
+## Library directories
+##
+SRCH_LIB="/usr/local/lib /usr/lib /opt/cups/lib /opt/lib"
+ac_save_IFS=$IFS
+IFS="${IFS}:"
+## LIBRARY_DIRS comes from command line, SRCH_LIB s defined above.
+for dir in $LIBRARY_DIRS $SRCH_LIB; do
+ if test -d "$dir"; then
+ LIBDIRS="$LIBDIRS -L$dir"
+## else
+## AC_MSG_WARN([*** Library directory $dir does not exist.])
+ fi
+done
+IFS=$ac_save_IFS
+
+dnl Checks for required library functions.
+AC_CHECK_FUNCS(ftime \
+ getaddrinfo \
+ getnameinfo \
+ gethostname \
+ inet_ntoa \
+ inet_ntop \
+ ntohl \
+ ntohs \
+ memset\
+ select \
+ socket \
+ strcasecmp \
+ strchr \
+ strerror \
+ strncasecmp \
+ ,,AC_MSG_ERROR( required library function missing ))
+
+dnl check for optional functions
+AC_CHECK_FUNCS(getifaddrs)
+
+dnl check for Werror
+
+AC_ARG_ENABLE(Werror,
+ AC_HELP_STRING([--disable-Werror], [don't use gcc's -Werror option when building]))
+
+if test x"$enable_Werror" != xno
+then
+ EXTRA_CFLAGS="-Werror"
+fi
+AC_SUBST([EXTRA_CFLAGS])
+
+dnl check for IPv6 (can be overriden by --enable-ipv6)
+if test "$ac_cv_func_getnameinfo" = "yes" \
+ && test "$ac_cv_func_getaddrinfo" = "yes" ; then
+ BJNP_CHECK_IPV6
+else
+ ipv6="no"
+fi
+
+## find cups lib
+
+AC_CHECK_LIB(cups, cupsDoRequest,, AC_MSG_ERROR(CUPS library not found),)
+
+## determine cups backend directory
+
+AC_ARG_WITH(cupsbackenddir,
+ AC_HELP_STRING([--with-cupsbackenddir=DIR],
+ [ cups-backends directory (auto)]),
+[
+ cupsbackenddir="${withval}"
+ AC_SUBST([cupsbackenddir])dnl
+], [
+ dirs="/usr/lib/cups/backend /usr/local/lib/cups/backend /opt/lib/cups/backend\
+ /usr/local/libexec/cups/backend /usr/libexec/cups/backend"
+ cupsbackenddir=""
+ for dir in $dirs; do
+ if test -d "$dir" -a -z "$cupsbackenddir"; then
+ cupsbackenddir=$dir
+ fi
+ done
+ if test -n "$cupsbackenddir"; then
+ echo found Cups backend directory $cupsbackenddir
+ AC_SUBST([cupsbackenddir])dnl
+ else
+ AC_MSG_ERROR([Cups backend directory not specified and auto-detection failed!])
+ fi
+])
+
+## Check if we have rpmbuild, so we can build rpm's
+AC_PATH_PROG([RPMBUILD],rpmbuild)
+AC_ARG_VAR(RPMBUILD, rpmbuild command)
+if test -n "$RPMBUILD"; then
+ rpmtarget=$srcdir/conf/rpmbuild
+else
+ rpmtarget=$srcdir/conf/norpm
+fi
+AC_SUBST_FILE(rpmtarget)
+AC_SUBST(RPMBUILD)
+
+## header file that contains output from configure
+
+AC_CONFIG_HEADERS([config.h])
+## AC_USE_SYSTEM_EXTENSIONS
+dnl Checks for programs.
+AC_SEARCH_LIBS([strerror],[cposix])
+
+## determine libraries that need to get linked
+
+AC_SEARCH_LIBS([socket], [socket])
+
+## Checks for header files.
+AC_HEADER_STDC
+AC_FUNC_SELECT_ARGTYPES
+AC_CHECK_HEADERS(string.h \
+ fcntl.h \
+ arpa/inet.h \
+ netdb.h \
+ netinet/in.h \
+ sys/socket.h \
+ sys/time.h \
+ sys/timeb.h \
+ wchar.h \
+ cups/cups.h \
+ cups/backend.h \
+ cups/http.h \
+ ,, AC_MSG_ERROR( required header file missing ))
+
+AC_HEADER_RESOLV
+
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT8_T
+
+## dnl internationalization macros
+## AM_GNU_GETTEXT
+AM_MAINTAINER_MODE
+## AC_CONFIG_FILES([Makefile])
+AC_OUTPUT([Makefile])