blob: 12b59dd78311db0217a78d567016a730e4ff33b8 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.59)
5AC_INIT(library, 1.0, support@itibia.com)
6AC_CONFIG_AUX_DIR([build])
7AM_INIT_AUTOMAKE([-Wall -Werror foreign])
8AC_CONFIG_SRCDIR([])
9AC_CONFIG_HEADER([config.h])
10
11#AC_PREFIX_DEFAULT([])
12
13# Checks for programs.
14AC_PROG_CXX(g++)
15AC_PROG_CC(gcc g++)
16AC_PROG_MAKE_SET
17AC_PROG_CPP
18AC_PROG_LIBTOOL
19AC_PROG_RANLIB
20
21# Checks for libraries.
22#AC_CHECK_LIB([rt], [mq_open])
23
24# Checks for header files.
25AC_HEADER_DIRENT
26AC_HEADER_STDC
27AC_HEADER_SYS_WAIT
28AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h malloc.h netdb.h netinet/in.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/socket.h sys/time.h syslog.h unistd.h ])
29
30
31# Checks for typedefs, structures, and compiler characteristics.
32AC_HEADER_STDBOOL
33AC_C_CONST
34AC_TYPE_UID_T
35AC_C_INLINE
36AC_TYPE_PID_T
37AC_TYPE_SIZE_T
38AC_STRUCT_TM
39
40# Checks for library functions.
41AC_FUNC_ALLOCA
42AC_FUNC_CHOWN
43AC_FUNC_CLOSEDIR_VOID
44AC_FUNC_FORK
45AC_PROG_GCC_TRADITIONAL
46#comment it to prevent autoconf #define HAVE_MALLOC to 0 and #define malloc to rpl_malloc
47#AC_FUNC_MALLOC
48#AC_FUNC_MKTIME
49#AC_FUNC_REALLOC
50AC_FUNC_SELECT_ARGTYPES
51AC_TYPE_SIGNAL
52AC_FUNC_STAT
53AC_FUNC_STRFTIME
54#check machine endian
55AC_C_BIGENDIAN
56
57AC_CHECK_SIZEOF(int,[])
58AC_CHECK_SIZEOF(short,[])
59AC_CHECK_SIZEOF(long,[])
60AC_CHECK_SIZEOF(float,[])
61AC_CHECK_SIZEOF(double,[])
62
63AC_TYPE_PID_T
64AC_TYPE_SIZE_T
65
66AC_CHECK_FUNCS([alarm bzero endgrent endpwent getcwd gethostbyname inet_ntoa isascii localtime_r memmove memset mkdir regcomp select socket strcasecmp strchr strcspn strdup strerror strncasecmp strrchr strspn strstr])
67
68AC_CONFIG_FILES([Makefile
69libpool/src/Makefile libxmlet/src/Makefile libcwmp/src/Makefile
70 cwmpd/src/Makefile tests/src/Makefile
71 ])
72
73
74
75#save user-provided flags
76save_CXXFLAGS="$CXXFLAGS"
77save_CFLAGS="-Wall -g"
78save_LDFALGS="$LDFLAGS"
79save_CPPFLAGS="-Wall -g"
80
81#restore user-provided flags
82CXXFLAGS="$save_CXXFLAGS"
83CFLAGS="$save_CFLAGS "
84#Note that sysconfdir is expaned in Makefile other than here, check generated configure script, u can see
85#sysconfdir is surrounded by single quotas to prevent expansion.
86CPPFLAGS="-D_GNU_SOURCE $save_CPPFLAGS"
87
88LDFLAGS="$save_LDFALGS"
89
90#CPPFLAGS="$CPPFLAGS -DUSE_CWMP_OPENSSL"
91OPENSSL_DIR=no
92
93AC_ARG_WITH(openssl, --with-openssl=<path> sets path to temp directory, OPENSSL_DIR=$withval, OPENSSL_DIR=no)
94
95if test x"$OPENSSL_DIR" != "xno"; then
96 CPPFLAGS="$CPPFLAGS -DUSE_CWMP_OPENSSL -I$OPENSSL_DIR/include"
97 LDFLAGS="$LDFLAGS -L$OPENSSL_DIR/lib -lssl"
98fi
99AC_SUBST(OPENSSL_DIR)
100
101#LIBS will be appended to gcc command, so it must be cleared to prevent unnecessary linking
102#LIBS=""
103
104
105
106
107#AC_CANONICAL_BUILD
108#AC_CANONICAL_HOST
109
110AH_TEMPLATE([BUILD_CPU], [cpu type used in building environment])
111if test "x$build_cpu" != "x"; then
112 BUILD_CPU="$build_cpu"
113 AC_SUBST([BUILD_CPU])
114 AC_DEFINE_UNQUOTED([BUILD_CPU], [$build_cpu], [])
115fi
116AH_TEMPLATE([BUILD_VENDOR], [cpu vendor in building environment])
117if test "x$build_vendor" != "x"; then
118 BUILD_VENDOR="$build_vendor"
119 AC_SUBST([BUILD_VENDOR])
120 AC_DEFINE_UNQUOTED([BUILD_VENDOR], [$build_vendor], [])
121fi
122AH_TEMPLATE([BUILD_OS], [os of building environment])
123if test "x$build_os" != "x"; then
124 BUILD_OS="$build_os"
125 AC_SUBST([BUILD_OS])
126 AC_DEFINE_UNQUOTED([BUILD_OS], [$build_os], [])
127fi
128
129AH_TEMPLATE([HOST_CPU], [cpu type of host environment])
130if test "x$host_cpu" != "x"; then
131 HOST_CPU="$host_cpu"
132 AC_SUBST([HOST_CPU])
133 AC_DEFINE_UNQUOTED([HOST_CPU], [$host_cpu], [])
134fi
135AH_TEMPLATE([HOST_VENDOR], [cpu vendor of host environment])
136if test "x$host_vendor" != "x"; then
137 HOST_VENDOR="$host_vendor"
138 AC_SUBST([HOST_VENDOR])
139 AC_DEFINE_UNQUOTED([HOST_VENDOR], [$host_vendor], [])
140fi
141AH_TEMPLATE([HOST_OS], [os of host environment])
142if test "x$host_os" != "x"; then
143 HOST_OS="$host_os"
144 AC_SUBST([HOST_OS])
145 AC_DEFINE_UNQUOTED([HOST_OS], [$host_os], [])
146fi
147
148AM_CONDITIONAL([COMPILE_FOR_MIPS], [ test "$target" = "mips64-octeon-linux-gnu" ])
149AC_OUTPUT