From f561ba2a444fa5ad161e5c415ee0f2f83527bda7 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 5 Oct 2007 20:18:22 +0200 Subject: [PATCH] Make it compile on Solaris. This required a bit of work as Solaris has gethostbyname() and socket-related functions not in libc but in libsocket and libnsl. So add corresponding checks to configure.ac. Moreover, make para_gui optional and add configure options for specifying the directory containing the curses headers and curses lib. --- FEATURES | 2 +- Makefile.in | 8 ++++-- configure.ac | 76 +++++++++++++++++++++++++++++++++++++++------------- 3 files changed, 65 insertions(+), 21 deletions(-) diff --git a/FEATURES b/FEATURES index 595071c2..38cda9fc 100644 --- a/FEATURES +++ b/FEATURES @@ -3,7 +3,7 @@ Features ------------------------------------------------------------------------------ - * Runs on Linux, Mac OS, FreeBSD and probably other Unixes. + * Runs on Linux, Mac OS, FreeBSD, Solaris and probably other Unixes. * mp3, oggvorbis, aac(m4a) support * local or remote http, dccp, and ortp network audio streaming * volume normalizer diff --git a/Makefile.in b/Makefile.in index cd2f9c3e..05008fbb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -47,7 +47,10 @@ CPPFLAGS += -Wunused-macros 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)) @@ -213,6 +216,7 @@ mysql_selector.o: mysql_selector.c %.cmdline.o: %.cmdline.c $(CC) -c $(CPPFLAGS) $< + %.o: %.c $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $< @@ -235,7 +239,7 @@ para_audiod: @audiod_objs@ $(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 diff --git a/configure.ac b/configure.ac index 1c7925db..bc08e740 100644 --- a/configure.ac +++ b/configure.ac @@ -65,18 +65,11 @@ AC_FUNC_VPRINTF 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 @@ -94,6 +87,7 @@ filters=" compress wav" 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 @@ -145,15 +139,8 @@ AC_DEFUN([CHECK_SSL], 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) @@ -179,6 +166,24 @@ client_ldflags="$client_ldflags $SSL_LDFLAGS $SSL_LIBS" 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([ @@ -192,6 +197,40 @@ if test ${have_ucred} = yes; then 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)) @@ -568,6 +607,7 @@ AC_DEFINE_UNQUOTED(INIT_FSCK_ERRLISTS, 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) -- 2.39.5