Initial autoconfig framework bits
git-svn-id: http://repo.ham.fi/svn/aprsc/trunk@16 3ce903b1-3385-4e86-93cd-f9a4a239f7ac
This commit is contained in:
parent
31528bdaa8
commit
31778bbf65
57
src/Makefile
57
src/Makefile
|
|
@ -1,57 +0,0 @@
|
|||
all: aprsc
|
||||
|
||||
CC = gcc
|
||||
LD = gcc
|
||||
CFLAGS = -Wall -Wstrict-prototypes -g -D_REENTRANT
|
||||
#CFLAGS = -Wall -Wstrict-prototypes -O3 -D_REENTRANT
|
||||
LDFLAGS = -lpthread
|
||||
|
||||
# Linux:
|
||||
# -lpthread
|
||||
# Solaris 2.8:
|
||||
# -lpthread -lxnet -lsocket -lnss -lrt
|
||||
# Solaris 2.6:
|
||||
# -lpthread -lxnet -lsocket -lnsl -lposix4 -lresolv
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ */*~ core
|
||||
distclean: clean
|
||||
rm -f aprsc
|
||||
|
||||
BITS = aprsc.o accept.o worker.o \
|
||||
login.o incoming.o dupecheck.o outgoing.o \
|
||||
parse_aprs.o \
|
||||
config.o netlib.o xpoll.o \
|
||||
cfgfile.o passcode.o \
|
||||
rwlock.o hmalloc.o hlog.o \
|
||||
splay.o spsymbol.o crc32.o
|
||||
|
||||
aprsc: $(BITS)
|
||||
$(LD) $(LDFLAGS) -o aprsc $(BITS)
|
||||
|
||||
|
||||
aprsc.o: aprsc.c hmalloc.h hlog.h config.h splay.h accept.h
|
||||
accept.o: accept.c accept.h hmalloc.h hlog.h config.h netlib.h worker.h dupecheck.h
|
||||
worker.o: worker.c worker.h hmalloc.h hlog.h config.h xpoll.h incoming.h outgoing.h
|
||||
login.o: login.c login.h hmalloc.h hlog.h worker.h passcode.h incoming.h config.h
|
||||
incoming.o: incoming.c incoming.h hmalloc.h hlog.h worker.h parse_aprs.h
|
||||
outgoing.o: outgoing.c outgoing.h hlog.h worker.h
|
||||
dupecheck.o: dupecheck.c dupecheck.h hmalloc.h hlog.h worker.h
|
||||
parse_aprs.o: parse_aprs.c parse_aprs.h hlog.h
|
||||
parse_aprs.h: worker.h
|
||||
passcode.o: passcode.c passcode.h
|
||||
xpoll.o: xpoll.c xpoll.h hmalloc.h hlog.h
|
||||
netlib.o: netlib.c netlib.h worker.h
|
||||
rwlock.o: rwlock.c rwlock.h
|
||||
hmalloc.o: hmalloc.c hmalloc.h
|
||||
hlog.o: hlog.c hlog.h hmalloc.h rwlock.h
|
||||
cfgfile.o: cfgfile.c cfgfile.c hmalloc.h
|
||||
config.o: config.c config.h cfgfile.h hmalloc.h hlog.h
|
||||
splay.o: splay.c splay.h hmalloc.h config.h
|
||||
spsymbol.o: spsymbol.c splay.h hmalloc.h crc32.h
|
||||
crc32.o: crc32.c crc32.h
|
||||
netlib.o: netlib.c netlib.h
|
||||
worker.h: rwlock.h xpoll.h
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
#
|
||||
# APRSC
|
||||
#
|
||||
|
||||
# -------------------------------------------------------------------- #
|
||||
# target paths
|
||||
|
||||
VARRUN= /var/run # directory for aprx.state and pid-file
|
||||
VARLOG= /var/log/aprsc # directory for direct logfiles
|
||||
CFGFILE= @sysconfdir@/aprsc.conf # default configuration file
|
||||
SBINDIR= @sbindir@ # installation path for programs
|
||||
MANDIR= @mandir@ # installation path for manual pages
|
||||
|
||||
# -------------------------------------------------------------------- #
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
@SET_MAKE@
|
||||
|
||||
# Compiler and flags
|
||||
CC= @CC@
|
||||
CFLAGS= @CFLAGS@ $(DEFS)
|
||||
|
||||
# Linker and flags
|
||||
LD= @LD@
|
||||
LDFLAGS= @LDFLAGS@
|
||||
|
||||
INSTALL= $(srcdir)/install-sh
|
||||
INSTALL_PROGRAM=$(INSTALL) -m 755
|
||||
INSTALL_DATA= $(INSTALL) -m 644
|
||||
|
||||
LIBS= @LIBS@ -lpthread @LIBSOCKET@
|
||||
|
||||
# Linux:
|
||||
# -lpthread
|
||||
# Solaris 2.8:
|
||||
# -lpthread -lxnet -lsocket -lnss -lrt
|
||||
# Solaris 2.6:
|
||||
# -lpthread -lxnet -lsocket -lnsl -lposix4 -lresolv
|
||||
|
||||
# -------------------------------------------------------------------- #
|
||||
|
||||
DEFS= -Wall -Wstrict-prototypes -D_REENTRANT
|
||||
|
||||
|
||||
# -------------------------------------------------------------------- #
|
||||
|
||||
.PHONY: all clean distclean
|
||||
|
||||
all: aprsc
|
||||
|
||||
# -------------------------------------------------------------------- #
|
||||
|
||||
OBJS = aprsc.o accept.o worker.o \
|
||||
login.o incoming.o dupecheck.o outgoing.o \
|
||||
parse_aprs.o \
|
||||
config.o netlib.o xpoll.o \
|
||||
cfgfile.o passcode.o \
|
||||
rwlock.o hmalloc.o hlog.o \
|
||||
splay.o spsymbol.o crc32.o \
|
||||
filter.o \
|
||||
@LIBOBJS@
|
||||
|
||||
clean:
|
||||
rm -f *.o *~ */*~ core *.d
|
||||
|
||||
distclean: clean
|
||||
rm -f aprsc
|
||||
|
||||
aprsc: $(OBJS)
|
||||
$(LD) $(LDFLAGS) -o aprsc $(OBJS) $(LIBS)
|
||||
|
||||
%.o: %.c VERSION Makefile
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
@$(CC) -MM $(CFLAGS) $< > $(@:.o=.d)
|
||||
|
||||
# include object depencies if available
|
||||
-include $(OBJS:.o=.d)
|
||||
|
|
@ -0,0 +1 @@
|
|||
0.10
|
||||
|
|
@ -0,0 +1,160 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([aprsc.c])
|
||||
|
||||
dnl For automake
|
||||
VERSION="`cat VERSION`"
|
||||
PACKAGE=aprsc
|
||||
dnl AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
AC_CONFIG_HEADERS([ac-hdrs.h])
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
|
||||
|
||||
dnl AC_PATH_PROG(LD, ld, ld)dnl
|
||||
if test -z "$LD" ; then
|
||||
LD="$CC"
|
||||
fi
|
||||
AC_SUBST(LD,"$LD")
|
||||
|
||||
|
||||
dnl Check for headers.
|
||||
dnl AC_CHECK_HEADERS(pty.h)
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
|
||||
dnl Checks for library functions.
|
||||
AC_CHECK_FUNCS(openpty,,
|
||||
AC_CHECK_LIB(util, openpty,
|
||||
[AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"]))
|
||||
|
||||
AC_CHECK_FUNCS(pthread_exit,,
|
||||
AC_CHECK_LIB(pthread, pthead_exit,
|
||||
[AC_DEFINE([HAVE_PTHREAD],[1],[pthread library])] [LIBS="$LIBS -lpthread"]))
|
||||
|
||||
AC_CHECK_FUNCS(getnameinfo,,
|
||||
AC_CHECK_LIB(nsl, getnameinfo,
|
||||
[AC_DEFINE([HAVE_GETNAMEINFO],[1],[getnameinfo function])] [LIBS="$LIBS -lnsl"]))
|
||||
|
||||
|
||||
#
|
||||
# We check for various libraries
|
||||
# - SysVr4 style of "-lsocket" at first (unless in libc)
|
||||
# The hallmark is connect() routine (we presume)
|
||||
#
|
||||
AC_SUBST(LIBSOCKET)dnl
|
||||
ac_cv_libsocket_both=1
|
||||
AC_CHECK_FUNC(connect, ac_cv_libsocket_both=0)
|
||||
AC_CHECK_FUNC(gethostbyname, ac_cv_libsocket_both=0)
|
||||
if test "$ac_cv_libsocket_both" = 1 ; then
|
||||
# Check cache
|
||||
if test "$ac_cv_func_socket_lxnet" = yes ; then
|
||||
AC_MSG_RESULT([need -lxnet library (cached)])
|
||||
LIBSOCKET="-lnsl -lsocket -lxnet"
|
||||
else
|
||||
if test "$ac_cv_func_socket_lsocket" = yes ; then
|
||||
AC_MSG_RESULT([need -lsocket library (cached)])
|
||||
LIBSOCKET="-lsocket"
|
||||
if test "$ac_cv_func_gethostbyname_lnsl" = yes ; then
|
||||
LIBSOCKET="-lnsl -lsocket"
|
||||
fi
|
||||
else
|
||||
# Well, will this work ? SysVR4, but not Sun Solaris ?
|
||||
AC_CHECK_LIB(xnet, connect, [LIBSOCKET="-lnsl -lsocket -lxnet"
|
||||
ac_cv_func_socket_lsocket=no
|
||||
ac_cv_func_socket_lxnet=yes],[
|
||||
AC_CHECK_LIB(socket, connect, [LIBSOCKET="-lsocket"
|
||||
ac_cv_func_socket_lsocket=yes],
|
||||
ac_cv_func_socket_lsocket=no)
|
||||
if test "$ac_cv_func_socket_lsocket" = yes ; then
|
||||
t_oldLibs="$LIBS"
|
||||
LIBS="$LIBS -lsocket"
|
||||
AC_TRY_LINK([],[gethostbyname();], ,[
|
||||
LIBS="$LIBS -lnsl" # Add this Solaris library..
|
||||
AC_TRY_LINK([],[gethostbyname();],[
|
||||
LIBSOCKET="-lsocket -lnsl"
|
||||
ac_cv_func_gethostbyname_lnsl=yes
|
||||
], [
|
||||
AC_MSG_ERROR([Weird, '$LIBS' not enough to find gethostnyname() ?!])
|
||||
])
|
||||
])
|
||||
LIBS="$t_oldLibs"
|
||||
fi
|
||||
])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# See about the routines that possibly exist at the libraries..
|
||||
LIBS="$t_oldLibs $LIBSOCKET"
|
||||
AC_CHECK_FUNCS(socket socketpair)
|
||||
LIBS="$t_oldLibs"
|
||||
|
||||
if test "$ac_cv_func_socket" = no -a "$LIBSOCKET" != ""; then
|
||||
LIBS="$LIBS $LIBSOCKET"
|
||||
AC_TRY_LINK([],[socket();], ac_cv_func_socket=yes)
|
||||
if test $ac_cv_func_socket = yes; then
|
||||
AC_DEFINE(HAVE_SOCKET)
|
||||
AC_MSG_RESULT([Has socket() when using $LIBSOCKET])
|
||||
fi
|
||||
LIBS="$t_oldLibs"
|
||||
fi
|
||||
if test "$ac_cv_func_socketpair" = no -a "$LIBSOCKET" != ""; then
|
||||
LIBS="$LIBS $LIBSOCKET"
|
||||
AC_TRY_LINK([],[socketpair();], ac_cv_func_socketpair=yes)
|
||||
if test $ac_cv_func_socketpair = yes; then
|
||||
AC_DEFINE(HAVE_SOCKETPAIR)
|
||||
AC_MSG_RESULT([Has socketpair() when using $LIBSOCKET])
|
||||
fi
|
||||
LIBS="$t_oldLibs"
|
||||
fi
|
||||
|
||||
ac_with_ipv6_replacement_libc=0
|
||||
AC_ARG_WITH(ipv6-replacement-libc, [ --with-ipv6-replacement-libc If system has broken getaddrinfo() and friends],
|
||||
ac_with_ipv6_replacement_libc=1)
|
||||
|
||||
LIBS="$LIBSOCKET $LIBS"
|
||||
AC_CHECK_FUNCS(getnameinfo gai_strerror inet_ntop inet_pton)
|
||||
LIBS="$t_oldLibs"
|
||||
|
||||
|
||||
t_oldLibs="$LIBS"
|
||||
LIBS="$LIBS $LIBSOCKET"
|
||||
|
||||
# Following stuff may exist in our LIBC, or in separate -linet6
|
||||
# AC_CHECK_FUNCS(inet_ntop inet_pton getaddrinfo getnameinfo gai_strerror)
|
||||
# If not found in LIBC, try to use -linet6, if it fails too,
|
||||
# THEN call the AC_REPLACE_FUNCS()
|
||||
if test "$ac_cv_func_gai_strerror" = no ; then
|
||||
LIBS="$LIBS -linet6"
|
||||
AC_TRY_LINK([],[gai_strerror();], ac_cv_func_gai_strerror=yes)
|
||||
LIBS="$t_oldLibs"
|
||||
if test "$ac_cv_func_gai_strerror" = yes; then
|
||||
LIBSOCKET="$LIBSOCKET -linet6"
|
||||
AC_MSG_RESULT([Has IPv6 API gai_strerror() when using $LIBSOCKET])
|
||||
else
|
||||
AC_LIBOBJ([inet_ntop])
|
||||
AC_LIBOBJ([inet_pton])
|
||||
AC_LIBOBJ([getnameinfo])
|
||||
AC_LIBOBJ([gai_strerror])
|
||||
fi
|
||||
fi
|
||||
|
||||
LIBS="$t_oldLibs"
|
||||
|
||||
|
||||
|
||||
AC_CHECK_FUNC(res_init) # Can be found without any libs ? Or needs BIND libresolv ?
|
||||
AC_CHECK_FUNC(res_mkquery)
|
||||
|
||||
|
||||
|
||||
dnl Output files
|
||||
AC_CONFIG_FILES([Makefile])
|
||||
AC_OUTPUT
|
||||
Loading…
Reference in New Issue