CPPFLAGS += -Wshadow
CPPFLAGS += -Wbad-function-cast
-BINARIES = para_server para_client para_gui para_audioc para_recv \
+CPPFLAGS += @SSL_CPPFLAGS@
+CPPFLAGS += @ncurses_cppflags@
+
+BINARIES = para_server para_client para_audioc para_recv \
para_filter para_write para_fsck @extra_binaries@
man_binaries := $(filter-out para_dbadm para_slider para_krell.so, $(BINARIES))
man_pages := $(patsubst %, man/man1/%.1, $(man_binaries))
%.cmdline.o: %.cmdline.c
$(CC) -c $(CPPFLAGS) $<
+
%.o: %.c
$(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
$(CC) -o $@ @audiod_objs@ @audiod_ldflags@
para_audioc: @audioc_objs@
- $(CC) -o $@ @audioc_objs@
+ $(CC) -o $@ @audioc_objs@ @audioc_ldflags@
para_dbadm: $(dbadm_objs)
$(CC) -o $@ $(dbadm_objs) -lncurses -lmenu
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_LSTAT
-AC_CHECK_FUNCS([atexit dup2 gethostbyname inet_ntoa memchr memmove memset \
- regcomp select socket strchr strdup strerror strstr strtol uname \
+AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
+ regcomp select strchr strdup strerror strstr strtol uname \
fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
strncasecmp strrchr strspn alarm], [],
[AC_MSG_ERROR([function not found, cannot live without it])])
-########################################################################### curses
-AC_CHECK_LIB([ncurses], [initscr], [],
- [AC_MSG_ERROR([libncurses not found])])
-
-AC_CHECK_LIB([menu], [new_menu], [extras="$extras para_dbadm"],
- [AC_MSG_WARN([libmenu not found, cannot build para_dbadm])])
-
recv_cmdline_objs="recv.cmdline http_recv.cmdline dccp_recv.cmdline"
recv_errlist_objs="http_recv recv_common recv time string net dccp_recv
audioc_cmdline_objs="audioc.cmdline"
audioc_errlist_objs="audioc string net fd"
+audioc_ldflags=""
audiod_cmdline_objs="audiod.cmdline grab_client.cmdline compress_filter.cmdline
http_recv.cmdline dccp_recv.cmdline file_write.cmdline client.cmdline
if test -f "$ssldir/include/openssl/ssl.h"; then
found_ssl="yes"
AC_MSG_RESULT(yes)
- SSL_CFLAGS="-I$ssldir/include/openssl"
- SSL_CPPFLAGS="-I$ssldir/include/openssl"
- break
- fi
- if test -f "$ssldir/include/ssl.h"; then
- found_ssl="yes";
- AC_MSG_RESULT(yes)
- SSL_CFLAGS="-I$ssldir/include/";
- SSL_CPPFLAGS="-I$ssldir/include/";
+ SSL_CFLAGS="-I$ssldir/include"
+ SSL_CPPFLAGS="-I$ssldir/include"
break
fi
AC_MSG_RESULT(no)
audiod_ldflags="$audiod_ldflags $SSL_LDFLAGS $SSL_LIBS"
fsck_ldflags="$fsck_ldflags $SSL_LDFLAGS $SSL_LIBS"
+########################################################################### libsocket
+AC_CHECK_LIB([c], [socket],
+ [socket_lib=],
+ [socket_lib="-lsocket"]
+)
+server_ldflags="$server_ldflags $socket_lib"
+client_ldflags="$client_ldflags $socket_lib"
+audioc_ldflags="$audioc_ldflags $socket_lib"
+recv_ldflags="$recv_ldflags $socket_lib"
+########################################################################### libnsl
+AC_CHECK_LIB([c], [gethostbyname],
+ [nsl_lib=],
+ [nsl_lib="-lnsl"]
+)
+server_ldflags="$server_ldflags $nsl_lib"
+client_ldflags="$client_ldflags $nsl_lib"
+audioc_ldflags="$audioc_ldflags $nsl_lib"
+recv_ldflags="$recv_ldflags $nsl_lib"
########################################################################### ucred
AC_MSG_CHECKING(for struct ucred)
AC_TRY_LINK([
AC_DEFINE(HAVE_UCRED, 1, define to 1 you have struct ucred)
fi
+########################################################################### curses
+have_ncurses="yes"
+OLD_CPPFLAGS="$CPPFLAGS"
+OLD_LD_FLAGS="$LDFLAGS"
+OLD_LIBS="$LIBS"
+AC_ARG_WITH(ncurses_headers, [AC_HELP_STRING(--with-ncurses-headers=dir,
+ [look for ncurses.h also in dir])])
+if test -n "$with_ncurses_headers"; then
+ ncurses_cppflags="-I$with_ncurses_headers"
+ CPPFLAGS="$CPPFLAGS $ncurses_cppflags"
+fi
+AC_ARG_WITH(ncurses_libs, [AC_HELP_STRING(--with-ncurses-libs=dir,
+ [look for libncurses also in dir])])
+if test -n "$with_ncurses_libs"; then
+ ncurses_libs="-L$with_ncurses_libs"
+ LDFLAGS="$LDFLAGS $ncurses_libs"
+fi
+AC_CHECK_HEADER(curses.h, [], [
+ have_ncurses="no"
+])
+AC_CHECK_LIB([ncurses], [initscr], [], [
+ have_ncurses="no"
+])
+if test "$have_ncurses" = "yes"; then
+ AC_SUBST(ncurses_cppflags)
+ AC_SUBST(ncurses_libs)
+ AC_DEFINE(HAVE_NCURSES, 1, [define to 1 to turn on ncurses support])
+ extras="$extras para_gui"
+else
+ AC_MSG_WARN([cannot build para_gui])
+fi
+CPPFLAGS="$OLD_CPPFLAGS"
+LDFLAGS="$OLD_LDFLAGS"
+LIBS="$OLD_LIBS"
########################################################################### osx
AC_MSG_CHECKING(for CoreAudio (MacOs))
objlist_to_errlist($fsck_errlist_objs), errors used by para_fsck)
AC_SUBST(audioc_objs, add_dot_o($audioc_objs))
+AC_SUBST(audioc_ldflags, $audioc_ldflags)
AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
objlist_to_errlist($audioc_errlist_objs), errors used by para_audioc)