| 1 | dnl Process this file with autoconf to produce a configure script. |
|---|
| 2 | AC_INIT(src/licq.h) |
|---|
| 3 | AC_CONFIG_HEADER(config.h) |
|---|
| 4 | |
|---|
| 5 | dnl All versioning is done via these defines |
|---|
| 6 | PACKAGE=Licq |
|---|
| 7 | VERSION=0.70h |
|---|
| 8 | INT_VERSION=708 |
|---|
| 9 | |
|---|
| 10 | dnl Chuck #defines for PACKAGE and VERSION into config.h |
|---|
| 11 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") |
|---|
| 12 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION") |
|---|
| 13 | AC_DEFINE_UNQUOTED(INT_VERSION,$INT_VERSION) |
|---|
| 14 | |
|---|
| 15 | dnl Also substitute PACKAGE and VERSION in the AC_OUTPUT files |
|---|
| 16 | AC_SUBST(PACKAGE) |
|---|
| 17 | AC_SUBST(VERSION) |
|---|
| 18 | |
|---|
| 19 | dnl Set up some operating system specific options |
|---|
| 20 | AC_CANONICAL_SYSTEM |
|---|
| 21 | case "$host" in |
|---|
| 22 | *-*-openbsd*) |
|---|
| 23 | CFLAGS="$CFLAGS -pthread" |
|---|
| 24 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" |
|---|
| 25 | CXXFLAGS="$CXXFLAGS -pthread" |
|---|
| 26 | echo "Setting OpenBSD compilation options" |
|---|
| 27 | ;; |
|---|
| 28 | *-*-freebsd*) |
|---|
| 29 | CFLAGS="$CFLAGS -pthread" |
|---|
| 30 | CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" |
|---|
| 31 | CXXFLAGS="$CXXFLAGS -pthread" |
|---|
| 32 | echo "Setting FreeBSD compilation options" |
|---|
| 33 | ;; |
|---|
| 34 | *-*-solaris*) |
|---|
| 35 | CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DPIC -fPIC" |
|---|
| 36 | CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions" |
|---|
| 37 | echo "Setting Solaris compilation options" |
|---|
| 38 | ;; |
|---|
| 39 | *-*-linux*) |
|---|
| 40 | CPPFLAGS="$CPPFLAGS -fPIC -DPIC" |
|---|
| 41 | CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions" |
|---|
| 42 | echo "Setting Linux compilation options" |
|---|
| 43 | ;; |
|---|
| 44 | *) |
|---|
| 45 | echo "Licq may not compile on this system. Good luck :-)" |
|---|
| 46 | ;; |
|---|
| 47 | esac |
|---|
| 48 | |
|---|
| 49 | dnl Checks for programs. |
|---|
| 50 | AC_PROG_CC |
|---|
| 51 | AC_PROG_CPP |
|---|
| 52 | AC_PROG_CXX |
|---|
| 53 | dnl AC_PROG_CXX_FNO_RTTI |
|---|
| 54 | AC_PROG_CXXCPP |
|---|
| 55 | AC_PROG_MAKE_SET |
|---|
| 56 | AC_PROG_INSTALL |
|---|
| 57 | AC_PROG_RANLIB |
|---|
| 58 | AC_PATH_PROG(PROG_STRIP,strip,:) |
|---|
| 59 | AC_PATH_PROG(PROG_SIZE,size,:) |
|---|
| 60 | |
|---|
| 61 | dnl Checks for header files. |
|---|
| 62 | AC_HEADER_DIRENT |
|---|
| 63 | AC_HEADER_STDC |
|---|
| 64 | AC_CHECK_HEADERS(errno.h fcntl.h getopt.h limits.h malloc.h pwd.h unistd.h) |
|---|
| 65 | |
|---|
| 66 | dnl Checks for library functions. |
|---|
| 67 | AC_CHECK_LIB(xnet,inet_addr) |
|---|
| 68 | AC_CHECK_LIB(socket, socket) |
|---|
| 69 | AC_CHECK_LIB(nsl, gethostbyname) |
|---|
| 70 | |
|---|
| 71 | AC_CHECK_LIB(c_r,pthread_create, [], [ |
|---|
| 72 | AC_CHECK_LIB(pthread, pthread_create, [], [ |
|---|
| 73 | AC_CHECK_LIB(thread, pthread_create, [], [ |
|---|
| 74 | cat <<EOF; |
|---|
| 75 | |
|---|
| 76 | Please install/update your POSIX threads (pthreads) library. Updates should be |
|---|
| 77 | available from either your system vendor, or, for GNU/Linux systems, go to |
|---|
| 78 | http://pauillac.inria.fr/~xleroy/linuxthreads/ |
|---|
| 79 | |
|---|
| 80 | EOF |
|---|
| 81 | exit 1 |
|---|
| 82 | ]) |
|---|
| 83 | ]) |
|---|
| 84 | ]) |
|---|
| 85 | |
|---|
| 86 | dnl AC_CHECK_LIB(c, dlopen) |
|---|
| 87 | dnl if test "$ac_cv_lib_c_dlopen" = "no"; then |
|---|
| 88 | dnl AC_CHECK_LIB(dl, dlopen) |
|---|
| 89 | dnl if test "$ac_cv_lib_dl_dlopen" = "no"; then |
|---|
| 90 | dnl echo "I can't find the library containing dlopen()" |
|---|
| 91 | dnl exit 1 |
|---|
| 92 | dnl fi |
|---|
| 93 | dnl fi |
|---|
| 94 | |
|---|
| 95 | AC_CHECK_LIB(c_r, dlopen, [], [ |
|---|
| 96 | AC_CHECK_LIB(c, dlopen, [], [ |
|---|
| 97 | AC_CHECK_LIB(dl, dlopen, [], [ |
|---|
| 98 | echo "I can't find the library containing dlopen()" |
|---|
| 99 | exit 1 |
|---|
| 100 | ]) |
|---|
| 101 | ]) |
|---|
| 102 | ]) |
|---|
| 103 | |
|---|
| 104 | AC_MSG_CHECKING([for dlopen modes]) |
|---|
| 105 | AC_TRY_COMPILE([ |
|---|
| 106 | #include <stdio.h> |
|---|
| 107 | #include <dlfcn.h> |
|---|
| 108 | ],[ |
|---|
| 109 | dlopen(NULL, RTLD_LAZY) |
|---|
| 110 | ],[ |
|---|
| 111 | AC_MSG_RESULT([RTLD_LAZY]) |
|---|
| 112 | AC_DEFINE_UNQUOTED(DLOPEN_POLICY, RTLD_LAZY) |
|---|
| 113 | ],[ |
|---|
| 114 | AC_TRY_COMPILE([ |
|---|
| 115 | #include <stdio.h> |
|---|
| 116 | #include <dlcfn.h> |
|---|
| 117 | ],[ |
|---|
| 118 | dlopen(NULL, DL_LAZY) |
|---|
| 119 | ],[ |
|---|
| 120 | AC_MSG_RESULT([DL_LAZY]) |
|---|
| 121 | AC_DEFINE_UNQUOTED(DLOPEN_POLICY, DL_LAZY) |
|---|
| 122 | ],[ |
|---|
| 123 | AC_MSG_RESULT([cannot determine, bailing]) |
|---|
| 124 | exit 1; |
|---|
| 125 | ]) |
|---|
| 126 | ]) |
|---|
| 127 | |
|---|
| 128 | AC_CHECK_FUNCS(alphasort inet_addr inet_aton mktime select scandir strdup strerror hstrerror gethostbyname_r) |
|---|
| 129 | |
|---|
| 130 | AC_CHECK_SOCKS5 |
|---|
| 131 | |
|---|
| 132 | dnl Switch to C++ mode and check for needed C++ headers |
|---|
| 133 | AC_LANG_SAVE |
|---|
| 134 | AC_LANG_CPLUSPLUS |
|---|
| 135 | |
|---|
| 136 | AC_CHECK_LIB(stdc++, getc,, |
|---|
| 137 | AC_MSG_ERROR(You need to have libstdc++ installed)) |
|---|
| 138 | AC_CHECK_HEADER(vector.h,, |
|---|
| 139 | AC_MSG_ERROR(You need to have the libstdc++ headers installed)) |
|---|
| 140 | |
|---|
| 141 | AC_LANG_RESTORE |
|---|
| 142 | |
|---|
| 143 | dnl Checks for typedefs, structures, and compiler characteristics. |
|---|
| 144 | AC_C_CONST |
|---|
| 145 | AC_TYPE_SIZE_T |
|---|
| 146 | AC_C_SOCKLEN_T |
|---|
| 147 | AC_HEADER_TIME |
|---|
| 148 | AC_STRUCT_TM |
|---|
| 149 | AC_SYS_ERRLIST |
|---|
| 150 | |
|---|
| 151 | AC_OUTPUT( |
|---|
| 152 | share/Makefile |
|---|
| 153 | src/Makefile |
|---|
| 154 | src/daemon/Makefile |
|---|
| 155 | Makefile) |
|---|
| 156 | |
|---|
| 157 | echo "" |
|---|
| 158 | echo "Please remember to use GNU make, often installed as gmake." |
|---|
| 159 | echo "" |
|---|